load friends when app will mount

load friends when app will mount

--- src_cljs/cljat_webapp/cljat_webapp/app.cljs
+++ src_cljs/cljat_webapp/cljat_webapp/app.cljs
@@ -27,7 +27,7 @@
                             :title "corgi group"
                             :users [2 3]}]))

-(def sidebar-tab-stats (r/atom {:active :friends
+(def sidebar-tab-stats (r/atom {:active :threads
                                 :friends {}
                                 :threads {}}))

@@ -176,8 +176,15 @@
   (fn [thread]
     (let [thread-title (if (-> (:users thread) (count) (> 1))
                          (:title thread)
-                         (:nickname (->> (first (:users thread)) (find-user @friends-info))))]
-      [:a {:class "thread-item list-group-item"}
+                         (:nickname (->> (first (:users thread)) (find-user @friends-info))))
+          props-a (fn []
+                    {:id (str "thread-item-" (:tid thread)) :class "thread-item list-group-item"
+                     :on-click (fn [e]
+                                 (js/console.log "clicked thread: " (->> e
+                                                                      (.-currentTarget)
+                                                                      (.-id)
+                                                                      (re-find #"\d+"))))})]
+      [:a (props-a)
        [thread-avatar thread]
        [:div {:class "thread-item-body media-body"}
         [:small {:class "list-group-item-heading"} thread-title]]])))
@@ -192,13 +199,7 @@
 (defn sidebar-friends-pane [sidebar-stats]
   (r/create-class
     {:component-will-mount (fn [_]
-                             (js/console.log "sidebar friends pane -- will mount")
-                             (go
-                               (let [resp (<! (ajax-chan GET "/app/friends-info" {:user-id (.-uid js/cljat)}))]
-                                 (reset! friends-info (->
-                                                        (js->clj resp)
-                                                        (walk/keywordize-keys)
-                                                        (get-in [:data]))))))
+                             (js/console.log "sidebar friends pane -- will mount"))
      :component-did-mount (fn [_] (js/console.log "sidebar friends pane -- did mount"))
      :reagent-render (fn [sidebar-stats]
                        [:div {:id "sidebar-pane" :class "pane"}
@@ -349,6 +350,12 @@
     (r/create-class
       {:component-will-mount (fn [_]
                                (js/console.log "app component -- will mount")
+                               (go
+                                 (let [resp (<! (ajax-chan GET "/app/friends-info" {:user-id (.-uid js/cljat)}))]
+                                   (reset! friends-info (->
+                                                          (js->clj resp)
+                                                          (walk/keywordize-keys)
+                                                          (get-in [:data])))))
                                (go-loop []
                                  (let [val (<! ch-in)]
                                    (js/console.log "client recv!")


Whitespace.

Whitespace.

--- examples/haml/build.boot
+++ examples/haml/build.boot
@@ -16,7 +16,10 @@
            ;; installs the haml gem, unless it's already installed
            :gem [["haml" "4.0.5"]]
            ;; sets data from clojure in the ruby runtime, as globals
-           :set-var {"$haml_files" (->> fileset input-files (by-ext [".haml"]) (mapv #(.getAbsolutePath (tmpfile %))))
+           :set-var {"$haml_files" (->> fileset
+                                     input-files
+                                     (by-ext [".haml"])
+                                     (mapv #(.getAbsolutePath (tmpfile %))))
                      "$data"       {:what_the "nuts"}}
            ;; evaluates resources/render_haml.rb, that does the actual work
            :eval-file [(-> "render_haml.rb" io/resource io/file .getAbsolutePath)]))))


Some nifty penguin operators

Some nifty penguin operators

--- src/polismath/utils.clj
+++ src/polismath/utils.clj
@@ -27,6 +27,23 @@
          ret# ~@expr]
      (println (str (System/currentTimeMillis) " " ~tag " " (/ (double (- (. System (nanoTime)) start#)) 1000000.0) " msecs"))
      ret#))
+
+(defmacro f?>>
+  "Modified 'penguin' operator from plumbing.core, where do-it? is a function of the threaded value
+  instead of a static value. E.g.: (->> nums (?>> #(even? (count %)) (map inc)))"
+  [do-it? & args]
+  `(if (~do-it? ~(last args))
+     (->> ~(last args) ~@(butlast args))
+     ~(last args)))
+
+
+(defmacro f?>
+  "Modified 'penguin' operator from plumbing.core, where do-it? is a function of the threaded value
+  instead of a static value. E.g.: (-> n inc (?> even? (* 2)))"
+  [arg do-it? & rest]
+  `(if (~do-it? ~arg)
+     (-> ~arg ~@rest)
+     ~arg))

 (defn zip [& xss]


Remove subsume tests (not going to do that).

--- test/fcms/unit/resources/item_categorization.clj
+++ test/fcms/unit/resources/item_categorization.clj
@@ -128,12 +128,7 @@
       (categorize-foo ["t/bar" "t/fubar/b"] ["t/bar" "t/fubar/b"])
       (categorize-foo ["t/bar/" "t/fubar/b/"] ["t/bar" "t/fubar/b"])
       (categorize-foo ["/t/bar" "/t/fubar/b"] ["t/bar" "t/fubar/b"])
-      (categorize-foo ["/t/bar/" "/t/fubar/b/"] ["t/bar" "t/fubar/b"])))
-
-  (testing "item categorization that subsumes a parent"
-    (testing "item categorization that subsumes a root parent")
-    (testing "item categorization that subsumes a non-root parent")))
-
+      (categorize-foo ["/t/bar/" "/t/fubar/b/"] ["t/bar" "t/fubar/b"]))))

 (deftest item-uncategorization
   (testing "item uncategorization failures")


Fixed Namespaces.

Fixed Namespaces.

--- src/leiningen/ancient.clj
+++ src/leiningen/ancient.clj
@@ -1,10 +1,10 @@
 (ns ^{:doc "Check your Project for outdated Dependencies."
       :author "Yannick Scherer"}
   leiningen.ancient
-  (:require [leiningen.ancient.tasks.check :refer [run-check-task!]]
-            [leiningen.ancient.tasks.get :refer [run-get-task!]]
-            [leiningen.ancient.tasks.upgrade :refer [run-upgrade-task! run-upgrade-global-task!]]
-            [leiningen.ancient.tasks.test :refer [run-test-task!]]
+  (:require [leiningen.ancient.check :refer [run-check-task!]]
+            [leiningen.ancient.get :refer [run-get-task!]]
+            [leiningen.ancient.upgrade :refer [run-upgrade-task! run-upgrade-global-task!]]
+            [leiningen.ancient.test :refer [run-test-task!]]
             [ancient-clj.verbose :refer :all]))

 (def ^:private dispatch-table


[github-17] exclude Xbootclasspath from eval-in-project forking of JVM

--- src/leiningen/compile.clj
+++ src/leiningen/compile.clj
@@ -129,7 +129,8 @@
     (when (or (= :macosx (get-os)) native-path)
       (.setFork java true)
       (doseq [arg (get-jvm-args)]
-        (.setValue (.createJvmarg java) arg)))
+        (when-not (re-matches #"^-Xbootclasspath.+" arg)
+          (.setValue (.createJvmarg java) arg))))
     (.setClassname java "clojure.main")
     (.setValue (.createArg java) "-e")
     (let [cp (str (.getClasspath (.getCommandLine java)))


Update test app to latest clojure release.

--- modules/clojure/src/test/resources/apps/basic/project.clj
+++ modules/clojure/src/test/resources/apps/basic/project.clj
@@ -17,7 +17,7 @@
   :url "http://example.com/FIXME"
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
-  :dependencies [[org.clojure/clojure "1.6.0-beta2"]
+  :dependencies [[org.clojure/clojure "1.6.0"]
                  ;; we can't depend on this, or we'll get the version
                  ;; from .m2, not the version we're building
                  ;;[org.projectodd.wunderboss/wunderboss-clojure "0.1.0-SNAPSHOT"]


* Toggle checked

* Toggle checked

* Hide footer when no items

--- src/todomvc_reagent/core.cljs
+++ src/todomvc_reagent/core.cljs
@@ -1,8 +1,31 @@
 (ns todomvc-reagent.core
     (:require [reagent.core :as r]))

+;; -------------------------
+;; Db
+
 (def todos
-  (r/atom [{:value "Taste JavaScript"} {:value "Buy a unicorn"}]))
+  (r/atom (sorted-map)))
+
+(def counter
+  (r/atom 0))
+
+(defn add-todo
+  ([title]
+   (add-todo title false))
+  ([title done]
+   (let [id (swap! counter inc)]
+     (swap! todos assoc id {:id id :title title :done done}))))
+
+(add-todo "Taste JavaScript" true)
+(add-todo "Buy a unicorn")
+
+;; -------------------------
+;; Helper
+(defn toggle [id]
+  (swap! todos update-in [id :done] not))
+(defn delete [id]
+  (swap! todos dissoc id))

 ;; -------------------------
 ;; Views
@@ -13,14 +36,29 @@
    [:input.new-todo
     {:autofocus true, :placeholder placeholder}]])

+(defn todo-item [todo]
+    (fn [{:keys [id title done]}]
+      [:li {:class (if done "completed" "")}
+       [:div.view
+        [:input.toggle {:type "checkbox" :checked done :on-change #(toggle id)}]
+        [:label title]
+        [:button.destroy {:on-click #(delete id)}]
+        [:input.edit {:value ""}]]]))
+
 (defn todo-list [todos]
-  (for [todo todos]
-    [:li
-     [:div.view
-      [:input.toggle {:type "checkbox"}]
-      [:label (:value todo)]
-      [:button.destroy]
-      [:input.edit {:value ""}]]]))
+  [:ul.todo-list
+   (for [todo todos]
+     ^{:key (:id todo)} [todo-item todo])])
+
+(defn todo-footer [count]
+  (when (> count 0)
+    [:footer.footer
+     [:span.todo-count [:strong (str count)] " item left"]
+     [:ul.filters
+      [:li [:a.selected {:href "#/"} "All"]]
+      [:li [:a {:href "#/active"} "Active"]]
+      [:li [:a {:href "#/completed"} "Completed"]]]
+     [:button.clear-completed "Clear completed"]]))

 (defn home-page []
   (fn []
@@ -31,18 +69,11 @@
       [:section.main
        [:input.toggle-all {:type "checkbox"}]
        [:label {:for "toggle-all"} "Mark all as complte"]
-
-       [:ul.todo-list
-        (todo-list @todos)
-        ]]
+
+       [todo-list (vals @todos)]]

-      [:footer.footer
-       [:span.todo-count [:strong "0"] " item left"]
-       [:ul.filters
-        [:li [:a.selected {:href "#/"} "All"]]
-        [:li [:a {:href "#/active"} "Active"]]
-        [:li [:a {:href "#/completed"} "Completed"]]]
-       [:button.clear-completed "Clear completed"]]]
+      [todo-footer (count @todos)]
+      ]

      [:footer.info
       [:p "Double-click to edit a todo"]


Properly handle relative paths returned by java watch service.

--- src/main/hawk/watcher.clj
+++ src/main/hawk/watcher.clj
@@ -19,13 +19,14 @@
   (take! [this])
   (stop! [this]))

-(defn- take-events [watcher event-kinds]
+(defn- take-events [watcher normalize]
   (when-let [watch-key (try
                          (.take watcher)
                          (catch InterruptedException _ _ nil))]
-    (let [events (for [event (.pollEvents watch-key)]
-                   {:file (-> event .context str io/file .getCanonicalFile)
-                    :kind (->> event .kind (get (map-invert event-kinds)))})]
+    (let [events (for [event (.pollEvents watch-key)
+                       :let [kind (.kind event)
+                             context (.context event)]]
+                   (normalize watch-key kind context))]
       (.reset watch-key)
       events)))

@@ -33,12 +34,17 @@
   java.nio.file.WatchService
   (register! [this path events]
     (let [events (into-array (map standard-watch-event-kinds events))]
-      (.register path this events))
+      (.reset (.register path this events)))
     (doseq [dir (-> path .toFile .listFiles)]
       (when (.isDirectory dir)
         (register! this (.toPath dir) events))))
   (take! [this]
-    (try (take-events this standard-watch-event-kinds)
+    (try (take-events
+           this
+           (fn [watch-key kind context]
+             {:file (-> (.watchable watch-key)
+                        (.resolve context) .toFile .getCanonicalFile)
+              :kind ((map-invert standard-watch-event-kinds) kind)}))
          (catch java.nio.file.ClosedWatchServiceException _ _ nil)))
   (stop! [this]
     (doto this .close))
@@ -49,7 +55,11 @@
           events (into-array (map barbary-watch-event-kinds events))]
       (.register file this events)))
   (take! [this]
-    (try (take-events this barbary-watch-event-kinds)
+    (try (take-events
+           this
+           (fn [_ kind context]
+             {:file (-> context str io/file .getCanonicalFile)
+              :kind ((map-invert barbary-watch-event-kinds) kind)}))
          (catch com.barbarysoftware.watchservice.ClosedWatchServiceException _ _ nil)))
   (stop! [this]
     (doto this .close)))


Add support json-event-v0/json-event-v1 for backward compatibility

--- src/riemann/logging.clj
+++ src/riemann/logging.clj
@@ -35,6 +35,43 @@
   [type]
   (LogstashEncoder.))

+(defmethod encoder :json-event
+  [type]
+  (encoder :json-event-v0))
+
+(defmethod encoder :json-event-v0
+  [type]
+  (let [hostname (.. java.net.InetAddress getLocalHost getHostName)]
+    (doto (PatternLayoutEncoder.)
+      (.setPattern (str "{\"@fields\":{\"level\":\"%level\","
+                                      "\"threadName\":\"%thread\","
+                                      "\"mdc\":{%mdc},"
+                                      "\"file\":\"%file\","
+                                      "\"class\":\"%class\","
+                                      "\"line_number\":\"%line\","
+                                      "\"method\":\"%method\","
+                                      "\"loggerName\":\"%logger\"},"
+                         "\"@timestamp\":\"%date{yyyy-MM-dd'T'HH:mm:ss.SSS'Z', UTC}\","
+                         "\"@message\":\"%message\","
+                         "\"@source_host\":\"" hostname "\"}\n")))))
+
+(defmethod encoder :json-event-v1
+  [type]
+ (let [hostname (.. java.net.InetAddress getLocalHost getHostName)]
+   (doto (PatternLayoutEncoder.)
+     (.setPattern (str "{\"level\":\"%level\","
+                        "\"thread_name\":\"%thread\","
+                        "\"mdc\":{%mdc},"
+                        "\"file\":\"%file\","
+                        "\"class\":\"%class\","
+                        "\"line_number\":\"%line\","
+                        "\"method\":\"%method\","
+                        "\"logger_name\":\"%logger\"},"
+                        "\"@timestamp\":\"%date{yyyy-MM-dd'T'HH:mm:ss.SSS'Z', UTC}\","
+                        "\"@version\":1,"
+                        "\"message\":\"%message\","
+                        "\"source_host\":\"" hostname "\"}\n")))))
+
 (defmethod encoder :riemann
   [type]
   (doto (PatternLayoutEncoder.)


api/card/:id/favorite endpoint

api/card/:id/favorite endpoint

--- src/metabase/api/card.clj
+++ src/metabase/api/card.clj
@@ -2,8 +2,9 @@
   (:require [compojure.core :refer [GET]]
             [metabase.api.common :refer :all]
             [metabase.db :refer :all]
-            [metabase.models.card :refer :all]
-            [metabase.models.hydrate :refer [hydrate]]))
+            (metabase.models [hydrate :refer [hydrate]]
+                             [card :refer :all]
+                             [card-favorite :refer :all])))

 (defendpoint GET "/:id" [id]
   (or-404-> (sel :one Card :id id)))
@@ -12,4 +13,8 @@
   (-> (sel :many Card :organization_id org)
       (hydrate :creator)))

+(defendpoint GET "/:id/favorite" [id]
+  {:favorite (boolean (some->> *current-user-id*
+                               (sel :one CardFavorite :card_id id :owner_id)))})
+
 (define-routes)


grammarity

grammarity

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9944 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/paint.clj
+++ plugins/SlideExplorer2/src/slide_explorer/paint.clj
@@ -46,8 +46,8 @@
   (.post display-updater #(.repaint panel)))

 (defn repaint-on-change
-  "Adds a watch such that panel is repainted
-   the values in reference has changed."
+  "Adds a watch such that panel is repainted whenever
+   the values in reference have changed."
   [panel references]
   (doseq [reference references]
     (add-watch-simple reference


Refactor code: remove unnecessary arg name

--- src/spectrace/core.cljc
+++ src/spectrace/core.cljc
@@ -259,7 +259,7 @@
       (assoc state :spec-name spec)
       (dissoc state :spec-name))))

-(defn- trace [{:keys [path in val pred reason] :as problem} spec value]
+(defn- trace [{:keys [path in val pred reason]} spec value]
   (let [state (normalize {:spec spec :path path :val value :in in} pred)
         add-reason (fn [states]
                      (cond-> states


update demo docstring

update demo docstring

--- src/overtone/sc/synth.clj
+++ src/overtone/sc/synth.clj
@@ -403,7 +403,12 @@

 (defmacro demo
   "Try out an anonymous synth definition.  Useful for experimentation.  If the
-  root node is not an out ugen, then it will add one automatically."
+  root node is not an out ugen, then it will add one automatically.
+  You can specify a timeout in seconds as the first argument otherwise it
+  defaults to *demo-time* ms.
+
+  (demo (sin-osc 440))      ;=> plays a sine wave for *demo-time* ms
+  (demo 0.5 (sin-osc 440))  ;=> plays a sine wave for half a second"
   [& body]
   (let [[demo-time body] (if (number? (first body))
                            [(* 1000 (first body)) (second body)]
@@ -426,5 +431,3 @@
      (into [] (if (empty? children)
        synths
        (set (concat synths children)))))))
-
-


hack for making centering work.

hack for making centering work.

--- src/play_clj/entities.clj
+++ src/play_clj/entities.clj
@@ -24,7 +24,7 @@
                          scale-x scale-y angle origin-x origin-y]}
                  _
                  batch]
-    (let [x (float (or x 0))
+    (let [x (- (float (or x 0)) (* (float (or origin-x 0.0)) (float (or scale-x 1.0))))
           y (float (or y 0))
           width (float (or width (.getRegionWidth object)))
           height (float (or height (.getRegionHeight object)))]


Add `make-app` and `stop-app` for use with existing http-kit server.

--- src/pubsure_ws/reader.clj
+++ src/pubsure_ws/reader.clj
@@ -71,7 +71,7 @@
              :kill false}}))

-(defn- make-app
+(defn- make-app*
   "Creates a ring app, using the State record to keep track of
   channels and subscriptions. The app accepts Websocket connections
   and HTTP requests."
@@ -99,6 +99,23 @@
       {:status 503 :body "Server is closing"})))

+(defn make-app
+  "Creates a http-kit ring app, for use in an existing http-kit
+  server. The following options are supported:
+
+  :subscribe-buffer - The size of of the sliding buffer size used for
+  buffering incoming source updates from the DirectoryReader. Default
+  is 100.
+
+  The returned value is a vector of two items. The first can be used
+  for the `stop-app` function, and the second is the ring app
+  function."
+  [directory-reader & {:keys [subscribe-buffer] :as config}]
+  (let [state (State. directory-reader config (atom {}) (atom nil) (atom true))
+        app (make-app* state)]
+    [state app]))
+
+
 (defn start-server
   "Starts a Websocket-supporting server, handling subscriptions using
   the supplied DirectoryReader implementation. The following options
@@ -112,18 +129,25 @@

   The returned value can be used for the `stop-server` function."
   [directory-reader & {:keys [port subscribe-buffer] :or {port 8091} :as config}]
-  (let [stop-fn (atom nil)
-        state (State. directory-reader config (atom {}) stop-fn (atom true))]
-    (reset! stop-fn (http/run-server (make-app state) {:port port}))
+  (let [[state app] (apply make-app directory-reader (flatten config))]
+    (reset! (:stop-fn state) (http/run-server app {:port port}))
     state))
+
+
+(defn stop-app
+  "Given the first item in the return value of `make-app` function,
+  this function will unwatch the current open watches to the
+  DirectoryReader. The app should not and cannot be used afterwards."
+  [{:keys [open channels] :as state}]
+  (reset! open false)
+  (doseq [[sess-id topic-chans] @channels
+          [topic _] topic-chans]
+    (unsubscribe state sess-id topic)))

 (defn stop-server
   "Given the return value of `start-server`, this function will stop
-  the server and unsubscribe every connection in the DirectoryReader."
-  [{:keys [stop-fn open channels] :as state}]
-  (reset! open false)
-  (doseq [[sess-id topic-chans] @channels
-          [topic _] topic-chans]
-    (unsubscribe state sess-id topic))
+  the server and unsubscribe every watch in the DirectoryReader."
+  [{:keys [stop-fn] :as state}]
+  (stop-app state)
   (@stop-fn :timeout 100))


Fixed namespace imports

Fixed namespace imports

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -30,7 +30,8 @@
 (ns semantic-csv.core
   "# Core API namespace"
   (:require [clojure.java.io :as io]
-            [clojure-csv :as csv]
+            [clojure-csv.core :as csv]
+            [semantic-csv.impl.core :as impl]
             [plumbing.core :as pc :refer [?>>]]))

@@ -39,7 +40,7 @@
 ;; [clojure/data.csv](https://github.com/clojure/data.csv); we'll be using the former).
 ;;
 ;;     (require '[semantic-csv.core :refer :all]
-;;              '[clojure-csv :as csv]
+;;              '[clojure-csv.core :as csv]
 ;;              '[clojure.java.io :as io])
 ;;
 ;; Now let's take a tour through some of the processing functions we have available, starting with the reader


Small doc tweak

Small doc tweak

--- src/semantic_csv/core.clj
+++ src/semantic_csv/core.clj
@@ -385,7 +385,8 @@
 ;;         ;; Do some of your own processing...
 ;;         (map
 ;;           (fn [row]
-;;             (assoc row :jazz (* (:this row) (:that row)))))
+;;             (assoc row :jazz (* (:this row)
+;;                                 (:that row)))))
 ;;         vectorify
 ;;         ; clojure-csv doesn't like non string values
 ;;         (format-all-with str)


Added alternative faster ways to retrieve data from api

--- src/seminarski/parser.clj
+++ src/seminarski/parser.clj
@@ -79,9 +79,72 @@
           (do
             (println "EMPTY")
             movies)
+          (recur (inc page) (into movies (get-processed-movies moviesfrompage))))
+        (recur (inc page) movies))))
+)
+
+(defn get-processed-movies-parallel [movies]
+  (loop [mv movies mvfrompage []]
+    (if (empty? mv)
+      mvfrompage
+        (recur (rest mv) (conj mvfrompage
+                               (do
+                                 (Thread/sleep 200)
+                                 (future
+                                   (get-parsed-movie
+                                     (json-parse
+                                       (get-movie-details (first mv)) (get-movie-details-json-tag)))))))))
+)
+
+(defn get-movies-parallel []
+  (loop [page 1 movies [] first-time true]
+    (let [moviesfrompage (do (if (not first-time) (Thread/sleep 300)) (json-parse (get-movies-from-page page) (get-movies-json-tag)))]
+      (if (empty? moviesfrompage)
+        (do
+          (println "EMPTY")
+          movies)
+        (do
+
+          (recur (inc page) (into movies (get-processed-movies-parallel moviesfrompage)) false)))))
+)
+
+(defn deref-movies [movies]
+  (vec (doall (map deref movies)))
+)
+
+(defn get-processed-movies-map [movies]
+  (doall (map #(get-parsed-movie (json-parse (get-movie-details %) (get-movie-details-json-tag))) movies))
+)
+
+(defn get-processed-movies-pmap [movies]
+  (doall (pmap #(get-parsed-movie (json-parse (get-movie-details %) (get-movie-details-json-tag))) movies))
+)
+
+(defn get-movies-map []
+  (loop [page 1 movies []]
+    (let [moviesfrompage (json-parse (get-movies-from-page page) (get-movies-json-tag))]
+      (if-not (nil? moviesfrompage)
+        (if (empty? moviesfrompage)
+          (do
+            (println "EMPTY")
+            movies)
           (do

-          (recur (inc page) (into movies (get-processed-movies moviesfrompage)))))
+          (recur (inc page) (into movies (get-processed-movies-map moviesfrompage)))))
+        (recur (inc page) movies))))
+)
+
+(defn get-movies-pmap []
+  (loop [page 1 movies []]
+    (let [moviesfrompage (json-parse (get-movies-from-page page) (get-movies-json-tag))]
+      (if-not (nil? moviesfrompage)
+        (if (empty? moviesfrompage)
+          (do
+            (println "EMPTY")
+            movies)
+          (do
+
+          (recur (inc page) (into movies (get-processed-movies-pmap moviesfrompage)))))
         (recur (inc page) movies))))
 )

@@ -92,4 +155,3 @@

-


[HE] commented out failing tests (bug #242) (#243)

--- resources/languages/he/corpus/time.clj
+++ resources/languages/he/corpus/time.clj
@@ -28,12 +28,12 @@
   "שני הזה"
   (datetime 2013 2 18 :day-of-week 1)

+  ; "שני השמונה עשרה לפברואר"
   "שני 18 לפברואר"
-  "שני השמונה עשרה לפברואר"
   (datetime 2013 2 18 :day-of-week 1 :day 18 :month 2)

   "שלישי"
-  "שלישי ה19"
+  ; "שלישי ה19"
   "יום שלישי התשעה עשר"
   (datetime 2013 2 19)

@@ -49,9 +49,9 @@
   "ראשון"
   (datetime 2013 2 17)

-  "הראשון למרץ"
+  ;"הראשון למרץ"
   "1 למרץ"
-  "ה1 למרץ"
+  ; "ה1 למרץ"
   (datetime 2013 3 1 :day 1 :month 3)

   "במרץ 3"
@@ -61,7 +61,7 @@
   (datetime 2013 3 15 :month 3)

   "3 למרץ 2015"
-  "השלישי למרץ 2015"
+  ; "השלישי למרץ 2015"
   "שלושה במרץ 2015"
   "3/3/2015"
   "3/3/15"
@@ -69,10 +69,9 @@
   "2015-03-03"
   (datetime 2015 3 3 :day 3 :month 3 :year 2015)

-  "ב15 לחודש"
-  "ב15 החודש"
-  "חמש עשרה לחודש"
-  (datetime 2013 2 15 :dבay 15)
+  ; "ב15 לחודש"
+  ; "חמש עשרה לחודש"
+  ; (datetime 2013 2 15 :dבay 15)

   "ה15 בפברואר"
   "15 לפברואר"
@@ -110,9 +109,9 @@
   "ראשון, 10 לפברואר"
   (datetime 2013 2 10 :day-of-week 7 :day 10 :month 2)

-  "יום שני, ה18 לפברואר"
-  "שני, השמונה עשרה לפברואר"
-  (datetime 2013 2 18 :day-of-week 1 :day 18 :month 2)
+  ; "יום שני, ה18 לפברואר"
+  ; "שני, השמונה עשרה לפברואר"
+  ; (datetime 2013 2 18 :day-of-week 1 :day 18 :month 2)

   ;; Cycles

@@ -144,9 +143,6 @@
   ;; "רבעון הבא"
   ;; (datetime 2013 4 1 :grain :quarter)

-  "שנה שעברה"
-  (datetime 2012)
-
   ;; "שנה נוכחית"
   ;; "בשנה הנוכחית"
   ;; "השנה"
@@ -222,8 +218,8 @@
   ;; (datetime 2014 9 22 :grain :week)

   ;; nth of
-  "יום שלישי הראשון של אוקטובר"
-  (datetime 2013 10 1)
+  ; "יום שלישי הראשון של אוקטובר"
+  ; (datetime 2013 10 1)

   ;; Hours

@@ -239,17 +235,16 @@
   (datetime 2013 2 12 3 18)

   "ב 3pm"
-  "@ 3pm"
   "3PM"
   "3pm"
   (datetime 2013 2 12 15 :hour 3 :meridiem :pm)

   ;; "באיזור 15:00"
-  "באיזור שלוש בצהריים"
-  (datetime 2013 2 12 15 :hour 3 :meridiem :pm) ;; :precision "approximate"
-
-  "בשלוש ורבע בצהריים"
-  "3:15 בצהריים"
+  ; "באיזור שלוש בצהריים"
+  ; (datetime 2013 2 12 15 :hour 3 :meridiem :pm) ;; :precision "approximate"
+
+  ; "בשלוש ורבע בצהריים"
+  ; "3:15 בצהריים"
   "15:15"
   "3:15pm"
   "3:15PM"
@@ -257,14 +252,14 @@
   (datetime 2013 2 12 15 15 :hour 3 :minute 15 :meridiem :pm)

   ;; "עשרים דקות אחרי 3 בצהריים"
-  "3:20 בצהריים"
-  "3:20 צהריים"
-  "עשרים אחרי שלוש בצהריים"
+  ; "3:20 בצהריים"
+  ; "3:20 צהריים"
+  ; "עשרים אחרי שלוש בצהריים"
   "3:20p"
   (datetime 2013 2 12 15 20 :hour 3 :minute 20 :meridiem :pm)

-  "בשלוש וחצי בערב"
-  "שלוש וחצי בצהריים"
+  ; "בשלוש וחצי בערב"
+  ; "שלוש וחצי בצהריים"
   "15:30"
   "3:30pm"
   "3:30PM"
@@ -286,8 +281,8 @@

   ;; Mixing date and time

-  "בשבע וחצי בערב ביום שישי העשרים לספטמבר"
-  (datetime 2013 9 20 19 30 :hour 7 :minute 30 :meridiem :pm)
+  ; "בשבע וחצי בערב ביום שישי העשרים לספטמבר"
+  ; (datetime 2013 9 20 19 30 :hour 7 :minute 30 :meridiem :pm)

   "בתשע בבוקר בשבת"
   (datetime 2013 2 16 9 :day-of-week 6 :hour 9 :meridiem :am)
@@ -362,8 +357,8 @@
   ;; "בשבוע שעבר"
   ;; (datetime 2013 2 5)

-  "לפני שלושה חודשים"
-  (datetime 2012 11 12)
+  ; "לפני שלושה חודשים"
+  ; (datetime 2012 11 12)

   ;; "לפני שנתיים"
   ;; (datetime 2011 2)


Exercise 3.53, 3.54

Exercise 3.53, 3.54

--- src/sicp/chapter3/5_2.clj
+++ src/sicp/chapter3/5_2.clj
@@ -3,3 +3,15 @@
 ;;;; 3.5  Streams

 ;;; 3.5.2  Infinite Streams
+
+;; Exercise 3.53
+(def s (lazy-seq (cons 1 (map + s s))))
+
+;; Exercise 3.54
+(defn mul-streams [s1 s2]
+  (map * s1 s2))
+
+(def integers (rest (range)))
+
+(def factorials
+  (lazy-seq (cons 1 (mul-streams (rest integers) factorials))))


adding valid email test

adding valid email test

--- resources/leiningen/new/closp/integtest/clj/web/setup.clj
+++ resources/leiningen/new/closp/integtest/clj/web/setup.clj
@@ -69,6 +69,6 @@
   (stop-server))

 (defn browser-setup [f]
-  (start-browser :firefox)
+  (start-browser :htmlunit)
   (f)
   (stop-browser))


changeing a TODO

changeing a TODO

--- src/thehex/notube/cli.clj
+++ src/thehex/notube/cli.clj
@@ -25,7 +25,7 @@
    ;; A boolean option defaulting to nil
    ["-h" "--help"]])

-;; TODO: later... possibly doesnt need to be the main app, specially since core.clj could call parse-opts args...
+;; TODO: doesnt need to be the main app, could be a fn that core.clj calls
 (defn -main [& args]
   (let [clargs (parse-opts args cli-options)
         opts (:options clargs)]


better server control

better server control

--- src/clj/sparky_elephants/server.clj
+++ src/clj/sparky_elephants/server.clj
@@ -1,19 +1,25 @@
 (ns sparky-elephants.server
-  (:require [sparky-elephants.handler :refer [app]]
+  (:require sparky-elephants.handler
             [aleph.http :as http])
   (:gen-class))

 (defn create-server
-  [port]
-  (http/start-server app {:port port}))
+  [port & [{:keys [handler] :or {handler sparky-elephants.handler/app}}]]
+  (http/start-server handler {:port port}))

 (defonce server-atom (atom nil))

 (defn start-or-restart-server
-  [port]
+  [port & [opts]]
   (swap! server-atom (fn [old-server]
                        (when old-server (.close old-server))
-                       (create-server port))))
+                       (create-server port opts))))
+
+(defn stop-server
+  []
+  (swap! server-atom (fn [old-server]
+                       (when old-server (.close old-server))
+                       nil)))

  (defn -main [& args]
    (let [port (Integer/parseInt (or (System/getenv "PORT") "3000"))]


Check if is identified before send

Check if is identified before send

--- src/cljs/catsocket_client/core.cljs
+++ src/cljs/catsocket_client/core.cljs
@@ -67,7 +67,7 @@
                 :data data
                 :id (guid)
                 :timestamp (.getTime (js/Date.))}]
-    (if (:connected? @cat)
+    (if (and (:connected? @cat) (or (:identified? @cat) (= action "identify")))
       (do
         (log "sending" (clj->js params))
         (swap! cat update-in [:sent-messages] assoc (:id params) params)


Got basic login working from splash page

--- src/cljs/haunting_refrain/core.cljs
+++ src/cljs/haunting_refrain/core.cljs
@@ -29,11 +29,12 @@
 (defn foursquare-login! [token]
   (console/debug "Logged in, token:" token)
   (put! :foursquare-access-token token)
-  (.replace js/window.location "#/"))
+  (.replace js/window.location "#/splash"))

 (defn foursquare-logout! [token]
   (console/debug "Logged out")
-  (put! :foursquare-access-token nil))
+  (put! :foursquare-access-token nil)
+  (.replace js/window.location "#/"))

 ;; -------------------------
 ;; Routes
@@ -55,8 +56,13 @@
 ;; -------------------------
 ;; kioo templates

+(defn onclick [& args]
+  (console/log "click!")
+  (console/log args))
+
 (defsnippet login-button "templates/splash.html" [:.login] []
-  {[:button] (listen :onclick #(console/log "click" %))})
+  {[:button] (do-> (content "This is the button")
+                   (listen :on-click foursquare/redirect-to-foursquare!))})

 (deftemplate splash "templates/splash.html" []
   {[:.login] (substitute [login-button])})


Hotfix for #68

Hotfix for #68

I’m now returning the token as a raw string instead of inside a map. The
latter was just something I did to pass information around easily inside
liberator, there’s no need for it with the cleaner compojure-api
approach.

--- src/cljs/memento/handlers/auth.cljs
+++ src/cljs/memento/handlers/auth.cljs
@@ -82,6 +82,6 @@
   (fn [app-state _]
     (when-let [token (get-in app-state [:credentials :token])]
       (GET "/api/auth/validate" {:headers       {:authorization (str "Token " token)}
-                                 :handler       #(dispatch [:auth-set-token (:token %)])
+                                 :handler       #(dispatch [:auth-set-token %])
                                  :error-handler #(dispatch [:auth-request-error %])}))
     app-state))


Switch to fluid container and fix styling a bit.

--- src/cljs/munchkin_toolbox/core.cljs
+++ src/cljs/munchkin_toolbox/core.cljs
@@ -27,7 +27,7 @@
          [:div {:class "row"}
           [:div {:class "col-sm-2"}
            [:button
-            {:class "btn btn-success btn-lg btn-block"
+            {:class "btn btn-danger btn-lg btn-block"
              :on-click #(put! level-changed-c ::dec)}
             "-"]]
           [:div {:class "col-sm-8"}
@@ -41,7 +41,7 @@
              level]]]
           [:div {:class "col-sm-2"}
            [:button
-            {:class "btn btn-danger btn-lg btn-block"
+            {:class "btn btn-success btn-lg btn-block"
              :on-click #(put! level-changed-c ::inc)}
             "+"]]])))))

@@ -66,7 +66,9 @@
     (render-state [_ state]
       (html
        [:div {:class "row"}
-        [:div {:class "row"} name]
+        [:div {:class "row"}
+         [:div {:class "col-sm-12"}
+          name]]
         (om/build level-counter
                   level
                   {:init-state (select-keys state [:level-changed])})
@@ -80,7 +82,8 @@
     (render [_]
       (html
        [:div {:class "row"}
-        (om/build-all player-info (get data :players []))]))))
+        [:div {:class "col-sm-12"}
+         (om/build-all player-info (get data :players []))]]))))

 (defn control-panel
@@ -104,10 +107,11 @@
       (let [player-added-c (:player-added state)]
         (html
          [:div {:class "row"}
-          [:button
-           {:class "btn btn-default"
-            :on-click #(put! player-added-c true)}
-           "Add a new player"]])))))
+          [:div {:class "col-sm-12"}
+           [:button
+            {:class "btn btn-default"
+             :on-click #(put! player-added-c true)}
+            "Add a new player"]]])))))

 (defn app
@@ -116,7 +120,7 @@
     om/IRender
     (render [_]
       (html
-       [:div {:class "container"}
+       [:div {:class "container-fluid"}
         (om/build control-panel data)
         (om/build players-list data)]))))


Fix rounding issue with aganda point requirement

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -36,7 +36,7 @@

 (defn min-agenda-points [deck]
   (let [size (max (deck-size (:cards deck)) (get-in deck [:identity :minimumdecksize]))]
-    (+ 2 (* 2 (/ size 5)))))
+    (+ 2 (* 2 (quot size 5)))))

 (defn agenda-points [cards]
   (reduce #(if-let [point (get-in %2 [:card :agendapoints])]


add empty dots next to MWL cards

add empty dots next to MWL cards

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -398,18 +398,21 @@
                                             :type "button"} "-"]]))
                        (:qty line) " "
                        (if-let [name (get-in line [:card :title])]
-                         (let [card (:card line)]
+                         (let [card (:card line)
+                               infaction (or (= (:faction card) (:faction identity))
+                                            (zero? (:factioncost card)) (= INFINITY (influencelimit identity)))
+                               wanted (mostwanted? card)]
                            [:span
                             [:span {:class (if (allowed? card identity) "fake-link" "invalid")
                                     :on-mouse-enter #(put! zoom-channel card)
                                     :on-mouse-leave #(put! zoom-channel false)} name]
-                            (when-not (or (= (:faction card) (:faction identity))
-                                          (zero? (:factioncost card)))
+                            (when (or wanted (not infaction))
                               (let [influence (* (:factioncost card) (:qty line))]
                                 [:span.influence
                                  {:class (-> card :faction .toLowerCase (.replace " " "-"))
                                   :dangerouslySetInnerHTML
-                                  #js {:__html (apply str (for [i (range influence)] "•"))}}]))])
+                                  #js {:__html (str (if-not infaction (apply str (for [_ (range influence)] "•")))
+                                                    (if wanted (apply str (for [_ (range (:qty line))] "◦"))))}}]))])
                          (:card line))])])]]))]

           [:div.deckedit


apply fix to madla routes

apply fix to madla routes

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -106,7 +106,7 @@
    [:div {:class "issuer-links pull-label-left inline"}
     [:a {:href "#"
          :on-click #(do (.preventDefault %)
-                      (mo/open-modal [:badge :issuer] issuer-id))} name]]])
+                      (mo/open-modal [:badge :issuer] issuer-id {}))} name]]])

 ;;;TODO creator endorsements
 (defn creator-modal-link [creator-id name]
@@ -352,7 +352,8 @@

 (def ^:export modalroutes
   {:badge (merge {:info handler}
-                 (collect-plugin-modal-routes [:badge :core] ["my" "endorsement" "issuer" "share"]))})
+                 (collect-plugin-modal-routes [:badge] ["my" "endorsement" "issuer"])
+                 (collect-plugin-modal-routes [:core] ["share"]))})

 ;:metadata a/assertion-content


Use new abstraction on hmac implementation instead of raw access to bouncycastle hmac impl.

--- src/clojure/buddy/core/mac/hmac.clj
+++ src/clojure/buddy/core/mac/hmac.clj
@@ -15,6 +15,7 @@
 (ns buddy.core.mac.hmac
   "Hash-based Message Authentication Codes (HMACs)"
   (:require [buddy.core.codecs :refer :all]
+            [buddy.core.mac.proto :as proto]
             [buddy.core.hash :as hash]
             [clojure.java.io :as io])
   (:import org.bouncycastle.crypto.macs.HMac
@@ -24,21 +25,34 @@
            buddy.Arrays))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Low level hmac engine.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn hmac-engine
+  "Create a hmac engine."
+  [key alg]
+  (let [digest (hash/resolve-digest alg)
+        kp     (KeyParameter. (->byte-array key))
+        mac    (HMac. digest)]
+    (reify
+      proto/IMac
+      (update [_ input offset length]
+        (.update mac input offset length))
+      (end [_]
+        (let [buffer (byte-array (.getMacSize mac))]
+          (.doFinal mac buffer 0)
+          buffer)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Low level private function with all logic for make
 ;; hmac for distinct types.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (defn- make-hmac-for-plain-data
-  [^bytes input, pkey, ^Keyword alg]
-  (let [digest (hash/resolve-digest alg)
-        kp     (KeyParameter. (->byte-array pkey))
-        mac    (HMac. digest)
-        buffer (byte-array (.getMacSize mac))]
-    (doto mac
-      (.init kp)
-      (.update input 0 (count input))
-      (.doFinal buffer 0))
-    buffer))
+  [^bytes input key ^Keyword alg]
+  (let [engine (hmac-engine key alg)]
+    (proto/update! engine input)
+    (proto/end! engine)))

 (defn- verify-hmac-for-plain-data
   [^bytes input, ^bytes signature, pkey, ^Keyword alg]
@@ -46,20 +60,15 @@
     (Arrays/equals sig signature)))

 (defn- make-hmac-for-stream
-  [^java.io.InputStream input, pkey, ^Keyword alg]
-  (let [digest  (hash/resolve-digest alg)
-        kp      (KeyParameter. (->byte-array pkey))
-        mac     (HMac. digest)
-        buffer1 (byte-array 5120)
-        buffer2 (byte-array (.getMacSize mac))]
-    (.init mac kp)
+  [^java.io.InputStream input key ^Keyword alg]
+  (let [engine (hmac-engine key alg)
+        buffer (byte-array 5120)]
     (loop []
-      (let [readed (.read input buffer1 0 5120)]
+      (let [readed (.read input buffer 0 5120)]
         (when-not (= readed -1)
-          (.update mac buffer1 0 readed)
+          (proto/update! engine buffer 0 readed)
           (recur))))
-    (.doFinal mac buffer2 0)
-    buffer2))
+    (proto/end! engine)))

 (defn- verify-hmac-for-stream
   [^java.io.InputStream input, ^bytes signature, pkey, ^Keyword alg]


Change to make easy to refactor

Change to make easy to refactor

--- src/clojure_fabric/crypto_suite.clj
+++ src/clojure_fabric/crypto_suite.clj
@@ -6,6 +6,7 @@
            [org.bouncycastle.jce.provider BouncyCastleProvider]
            [org.bouncycastle.jcajce.provider.asymmetric.ec KeyPairGeneratorSpi$ECDSA
             BCECPrivateKey BCECPublicKey]
+           [java.util Arrays]
            [javax.crypto.spec SecretKeySpec]
            [javax.crypto SecretKeyFactory]
            [java.security KeyFactory KeyPairGenerator SecureRandom Security]
@@ -122,16 +123,21 @@
         opts (Object)
   Returns
         (Key) An instance of the Key class wrapping the raw key bytes"
-  [k-byte-array {:keys [algorithm curve ephemeral]}]
-  (let [offset 1 ;; Assume input is 1 + 64 bytes
-        curve-name (name curve)
-        kf (KeyFactory/getInstance (name algorithm) BouncyCastleProvider/PROVIDER_NAME)
-        point (ECPoint. (java.math.BigInteger. 1 #^bytes (java.util.Arrays/copyOfRange #^bytes k-byte-array offset (+ offset 32)))
-                        (java.math.BigInteger. 1 #^bytes (java.util.Arrays/copyOfRange #^bytes k-byte-array (+ offset 32) (count k-byte-array))))
+  [#^bytes k-byte-array {:keys [algorithm curve ephemeral]}]
+  (let [curve-name (name curve)
         parameter-spec (ECNamedCurveTable/getParameterSpec curve-name)
-        spec (ECNamedCurveSpec. curve-name (.getCurve parameter-spec) (.getG parameter-spec) (.getN parameter-spec)
-                                (.getH parameter-spec) (.getSeed parameter-spec))]
-    (.generatePublic kf (ECPublicKeySpec. point spec))))
+        curve (.getCurve parameter-spec)
+        curve-size (/ (* 2 (.getFieldSize curve)) 8) ;; x + y
+        key-size (count k-byte-array)
+        middle (int (/ key-size 2))]
+    (if (= curve-size key-size)
+      (.generatePublic (KeyFactory/getInstance (name algorithm) BouncyCastleProvider/PROVIDER_NAME)
+                       (ECPublicKeySpec. (ECPoint. (java.math.BigInteger. 1 (Arrays/copyOfRange k-byte-array (int 0) middle))
+                                                   (java.math.BigInteger. 1 (Arrays/copyOfRange k-byte-array middle key-size)))
+                                         (ECNamedCurveSpec. curve-name curve (.getG parameter-spec) (.getN parameter-spec)
+                                                            (.getH parameter-spec) (.getSeed parameter-spec))))
+      (throw (Exception. (format "Key size(%d) does not match with the given curve(%d)" key-size curve-size))))))
+

 ;;;getKey
@@ -144,7 +150,6 @@
   [ski]

   )
-

 ;;;hash
 (defn hash


Add deepdup instructions

Add deepdup instructions

--- src/clojush/instructions/common.clj
+++ src/clojush/instructions/common.clj
@@ -267,6 +267,33 @@
 (define-registered string_yankdup (with-meta (yankduper :string) {:stack-types [:string :integer]}))
 (define-registered char_yankdup (with-meta (yankduper :char) {:stack-types [:char :integer]}))

+(defn deepduper
+  "Returns a function that yanks a copy of an item from deep in the specified stack,
+   using the top integer to indicate how deep, indexing from the bottom of the stack."
+  [type]
+  (fn [state]
+    (if (or (and (= type :integer)
+                 (not (empty? (rest (type state)))))
+            (and (not (= type :integer))
+                 (not (empty? (type state)))
+                 (not (empty? (:integer state)))))
+      (let [raw-index (stack-ref :integer 0 state)
+            with-index-popped (pop-item :integer state)
+            max-index (dec (count (type with-index-popped)))
+            actual-index (- max-index (max 0 (min raw-index max-index)))
+            item (stack-ref type actual-index with-index-popped)]
+        (push-item item type with-index-popped))
+      state)))
+
+(define-registered exec_deepdup (with-meta (deepduper :exec) {:stack-types [:exec :integer] :parentheses 0}))
+(define-registered integer_deepdup (with-meta (deepduper :integer) {:stack-types [:integer]}))
+(define-registered float_deepdup (with-meta (deepduper :float) {:stack-types [:float :integer]}))
+(define-registered code_deepdup (with-meta (deepduper :code) {:stack-types [:code :integer]}))
+(define-registered boolean_deepdup (with-meta (deepduper :boolean) {:stack-types [:boolean :integer]}))
+(define-registered zip_deepdup (with-meta (deepduper :zip) {:stack-types [:zip :integer]}))
+(define-registered string_deepdup (with-meta (deepduper :string) {:stack-types [:string :integer]}))
+(define-registered char_deepdup (with-meta (deepduper :char) {:stack-types [:char :integer]}))
+
 (defn shover
   "Returns a function that shoves an item deep in the specified stack, using the top
    integer to indicate how deep."


Add specs for resolver and mutation

Add specs for resolver and mutation

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -23,7 +23,11 @@
 (s/def ::attributes-set (s/coll-of ::attribute :kind set?))
 (s/def ::batch? boolean?)

-(s/def ::resolver (s/keys :req [::sym] :opt [::input ::output ::resolve]))
+(s/def ::resolve fn?)
+(s/def ::mutate fn?)
+
+(s/def ::resolver (s/keys :opt [::sym ::input ::output ::params ::resolve]))
+(s/def ::mutation (s/keys :opt [::sym ::input ::output ::params ::mutate]))

 (s/def ::idents ::attributes-set)
 (s/def ::input ::attributes-set)


Added make-spinner

Added make-spinner

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

--- src/conexp/contrib/draw/buttons.clj
+++ src/conexp/contrib/draw/buttons.clj
@@ -10,7 +10,7 @@
   (:use conexp.base)
   (:import [javax.swing JPanel JButton JTextField JLabel
                         JSeparator SwingConstants Box JComboBox
-                        JSlider]
+                        JSlider SpinnerNumberModel JSpinner]
 	   [java.awt Dimension Component]))

 (ns-doc
@@ -89,14 +89,23 @@
   "Uniformly creates a slider."
   [buttons min max init]
   (let [^JSlider slider (JSlider. JSlider/HORIZONTAL (int min) (int max) (int init))]
-    (doto slider
-      (.setMaximumSize (Dimension. *item-width* *item-height*))
-      (.setMajorTickSpacing 5)
-      (.setMinorTickSpacing 1)
-      (.setPaintTicks true)
-      (.setPaintLabels true))
+    (.setMaximumSize slider (Dimension. *item-width* *item-height*))
     (.add buttons slider)
     slider))
+
+(defn make-spinner
+  "Uniformly creates a spinner."
+  [buttons min max init step]
+  (let [^SpinnerNumberModel
+        model (SpinnerNumberModel. (double init)
+                                   (double min)
+                                   (double max)
+                                   (double step)),
+        ^JSpinner
+        spinner (JSpinner. model)]
+    (.setMaximumSize spinner (Dimension. *item-width* *item-height*))
+    (.add buttons spinner)
+    spinner))

 ;;;


Fix indentation in jetty test

Fix indentation in jetty test

--- ring-jetty-adapter/test/ring/adapter/test/jetty.clj
+++ ring-jetty-adapter/test/ring/adapter/test/jetty.clj
@@ -255,8 +255,8 @@
 (defn- hello-world-cps-future [request respond raise]
   (future
     (respond {:status  200
-            :headers {"Content-Type" "text/plain"}
-            :body    "Hello World"})))
+              :headers {"Content-Type" "text/plain"}
+              :body    "Hello World"})))

 (defn- hello-world-streaming [request respond raise]
   (future


Add original arity version to standard-body-template

--- src/devtools/format.cljs
+++ src/devtools/format.cljs
@@ -160,10 +160,11 @@
 (defn build-header [value]
   (managed-pr-str value general-cljs-land-style 2))

-(defn standard-body-template [lines margin?]
-  (let [ol-style (if margin? standard-ol-style standard-ol-no-margin-style)
+(defn standard-body-template
+  ([lines margin?] (let [ol-style (if margin? standard-ol-style standard-ol-no-margin-style)
         li-style (if margin? standard-li-style standard-li-no-margin-style)]
     (template ol ol-style (map #(template li li-style %) lines))))
+  ([lines] (standard-body-template lines true)))

 (defn body-line-template [index value]
   [(index-template index) spacer (managed-pr-str value (if cljs-value? general-cljs-land-style "") 3)])


removed unnecessary require

removed unnecessary require

--- src/duffel/tree/core.clj
+++ src/duffel/tree/core.clj
@@ -1,6 +1,5 @@
 (ns duffel.tree.core
   "Core functionality for creating and working with duffel trees"
-  (:require [clojure.walk :refer [walk]])
   (:import java.io.File))

 (def dot-underscore-split #"(.+)\._(.+)$")


permit nil keys...

permit nil keys...

--- src/er_cassandra/key.clj
+++ src/er_cassandra/key.clj
@@ -14,19 +14,13 @@
                          (make-sequential record-or-key-value)
                          (repeat (count key) nil)))
          record (when (map? record-or-key-value)
-                  record-or-key-value)]
-
-     (map (fn [k ev]
-            (let [kv (or ev (get record k))]
-              (when-not kv
-                (throw (ex-info "missing key value component"
-                                {:component k
-                                 :key key
-                                 :record record
-                                 :key-value key-value})))
-              kv))
-          key
-          key-value))))
+                  record-or-key-value)
+         dkv (map (fn [k ev]
+                    (or ev (get record k)))
+                  key
+                  key-value)]
+     (when-not (some nil? dkv)
+       dkv))))

 (defn extract-key-value
   "extract a key value from some combination of explicit value


Update words.clj

Update words.clj

--- src/iyye/subcon/knowledge/words.clj
+++ src/iyye/subcon/knowledge/words.clj
@@ -90,6 +90,7 @@

 (def iyye_is_type (ref 0))
 (def iyye_consists_type (ref 0))
+(def iyye_create_instance (ref 0))

 (defn action [cmd params IO]
   (let [actions
@@ -109,6 +110,7 @@
         instof (create-iyye-relation "instance of" :IYE :AXIOM :ALWAYS [] iyye_instance_function)]
     (dosync (ref-set iyye_is_type t_is))
     (dosync (ref-set iyye_consists_type consistsof))
+    (dosync (ref-set iyye_create_instance instof))
     ; (dosync (alter noun-words conj iyye_concept))
     ;(dorun (map #(do ( persistence/write-fact-to-db (into {} %))) @action-words))
     ))
@@ -125,5 +127,8 @@

   )

+(defn init-kb []
+  (init-builtins-kb)
+  )

 ; (apply str (rest (str (:When {:When :ALWAYS}))))


removed unneeded contains? clause from test

--- test/caesium/binding_test.clj
+++ test/caesium/binding_test.clj
@@ -86,7 +86,7 @@
   (let [fns  #{"sodium_init" "crypto_pwhash_argon2i_alg_argon2i13"
                "crypto_pwhash_alg_default" "crypto_pwhash_alg_argon2i13"
                "crypto_pwhash_alg_argon2id13" "crypto_pwhash_argon2id_alg_argon2id13"}]
-    (contains? fns f)))
+    (fns f)))

 (defn check-const-method
   "Check a method binding a const fn."


Added expected output that was missing from within-tileset? test

--- test/clj/forma/utils_test.clj
+++ test/clj/forma/utils_test.clj
@@ -231,8 +231,8 @@
 (fact
   "Checks that `within-tileset?` correctly handles data inside and outside the given tile-set"
   (let [tile-set #{[28 8]}]
-    (within-tileset? tile-set 28 8)
-    (within-tileset? tile-set 29 8)))
+    (within-tileset? tile-set 28 8) => true
+    (within-tileset? tile-set 29 8) => false))

 (fact
   "Test arg-parser"


Nicer recursion

Nicer recursion

--- src/fractalz/pyramid.clj
+++ src/fractalz/pyramid.clj
@@ -87,17 +87,15 @@

 (defn do-it-async
   [plugin blocks]
-  (let [nthblock (atom 0)]
-    (letfn [(do-it []
-              (bukkit/delayed-task plugin
-                              (fn []
-                                (when (> (count blocks) @nthblock)
-                                  (do
-                                    (set-blocks! (nth blocks @nthblock))
-                                    (swap! nthblock inc)
-                                    (do-it))
-                                  )) 20))]
-      (do-it))))
+  (letfn [(do-it [blocks']
+            (bukkit/delayed-task plugin
+                                 (fn []
+                                   (when (seq blocks')
+                                     (do
+                                       (set-blocks! (first blocks'))
+                                       (do-it (next blocks')))
+                                     )) 1))]
+    (do-it blocks)))

 (defn make-sierpinsky-pyramid
   [size player plugin]


CLJS-1395: no trailing semicolons after JS comments

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -1013,12 +1013,15 @@
         ")"))))

 (defmethod emit* :js
-  [{:keys [env code segs args]}]
-  (emit-wrap env
-    (if code
-      (emits code)
-      (emits (interleave (concat segs (repeat nil))
-               (concat args [nil]))))))
+  [{:keys [op env code segs args]}]
+  (if (and code (= op :js) #?(:clj  (.startsWith ^String code "/*")
+                              :cljs (gstring/startsWith code "/*")))
+    (emits code)
+    (emit-wrap env
+      (if code
+        (emits code)
+        (emits (interleave (concat segs (repeat nil))
+                           (concat args [nil])))))))

 ;; TODO: unify renaming helpers - this one was hard to find - David


whoopsie

whoopsie

--- server/src/gratefulplace/controllers/watches.clj
+++ server/src/gratefulplace/controllers/watches.clj
@@ -20,7 +20,7 @@
              {:record
               (mapify-tx-result
                (db/t [{:db/id watch-tempid
-                       :watch/kind :watch
+                       :watch/unread-count 0
                        :watch/topic (:topic-id params)
                        :watch/user (:user-id params)}])
                watch-tempid


Add functions for evaluating ClojureScript from a Clojure REPL.

--- src/lib/clj/one/test.clj
+++ src/lib/clj/one/test.clj
@@ -139,3 +139,29 @@
   and evaluation environment."
   [form]
   `(cljs-eval ~(test-namespace) ~form))
+
+(def ^:dynamic *eval-ns* 'cljs.user)
+
+(defn bep-setup
+  "Create the environment and start a socket listener for the
+  BEP (Browser-Eval-Print).
+
+  Valid options are :port"
+  [& options]
+  (alter-var-root #'*eval-env* (constantly (apply browser-eval-env options))))
+
+(defn bep-teardown
+  "Shutdown socket listener for the BEP (Browser-Eval-Print)."
+  []
+  (alter-var-root #'*eval-env* -tear-down))
+
+(defn bep-in-ns
+  "Switch the BEP (Browser-Eval-Print) environment to the namespace
+  with the given name (a symbol)."
+  [ns-name]
+  (alter-var-root #'*eval-ns* (constantly ns-name)))
+
+(defmacro bep
+  "Evaluate forms in the browser."
+  [& forms]
+  `(evaluate-cljs *eval-env* *eval-ns* '(do ~@forms)))


add some comments

add some comments

--- src/zombie_run/core.clj
+++ src/zombie_run/core.clj
@@ -4,8 +4,10 @@
             [clojure.set :refer [rename-keys]]
             [clojure.spec.alpha :as s]))

-(s/def ::position (s/tuple (s/int-in 0 500) (s/int-in 0 500)))
-
+;;
+;; schema
+;;
+; weapon
 (s/def ::weapon-type #{:dagger :musket :zombie-fist})
 (s/def ::range (s/int-in 1 1000))
 (s/def ::attack pos-int?)
@@ -17,27 +19,33 @@
                                  ::recharge-delay
                                  ::last-attack]))

+; character (zombie, player)
 (s/def ::type #{:zombie :player})
 (s/def ::direction #{:left :right :up :down :up-left :up-right :down-left :down-right})
 (s/def ::health int?)
-
 (s/def ::character (s/keys :req-un [::type
                                     ::direction
                                     ::health
                                     ::weapon]))

+; game
+(s/def ::position (s/tuple (s/int-in 0 500) (s/int-in 0 500)))
 (s/def ::world-size ::position)
 (s/def ::terrain (s/map-of ::position ::character
                            :min-count 1))
-
 (s/def ::game (s/keys :req-un [::world-size
                                ::terrain]))

-(s/def ::player-action (conj (s/describe ::direction) :fire))
-
+; make-game
 (s/def ::player-pos ::position)
 (s/def ::zombies (s/coll-of ::position :distinct true))

+; run-player-action
+(s/def ::player-action (conj (s/describe ::direction) :fire))
+
+;;
+;; world
+;;
 (defn world-center [[x y]]
   [(int (/ x 2)) (int (/ y 2))])

@@ -278,6 +286,9 @@
                         (world-right-upper-corner world-size)]))
       (set-player (or player-pos (world-center world-size)))))

+;;
+;; function specs
+;;
 (s/fdef make-game
         :args (s/cat :x (s/keys :req-un [::world-size]
                                 :opt-un [::player-pos


PLD: this test is pushed directly into travis

--- test/hatti/cljsbuild_test.clj
+++ test/hatti/cljsbuild_test.clj
@@ -1,6 +0,0 @@
-(ns hatti.cljsbuild-test
-  (:require [clojure.java.shell :refer [sh]]
-            [midje.sweet :refer :all]))
-
-(fact "It shall combile the CLJS without error"
-      (re-find #"ERROR" (:out (sh "lein" "cljsbuild" "once" "prod"))) => nil)


Test for function parse-boolean

Test for function parse-boolean

--- test/hurvinek/config_test.clj
+++ test/hurvinek/config_test.clj
@@ -50,3 +50,18 @@
     (testing "if the hurvinek.config/print-configuration definition exists."
         (is (callable? 'hurvinek.config/print-configuration))))

+;
+; Test for function behaviours
+;
+
+(deftest test-parse-boolean
+    "Check the behaviour of function emender-jenkins.config/parse-boolean."
+    (are [x y] (= x y)
+        true (parse-boolean "true")
+        true (parse-boolean "True")
+        false (parse-boolean "false")
+        false (parse-boolean "False")
+        false (parse-boolean "")
+        false (parse-boolean "unknown")
+        false (parse-boolean nil)))
+


Move log lines out of let

Move log lines out of let

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -408,9 +408,9 @@
    Returns a list of tasks that got matched to the offer"
   [^TaskScheduler fenzo considerable offers db fid]
   (log/debug "Matching" (count offers) "offers to" (count considerable) "jobs with fenzo")
+  (log/debug "offer to scheduleOnce" offers)
+  (log/debug "tasks to scheduleOnce" considerable)
   (let [t (System/currentTimeMillis)
-        _ (log/debug "offer to scheduleOnce" offers)
-        _ (log/debug "tasks to scheduleOnce" considerable)
         leases (mapv #(->VirtualMachineLeaseAdapter % t) offers)
         requests (mapv (fn [job]
                          (->TaskRequestAdapter job (job->task-info db fid (:db/id job))))


Test url+ where service has no uri-spec

Test url+ where service has no uri-spec

--- test/party/discovery_test.clj
+++ test/party/discovery_test.clj
@@ -51,6 +51,17 @@
         (party/url+ "care" {:* "users/foo"} "/" "bar") => "http://10.216.141.6:8080/1.x/care/users/foo/bar"
         (party/disconnect!)))

+(fact "url+ can be used when service has no uri-spec"
+      (with-zk {:nodes {"/dev/instances/care/7fee1629-8e38-4c7b-b584-8e9621b43f3b"
+                        (json/generate-string {:name "care"
+                                               :address "10.216.141.6"
+                                               :port 8080
+                                               :registrationTimeUTC 1387297218261
+                                               :serviceType "DYNAMIC"})}}
+        (party/connect! *zk-connect-string* environment-name)
+        (party/url+ "care" {} "/bar") => "http://10.216.141.6:8080/bar"
+        (party/disconnect!)))
+
 (fact "url can be used to build a url for an registered resource"
       (with-zk {:nodes {"/dev/instances/care/7fee1629-8e38-4c7b-b584-8e9621b43f3b"
                         (json/generate-string {:name "care"


(SERVER-325) Extract function for flushing a single JRuby instance

This commit extracts the functionality for flushing a single
JRuby instance to its own function.  This will allow us to call
it in other situations besides the case where we are flushing
the whole pool.

--- src/clj/puppetlabs/services/jruby/jruby_puppet_agents.clj
+++ src/clj/puppetlabs/services/jruby/jruby_puppet_agents.clj
@@ -60,6 +60,20 @@
         (throw (IllegalStateException. "There was a problem adding a JRubyPuppet instance to the pool." e))))))

 (schema/defn ^:always-validate
+  flush-instance!
+  "Flush a single JRuby instance.  Create a new replacement instance
+  and insert it into the specified pool."
+  [{:keys [scripting-container id]} :- jruby-core/JRubyPuppetInstanceOrRetry
+   new-pool :- jruby-core/pool-queue-type
+   new-id   :- schema/Int
+   config   :- jruby-core/JRubyPuppetConfig
+   profiler :- (schema/maybe PuppetProfiler)]
+  (.terminate scripting-container)
+  (log/infof "Cleaned up old JRuby instance with id %s, creating replacement."
+             id)
+  (jruby-core/create-pool-instance! new-pool new-id config profiler))
+
+(schema/defn ^:always-validate
   flush-pool!
   "Flush of the current JRuby pool.  NOTE: this function should never
   be called except by the pool-agent."
@@ -81,12 +95,9 @@
     (log/info "Swapped JRuby pools, beginning cleanup of old pool.")
     (doseq [i (range count)]
       (try
-        (let [id (inc i)
-              instance (jruby-core/borrow-from-pool (:pool old-pool))]
-          (.terminate (:scripting-container instance))
-          (log/infof "Cleaned up old JRuby instance %s of %s, creating replacement."
-                     id count)
-          (jruby-core/create-pool-instance! new-pool id config profiler)
+        (let [id        (inc i)
+              instance  (jruby-core/borrow-from-pool (:pool old-pool))]
+          (flush-instance! instance new-pool id config profiler)
           (log/infof "Finished creating JRubyPuppet instance %d of %d"
                      id count))
         (catch Exception e


keep another state for the count of cells that needs to be open

--- src-cljs/minesweeper/core.cljs
+++ src-cljs/minesweeper/core.cljs
@@ -1,7 +1,6 @@
 (ns minesweeper.core
   (:require [clojure.string :as string]
-            [reagent.core :as r]
-            ))
+            [reagent.core :as r]))

 (enable-console-print!)

@@ -35,9 +34,7 @@

 (defn update-timer []
   (let [game @game-state]
-;;    (println "timer triggered")
     (when-not (or (game :first) (game :end))
-;;      (println "Changed seconds")
       (set-tick))))

 (defn stop-sound [] (when-let [ audio-obj @playing] (.pause audio-obj)))
@@ -91,17 +88,9 @@
    :first true
    :start 0 ;;timestamp
    :remains mines
+   :need-open (- (* x y) mines)
    }))

-(defn all-open? [game]
-  (= (->> (game :board)
-          (apply concat)
-          (filter #(not= 1 %))
-          (count))
-     (->> (game :states)
-          (apply concat)
-          (filter #(= :open %))
-          (count))))

 (defn complete-game [game]
   (.ga  js/window 'send', 'event', 'win-game', 'click')
@@ -114,6 +103,12 @@
   (play-sound :failed)
   (-> game
       (assoc-in [:end] :failed)))
+
+(defn open-cell [game x y]
+  (-> game
+      (assoc-in [:states x y] :open)
+      (update-in [:need-open] dec)))
+

 (defn open-surround [game col mark-to-open]
   (if (seq col)
@@ -123,11 +118,11 @@
                        (filter #(can-open (get-in game (into [:states] %)) ))
                        (filter (complement mark-to-open))) ]
       (recur
-        (reduce #(assoc-in % (into [:states] %2) :open) game to-open)
+        (reduce #(apply open-cell %  %2) game to-open)
         (into (pop col) (filter #(zero? (get-in game (into [:counts] %) 99)) to-open))
         (into mark-to-open to-open)))
     ;; end of traverse
-    (if (all-open? game) (complete-game game) game)))
+    (if (zero? (game :need-open)) (complete-game game) game)))

 ;; make the first click lucky
 ;; and swap
@@ -167,7 +162,6 @@
     (swap-cell game [x y] (find-space game))
     game))

-
 (defn click-game [game x y]
   (let [game (if (game :first)
                (-> game
@@ -178,10 +172,10 @@
     (condp = (get-in game [:states x y])
       :flag game
       :open game
-      (let [game (assoc-in game [:states x y] :open)]
+      (let [game (open-cell game x y)]
            (cond
-             (= (get-in game [:board x y ]) 1) (fail-game game)  ;bomb
-             (all-open? game) (complete-game game)               ;all openned
+             (= (get-in game [:board x y ]) 1)  (fail-game game)  ;bomb
+             (zero? (game :need-open))           (complete-game game)               ;all openned
              (zero? (get-in game [:counts x y])) (open-surround game [[x y]] #{[x y]}) ;open all neighors
              :else game)))))

@@ -338,6 +332,5 @@
 (defn start []
   (new-game! :beginner)
   (r/render-component [control-component] (.getElementById js/document "controls"))
-  (r/render-component [game-table] (.getElementById js/document "rows"))
-  )
-
+  (r/render-component [game-table] (.getElementById js/document "rows")))
+


Add stuff about order of evaluation of map literals

--- test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_300_collections.clj
+++ test/com/nomistech/clojure_the_language/c_200_clojure_basics/s_300_collections.clj
@@ -82,6 +82,102 @@

 (assert (= (set (vals  {:a 1 :b 2 :c 3}))
            (set [1 2 3])))
+
+;;;; ------------------------------------------------
+;;;; ---- order of evaluation of map literals ----
+
+(fact "Order of evaluation of map literals"
+
+  (fact "Small maps are as you would expect"
+    (let [i (atom 0)]
+      {:k1 (swap! i inc)
+       :k2 (swap! i inc)
+       :k3 (swap! i inc)
+       :k4 (swap! i inc)
+       :k5 (swap! i inc)
+       :k6 (swap! i inc)
+       :k7 (swap! i inc)
+       :k8 (swap! i inc)})
+    => {:k1 1
+        :k2 2
+        :k3 3
+        :k4 4
+        :k5 5
+        :k6 6
+        :k7 7
+        :k8 8})
+
+  (fact "Larger maps might not be as you expect"
+    (let [i (atom 0)]
+      {:k1 (swap! i inc)
+       :k2 (swap! i inc)
+       :k3 (swap! i inc)
+       :k4 (swap! i inc)
+       :k5 (swap! i inc)
+       :k6 (swap! i inc)
+       :k7 (swap! i inc)
+       :k8 (swap! i inc)
+       :k9 (swap! i inc)})
+    =not=> {:k1 1
+            :k2 2
+            :k3 3
+            :k4 4
+            :k5 5
+            :k6 6
+            :k7 7
+            :k8 8
+            :k9 9})
+
+  (fact "Use `hash-map` if order of evaluation is important"
+    (let [i (atom 0)]
+      (hash-map :k1 (swap! i inc)
+                :k2 (swap! i inc)
+                :k3 (swap! i inc)
+                :k4 (swap! i inc)
+                :k5 (swap! i inc)
+                :k6 (swap! i inc)
+                :k7 (swap! i inc)
+                :k8 (swap! i inc)
+                :k9 (swap! i inc)))
+    => {:k1 1
+        :k2 2
+        :k3 3
+        :k4 4
+        :k5 5
+        :k6 6
+        :k7 7
+        :k8 8
+        :k9 9})
+
+  (fact "Or put values in a `let`"
+    (let [i (atom 0)
+          v1 (swap! i inc)
+          v2 (swap! i inc)
+          v3 (swap! i inc)
+          v4 (swap! i inc)
+          v5 (swap! i inc)
+          v6 (swap! i inc)
+          v7 (swap! i inc)
+          v8 (swap! i inc)
+          v9 (swap! i inc)]
+      {:k1 v1
+       :k2 v2
+       :k3 v3
+       :k4 v4
+       :k5 v5
+       :k6 v6
+       :k7 v7
+       :k8 v8
+       :k9 v9})
+    => {:k1 1
+        :k2 2
+        :k3 3
+        :k4 4
+        :k5 5
+        :k6 6
+        :k7 7
+        :k8 8
+        :k9 9}))

 ;;;; ___________________________________________________________________________
 ;;;; ---- sets ----


Reset form fields after new item is saved

--- src/warehouse/core.cljs
+++ src/warehouse/core.cljs
@@ -262,6 +262,7 @@
                     :on-click (m/handler-fn
                                 (let [k (or (inc (apply max (keys (:components @app-state)))) 1)]
                                   (swap! app-state assoc-in [:components k] (assoc @new-item :id k :tags (util/string->array (:tags @new-item)))))
+                                (reset! new-item {:name "" :tags "" :amount 1})
                                 (reset! adding false))} "Save"]
           [:button {:type "button" :on-click (m/handler-fn (reset! adding false))} "Cancel"]])
        (when (true? @showing-changeset)


JSONでない場合は400


Fix camera bug in paint tiles demo

Fix camera bug in paint tiles demo

--- src/phzr_demo/paint_tiles_demo.cljs
+++ src/phzr_demo/paint_tiles_demo.cljs
@@ -90,17 +90,17 @@
   [cursors game]
   (cond
     (get-in @cursors [:left :is-down])
-    (pset! (:camera game) :x (- (:camera game) 4))
+    (pset! (:camera game) :x (- (get-in game [:camera :x]) 4))

     (get-in @cursors [:right :is-down])
-    (pset! (:camera game) :x (+ (:camera game) 4)))
+    (pset! (:camera game) :x (+ (get-in game [:camera :x]) 4)))

   (cond
     (get-in @cursors [:up :is-down])
-    (pset! (:camera game) :y (- (:camera game) 4))
+    (pset! (:camera game) :y (- (get-in game [:camera :y]) 4))

     (get-in @cursors [:down :is-down])
-    (pset! (:camera game) :y (+ (:camera game) 4))))
+    (pset! (:camera game) :y (+ (get-in game [:camera :y]) 4))))

 (defn ^:private build-update-fn
   [current-tile cursors layer marker tmap]


more card implementations

more card implementations

--- src/node/game/cards.cljs
+++ src/node/game/cards.cljs
@@ -8,14 +8,25 @@
             [game.utils :refer [has?]]))

 (def cards
-  {"Access to Globalsec"
+  {"Accelerated Beta Test"
+   {:optional {:prompt "Look at the top 3 cards of R&D?"
+               :msg (msg (let [c (count (filter #(= (:type %) "ICE") (take 3 (:deck corp))))]
+                           (str "install " c " ICE and trash " (- 3 c) " cards")))
+               :effect (req (doseq [c (take 3 (:deck corp))]
+                              (if (= (:type c) "ICE")
+                                (corp-install state side c nil {:no-install-cost true :rezzed true})
+                                (trash state side c))))}}
+
+   "Access to Globalsec"
    {:effect (effect (gain :link 1)) :leave-play (effect (lose :link 1))}

    "Account Siphon"
-   {:effect (effect (run :hq
-                      {:replace-access
-                       {:effect (effect (gain :tag 2 :credit (* 2 (min 5 (:credit corp))))
-                                        (lose :corp :credit (min 5 (:credit corp))))}}))}
+   {:effect (effect (run :hq {:replace-access
+                              {:msg (msg "Account Siphon to force the Corp to lose " (min 5 (:credit corp))
+                                         " [Credits], gain " (* 2 (min 5 (:credit corp)))
+                                         " [Credits] and take 2 tags")
+                               :effect (effect (gain :tag 2 :credit (* 2 (min 5 (:credit corp))))
+                                               (lose :corp :credit (min 5 (:credit corp))))}}))}

    "Activist Support"
    {:events
@@ -69,6 +80,16 @@

    "Anonymous Tip"
    {:effect (effect (draw 3))}
+
+   "Argus Security: Protection Guaranteed"
+   {:events {:agenda-stolen
+             {:prompt "Take 1 tag or suffer 2 meat damage?"
+              :choices ["1 tag" "2 meat damages"] :player :runner
+              :msg "make the Runner take 1 tag or suffer 2 meat damage"
+              :effect (req (if (= target "1 tag")
+                             (do (gain state :runner :tag 1) (system-msg state side "takes 1 tag"))
+                             (do (damage state :runner :meat 2)
+                                 (system-msg state side "suffers 2 meat damage"))))}}}

    "Astrolabe"
    {:effect (effect (gain :memory 1)) :leave-play (effect (lose :memory 1))
@@ -152,9 +173,10 @@
    "City Surveillance"
    {:events {:runner-turn-begins
              {:prompt "Pay 1 [Credits] or take 1 tag" :choices ["Pay 1 credit" "Take 1 tag"]
-              :player :runner
-              :effect (req (when-not (and (= target "Pay 1 credit") (pay state side card :credit 1))
-                             (gain state side :tag 1)))}}}
+              :player :runner :msg "make the Runner pay 1 [Credits] or take 1 tag"
+              :effect (req (if-not (and (= target "Pay 1 credit") (pay state side card :credit 1))
+                             (do (gain state side :tag 1) (system-msg state side "takes 1 tag"))
+                             (system-msg state side "pays 1 [Credits]")))}}}

    "Cloak"
    {:recurring 1}
@@ -172,6 +194,16 @@

    "Closed Accounts"
    {:req (req tagged) :effect (effect (lose :runner :credit :all))}
+
+   "Code Siphon"
+   {:effect (effect (run :rd
+                      {:replace-access
+                       {:prompt "Choose a program to install"
+                        :msg (msg "Code Siphon to install " (:title target) " and take 1 tag")
+                        :choices (req (filter #(and (has? % :type "Program")
+                                                    (<= (:cost %) (:credit runner))) (:deck runner)))
+                        :effect (effect (gain :tag 1)
+                                        (runner-install target) (shuffle! :deck))}}))}

    "Collective Consciousness"
    {:events {:rez {:req (req (= (:type target) "ICE")) :msg "draw 1 card"
@@ -1701,8 +1733,9 @@
    {:abilities [{:msg "end the run" :effect (effect (end-run))}]}

    "Tollbooth"
-   {:msg "force the runner to lose 3 [Credits]" :effect (effect (lose :runner :credit 3))
-    :abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "force the runner to lose 3 [Credits]"
+                 :effect (effect (lose :runner :credit 3))}
+                {:msg "end the run" :effect (effect (end-run))}]}

    "Tsurugi"
    {:abilities [{:msg "end the run" :effect (effect (end-run))}


More compact trivial subs.

More compact trivial subs.

--- src/cljs/clj_templates/pages/templates/core.cljs
+++ src/cljs/clj_templates/pages/templates/core.cljs
@@ -43,43 +43,16 @@
 (reg-event :templates/page-change page-change-handler)
 (reg-event :templates/delayed-search delayed-search-handler)

-(reg-sub
-  :templates/templates
-  (fn [db]
-    (:templates db)))
-
-(reg-sub
-  :templates/active-tab
-  (fn [db]
-    (:active-tab db)))
-
-(reg-sub
-  :templates/loading?
-  (fn [db]
-    (:loading? db)))
-
-(reg-sub
-  :templates/hit-count
-  (fn [db]
-    (:hit-count db)))
-
-(reg-sub
-  :templates/current-page-index
-  (fn [db]
-    (:current-template-page db)))
+(reg-sub :templates/templates (fn [db] (:templates db)))
+(reg-sub :templates/active-tab (fn [db] (:active-tab db)))
+(reg-sub :templates/loading? (fn [db] (:loading? db)))
+(reg-sub :templates/hit-count (fn [db] (:hit-count db)))
+(reg-sub :templates/current-page-index (fn [db] (:current-template-page db)))
+(reg-sub :templates/query-string (fn [db] (:query-string db)))
+(reg-sub :templates/error? (fn [db] (:error? db)))

 (reg-sub
   :templates/page-count
   :<- [:templates/hit-count]
   (fn [hit-count]
     (page-count hit-count)))
-
-(reg-sub
-  :templates/query-string
-  (fn [db]
-    (:query-string db)))
-
-(reg-sub
-  :templates/error?
-  (fn [db]
-    (:error? db)))


move to export csv predictions (easier for reading in R)

--- src/clojure/zensols/model/execute_classifier.clj
+++ src/clojure/zensols/model/execute_classifier.clj
@@ -11,8 +11,8 @@
   (:use [clojure.java.io :as io :only [input-stream output-stream file]])
   (:use [clojure.pprint :only [pprint]])
   (:require [clojure.tools.logging :as log]
-            [clojure.string :as str])
-  (:require [clj-excel.core :as excel])
+            [clojure.string :as str]
+            [clojure.data.csv :as csv])
   (:require [zensols.tabres.display-results :as dr])
   (:require [zensols.actioncli.resource :refer (resource-path)]
             [zensols.util.spreadsheet :as ss]
@@ -357,7 +357,7 @@
   with [[write-predictions]]."
   [model]
   (io/file (cl/analysis-report-resource)
-           (format "%s-predictions.xls" (:name model))))
+           (format "%s-predictions.csv" (:name model))))

 (defn write-predictions
   "Write **predictions** given by [[predict]] to the analysis directory.  If
@@ -374,14 +374,10 @@
   ([predictions file]
    (let [{:keys [columns data model]} predictions
          col-names (map name columns)]
-     (-> (excel/build-workbook
-          (excel/workbook-hssf)
-          {(format "%s Predictions" (str/capitalize (:name model)))
-           (->> data
-                (map (fn [row]
-                       (map #(get row %) columns)))
-                (cons col-names)
-                (ss/headerize))})
-         (ss/autosize-columns)
-         (excel/save file))
+     (with-open [writer (io/writer file)]
+       (->> data
+            (map (fn [row]
+                   (map #(get row %) columns)))
+            (cons col-names)
+            (csv/write-csv writer)))
      (log/infof "wrote predictions to %s" file))))


More defensive coding on finance values.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -183,14 +183,16 @@
         cash? (utils/not-zero? cash)
         formatted-cash (when cash? (utils/with-currency currency (utils/with-size-label cash)))
         prior-cash (when prior-finances (:cash prior-finances))
-        cash-delta (when (and cash? prior-cash) (- cash prior-cash))
+        prior-cash? (utils/not-zero? prior-cash)
+        cash-delta (when (and cash? prior-cash?) (- cash prior-cash))
         formatted-cash-delta (when cash-delta (format-delta currency cash-delta prior-date))
         ;; Info on revenue
         revenue (:revenue finances)
         revenue? (utils/not-zero? revenue)
         formatted-revenue (when revenue? (utils/with-currency currency (utils/with-size-label revenue)))
         prior-revenue (when prior-finances (:revenue prior-finances))
-        revenue-delta (when (and revenue? prior-revenue) (- revenue prior-revenue))
+        prior-revenue? (utils/not-zero? prior-revenue)
+        revenue-delta (when (and revenue? prior-revenue?) (- revenue prior-revenue))
         revenue-delta-percent (when revenue-delta (* 100 (float (/ revenue-delta prior-revenue))))
         formatted-revenue-delta (when revenue-delta-percent (format-delta revenue-delta-percent prior-date))
         spark-revenue-periods (when spark-periods (reverse (take-while #(number? (:revenue %)) spark-periods)))
@@ -201,7 +203,8 @@
         costs? (utils/not-zero? costs)
         formatted-costs (when costs? (utils/with-currency currency (utils/with-size-label costs)))
         prior-costs (when prior-finances (:costs prior-finances))
-        costs-delta (when (and costs? prior-costs) (- costs prior-costs))
+        prior-costs? (utils/not-zero? prior-costs)
+        costs-delta (when (and costs? prior-costs?) (- costs prior-costs))
         costs-delta-percent (when costs-delta (* 100 (float (/ costs-delta prior-costs))))
         formatted-costs-delta (when costs-delta-percent (format-delta costs-delta-percent prior-date))
         spark-costs-periods (when spark-periods (reverse (take-while #(number? (:costs %)) spark-periods)))


Use list iterators to compute implicational closures

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

--- src/conexp/contrib/algorithms/canonical_base.clj
+++ src/conexp/contrib/algorithms/canonical_base.clj
@@ -12,41 +12,38 @@
 (require '[conexp.main :as cm]
          '[conexp.contrib.algorithms.next-closure :as nc])

-(import '[java.util BitSet])
+(import '[java.util BitSet List LinkedList ListIterator])
 (import '[conexp.fca.implications Implication])

 ;;; Computing Implicational Closures

 (defn- add-immediate-elements
-  "Destructs input bitset"
-  [implications, ^BitSet input-set, subset-test]
-  (loop [impls        implications,
-         unused-impls (transient []),
-         changed?     false]
-    (if-let [^Implication impl (first impls)]
-      (if (subset-test (.premise impl) input-set)
-        (do (dobits [x (.conclusion impl)]
-              (.set input-set x))
-            (recur (rest impls)
-                   unused-impls
-                   true))
-        (recur (rest impls)
-               (conj! unused-impls impl)
-               changed?))
-      [input-set, (persistent! unused-impls), changed?])))
+  "Destructs implications and input-bitset"
+  [^List implications, ^BitSet input-set, subset-test]
+  (let [^ListIterator iter (.listIterator implications)]
+    (loop [changed? false]
+      (if-not (.hasNext iter)
+        [input-set, implications, changed?]
+        (let [^Implication impl (.next iter)]
+          (if (subset-test (.premise impl) input-set)
+            (do (dobits [x (.conclusion impl)]
+                  (.set input-set x))
+                (.remove iter)
+                (recur true))
+            (recur changed?)))))))

 (defn close-under-implications
   "Yields new bitset that is the closure of the input bitset under the given collection of
   implications of bitsetsn"
   [implications, ^BitSet set]
   (loop [set   (.clone set),
-         impls implications]
+         impls (LinkedList. implications)]
     (let [[new impls changed?] (add-immediate-elements impls
                                                        set
                                                        (fn [^BitSet A, ^BitSet B]
                                                          (forall-in-bitset [x A]
-                                                                           (.get B x))))]
+                                                           (.get B x))))]
       (if changed?
         (recur new impls)
         new))))


add {:synsem {subcat '()}}

add {:synsem {subcat '()}}

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -344,7 +344,8 @@
   (is (not (empty? (parse "I turned the radio on"))))
   (is (not (empty? (parse "I turned off the radio"))))
   (is (not (empty? (parse "I turned the radio off"))))
-  (let [generated (morph (generate {:synsem {:sem {:pred :turn-on
+  (let [generated (morph (generate {:synsem {:subcat '()
+                                             :sem {:pred :turn-on
                                                    :tense :present
                                                    :obj {:mod '()
                                                          :number :sing


removed the heroku command line use and used git directly

--- test/dmgr/test/core.clj
+++ test/dmgr/test/core.clj
@@ -42,7 +42,7 @@
 (def git-fetch-test-cmd nil)
 (def git-clone-test-cmd nil)
 (:push-to-heroku test-git-deploy-cmds)
-;(deploy test-params)
+;;(deploy test-params)

 ;;========================================================================
 ;; ACCEPTANCE TEST: Ring Compojure clojure web app installed from github
@@ -50,9 +50,11 @@
 ;;========================================================================
 (def test-webhook-uri "/deploy?app=lhg&key=test123")

-(get-github-repo-uri "lhg" "blarg")
+(get-github-repo-uri "lhg" )
+(get-heroku-repo-uri "lhg" )
 (get-ssh-private-key "lhg")

-(expect true (= (:status (app (request :post test-webhook-uri))) 200))
-(keys (System/getenv ))
+;;(expect true (= (:status (app (request :post test-webhook-uri))) 200))
+
+;;(keys (System/getenv ))


add ipv6 loopback default

add ipv6 loopback default

--- src/main/shadow/cljs/devtools/server/web/api.clj
+++ src/main/shadow/cljs/devtools/server/web/api.clj
@@ -309,7 +309,9 @@
         trusted-hosts
         (set/union
           (set (get-in req [:config :trusted-hosts]))
-          #{"127.0.0.1" "localhost"})]
+          #{"127.0.0.1"
+            "0:0:0:0:0:0:0:1"
+            "localhost"})]

     ;; FIXME: maybe needs to do host->addr translation?
     (if-not (contains? trusted-hosts remote-addr)


WIP - tests permissions

WIP - tests permissions

--- api/src/clojure/org/akvo/flow_api/unilog/unilog.clj
+++ api/src/clojure/org/akvo/flow_api/unilog/unilog.clj
@@ -71,16 +71,32 @@
       pipeline
       (fn
         ([final]
-         (let [form-instance-deleted (set (keep ::form-instance-deleted final))]
-           {:unilog-id (:id (last final))
-            :form-instance-deleted form-instance-deleted
-            :form-instances (remove
-                              (comp form-instance-deleted :id)
-                              (distinct (keep ::form-instance-changed final)))}))
+         (let [form-instance-deleted (set (keep ::form-instance-deleted final))
+               form-instances-grouped-by-form (group-by :form-id
+                                                (remove
+                                                  (comp form-instance-deleted :id)
+                                                  (distinct (keep ::form-instance-changed final))))]
+           {::unilog-id (:id (last final))
+            ::form-instance-deleted form-instance-deleted
+            :forms-to-load (keys form-instances-grouped-by-form)
+            ::forms-instances-grouped-by-form form-instances-grouped-by-form}))
         ([sofar batch]
          (conj sofar batch)))
       []
       reducible)))
+
+(defn after-forms-loaded [{::keys [forms-instances-grouped-by-form
+                                   unilog-id
+                                   form-instance-deleted]}
+                          form-id->form]
+  {:unilog-id unilog-id
+   :form-instance-deleted form-instance-deleted
+   :form-instances-to-load (->> forms-instances-grouped-by-form
+                             (keep (fn [[form-id form-instance]]
+                                     (when-let [form (get form-id->form form-id)]
+                                       {:form form
+                                        :form-instance-ids (set (map :id form-instance))})))
+                             set)})

 (defn process-new-events [reducible]
   (let [last-unilog-id (atom nil)


Add charset=utf-8

Add charset=utf-8

--- src/pict_source/core.clj
+++ src/pict_source/core.clj
@@ -58,8 +58,23 @@
     (stasis/export-pages public-pages export-dir {:optimus-assets optimized-assets})
     (add-config-to-build)))

+(defn wrap-utf-8
+  "This function works around the fact that Ring simply chooses the default JVM
+  encoding for the response encoding. This is not desirable, we always want to
+  send UTF-8.
+  https://github.com/cjohansen/cjohansen-no/blob/master/src/cjohansen_no/web.clj#L16"
+  [handler]
+  (fn [request]
+    (when-let [response (handler request)]
+      (if (.contains (get-in response [:headers "Content-Type"]) ";")
+        response
+        (if (string? (:body response))
+          (update-in response [:headers "Content-Type"] #(str % "; charset=utf-8"))
+          response)))))
+
 (def server (-> (stasis/serve-pages public-pages)
                 (optimus/wrap
                   public-assets assets-optimizations/all assets-strategies/serve-live-assets)
                 ring.middleware.content-type/wrap-content-type
-                ring.middleware.not-modified/wrap-not-modified))
+                ring.middleware.not-modified/wrap-not-modified
+                wrap-utf-8))


Prototype speed slider

Prototype speed slider

--- maps/src/maps/core.cljs
+++ maps/src/maps/core.cljs
@@ -1,5 +1,5 @@
 (ns maps.core
-  (:require [reagent.core :as reagent :refer [atom]]))
+  (:require [reagent.core :as reagent]))

 (enable-console-print!)

@@ -18,6 +18,8 @@
 (defonce width (reagent/atom 800))

 (defonce height (reagent/atom 600))
+
+(defonce speed (reagent/atom 1700))

 (def options
   {:chart       {:type "line"}
@@ -80,15 +82,11 @@
 (defn logistic-map [x]
   (* 3.9341 x (- 1 x)))

-(defn evolution! [seed ticks ps _]
-  (let [x (atom seed)]
-    (swap! ps conj [@ticks seed])
-    (fn [_ ticks ps component]
-      (let [x' (logistic-map @x)
-            ticks' (swap! ticks inc)]
-        (swap! ps conj [ticks' x'])
-        (js/setTimeout #(reset! x x') 1000)
-        [:div component (str [ticks' x'])]))))
+(defn evolution! [seed ps sp]
+  (letfn [(evol [x y]
+            (do (swap! ps conj [x y])
+                (js/setTimeout #(evol (inc x) (logistic-map y)) (- 2200 @sp))))]
+    (evol 0 seed)))

 (defn page []
   [:div
@@ -97,7 +95,7 @@
     [slider "x-min" x-min -500 0]]
    [:div
     [:label {:for "x-max"} "x-axis max value"]
-    [slider "x-max" x-max 1 500]]
+    [slider "x-max" x-max 1 1000]]
    [:div
     [:label {:for "y-min"} "y-axis min value"]
     [slider "y-min" y-min -500 0]]
@@ -106,12 +104,16 @@
     [slider "y-max" y-max 1 500]]
    [:div
     [:label {:for "width"} "width"]
-    [slider "width" width 400 1920]]
+    [slider "width" width 400 3000]]
    [:div
     [:label {:for "height"} "height"]
     [slider "y-max" height 400 1080]]
-   [evolution! 0.851 ticks points
-    [chart width height points]]])
+   [:div
+    [:label {:for "speed"} "speed"]
+    [slider "speed" speed 200 2000]]
+   [chart width height points]])

 (reagent/render-component [page]
-                          (. js/document (getElementById "app")))+                          (. js/document (getElementById "app")))
+
+(evolution! 0.851 points, speed)


Initialize bullet before sandboxing

Initialize bullet before sandboxing

--- src/nightmod/sandbox.clj
+++ src/nightmod/sandbox.clj
@@ -43,14 +43,16 @@
                       :context context
                       :timeout 5000
                       :namespace 'nightmod.game
-                      :init '(require '[nightmod.public :refer :all]
-                                      '[play-clj.core :refer :all]
-                                      '[play-clj.g2d :refer :all]
-                                      '[play-clj.g2d-physics :refer :all]
-                                      '[play-clj.g3d :refer :all]
-                                      '[play-clj.math :refer :all]
-                                      '[play-clj.ui :refer :all]
-                                      '[play-clj.utils :refer :all])))
+                      :init '(do
+                               (require '[nightmod.public :refer :all]
+                                        '[play-clj.core :refer :all]
+                                        '[play-clj.g2d :refer :all]
+                                        '[play-clj.g3d :refer :all]
+                                        '[play-clj.math :refer :all]
+                                        '[play-clj.physics :refer :all]
+                                        '[play-clj.ui :refer :all]
+                                        '[play-clj.utils :refer :all])
+                               (init-bullet!))))

 (defn set-policy!
   []


More card implementations

More card implementations

--- src/node/game/cards.cljs
+++ src/node/game/cards.cljs
@@ -338,6 +338,12 @@
              :agenda-stolen {:msg (msg "gain " (:agendapoints target) " [Credits]")
                              :effect (effect (gain :credit (:agendapoints target)))}}}

+   "Hostage"
+   {:prompt "Choose a Connection to install"
+    :choices (req (filter #(and (has? % :subtype "Connection")
+                                (<= (:cost %) (:credit runner))) (:deck runner)))
+    :effect (effect (runner-install target) (shuffle! :deck))}
+
    "Hostile Infrastructure"
    {:events {:trash {:req (req (and (= (:side target) :corp) (= side :runner)))
                      :effect (effect (damage :net 1))}}}
@@ -483,6 +489,12 @@
    "Noise: Hacker Extraordinaire"
    {:events {:runner-install {:msg "trash the top card of R&D" :effect (effect (mill :corp))
                               :req (req (has? target :subtype "Virus"))}}}
+
+   "Notoriety"
+   {:req (req (and (some #{:hq} (:successful-run runner-reg))
+                   (some #{:rd} (:successful-run runner-reg))
+                   (some #{:archives} (:successful-run runner-reg))))
+    :effect (effect (gain :agenda-point 1) (move (first (:play-area runner)) :scored))}

    "Oracle May"
    {:abilities [{:cost [:click 1] :once :per-turn :prompt "Choose card type"
@@ -506,6 +518,11 @@
    "PAD Campaign"
    {:events {:corp-turn-begins {:msg "gain 1 [Credits]" :effect (effect (gain :credit 1))}}}

+   "Profiteering"
+   {:choices ["0" "1" "2" "3"] :prompt "How many bad publicity?"
+    :msg (msg "take " target " bad publicity and gain " (* 5 target) " [Credits]")
+    :effect (effect (gain :credit (* 5 (js/parseInt target)) :bad-publicity (js/parseInt target)))}
+
    "Omni-Drive"
    {:recurring 1}

@@ -602,6 +619,13 @@
     :leave-play #(do (remove-watch % :rachel-beckman)
                      (lose %1 %2 :click 1 :click-per-turn 1))}

+   "Research Station"
+   {:effect (effect (gain :max-hand-size 2))
+    :leave-play (effect (lose :max-hand-size 2))}
+
+   "Restoring Face"
+   {:effect (effect (lose :bad-publicity 2))}
+
    "Restructure"
    {:effect (effect (gain :credit 15))}

@@ -637,6 +661,12 @@
    "Sentinel Defense Program"
    {:events {:damage {:req (req (= target :brain)) :msg "to do 1 net damage"
                       :effect (effect (damage :net 1)) }}}
+
+   "Server Diagnostics"
+   {:events {:corp-turn-begins {:effect (effect (gain :credit 2)) :msg "gain 2 [Credits]"}
+             :corp-install {:req (req (has? target :type "ICE"))
+                            :effect (effect (trash card)
+                                            (system-msg "trashes Server Diagnostic"))}}}

    "Shattered Remains"
    {:advanceable :always
@@ -1263,10 +1293,6 @@
    "Reina Roja: Freedom Fighter"
    {:effect (effect (gain :link 1))}

-   "Research Station"
-   {:effect (effect (gain :max-hand-size 2))
-    :leave-play (effect (lose :max-hand-size 2))}
-
    "SEA Source"
    {:req (req (:successful-run runner-reg))}


Show the user avatar, name and note only if user avarar, name and the note is present.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -315,6 +315,7 @@
         formatted-invite-message (format invite-message from)
         from-avatar (-> notice :inviter :avatar-url)
         from-avatar? (not (s/blank? from-avatar))
+        show-note? (and from-avatar? note?)
         note (:note notice)
         note? (not (s/blank? note))]
     [:td {:class "small-10 large-8 columns"}
@@ -326,9 +327,9 @@
       (when logo? (spacer 35))
       (h1 formatted-invite-message)
       (spacer 35)
-      (when from-avatar? (note-author from-avatar from))
-      (when note? (spacer 16))
-      (when note? (paragraph note))
+      (when show-note? (note-author from-avatar from))
+      (when show-note? (spacer 16))
+      (when show-note? (paragraph note))
       (spacer 35)
       (left-button "Accept invitation" board-url)
       (spacer 24)
@@ -347,6 +348,7 @@
         from-avatar? (not (s/blank? from-avatar))
         note (:note invite)
         note? (not (s/blank? note))
+        show-note? (and from-avatar? note?)
         invite-message (str from " "
                         (if (s/blank? org-name)
                           invite-message
@@ -360,9 +362,9 @@
       (when logo? (spacer 35))
       (h1 invite-message)
       (spacer 20)
-      (when from-avatar? (note-author from-avatar from))
-      (when note? (spacer 16))
-      (when note? (paragraph note))
+      (when show-note? (note-author from-avatar from))
+      (when show-note? (spacer 16))
+      (when show-note? (paragraph note))
       (spacer 35)
       (left-button invite-button (:token-link invite))
       (spacer 24)


a release

a release

--- src/ontrail/exercise.clj
+++ src/ontrail/exercise.clj
@@ -99,7 +99,7 @@

 (defn comment-hiding? [viewing-user ex]
   (let [user (:user ex)]
-    (and (= "nobody" viewing-user) (not= "admin" user))))
+    (= "nobody" viewing-user)))

 (defn get-ex
   ([viewing-user id]


Adding minor fix

Adding minor fix

--- src/riak_loader/core.clj
+++ src/riak_loader/core.clj
@@ -180,6 +180,7 @@
         ]

       ;; TEST
+      ;; (do (println "something") (exit 0))
       ;; END TEST

       ;; creating N threads to insert data into Riak


whitelist the attributes a user can edit

--- src/pc/http/datomic2.clj
+++ src/pc/http/datomic2.clj
@@ -1,4 +1,3 @@
-;; Hack to get around circular dependency
 (ns pc.http.datomic2
   (:require [clojure.core.async :as async]
             [clojure.tools.logging :as log]
@@ -35,9 +34,42 @@
     [type e a server-timestamp]
     transaction))

-;; TODO: teach the frontend how to lookup cust/name from cust/uuid
-(defn chat-cust-name? [[type e a v :as transaction]]
-  (= a :chat/cust-name))
+(def whitelist
+  #{:layer/name
+    :layer/uuid
+    :layer/type
+    :layer/start-x
+    :layer/start-y
+    :layer/end-x
+    :layer/end-y
+    :layer/rx
+    :layer/ry
+    :layer/stroke-width
+    :layer/stroke-color
+    :layer/opacity
+    :layer/start-sx
+    :layer/start-sy
+    :layer/fill
+    :layer/font-family
+    :layer/text
+    :layer/font-size
+    :layer/path
+    :layer/child
+    :layer/ui-id
+    :layer/ui-target
+    :session/uuid
+    :document/id ;; TODO: for layers use layer/document
+    :document/name
+    :document/privacy
+    :chat/body
+    :chat/color
+    :cust/uuid
+    :client/timestamp
+    :server/timestamp
+    :entity/type})
+
+(defn whitelisted? [[type e a v :as transaction]]
+  (contains? whitelist a))

 ;; TODO: only let creators mark things as private
 ;; TODO: only let people on the white list make things as private
@@ -67,7 +99,7 @@
                             (map (partial coerce-floats float-attrs))
                             (map (partial coerce-uuids uuid-attrs))
                             (map (partial coerce-server-timestamp server-timestamp))
-                            (remove chat-cust-name?)
+                            (filter whitelisted?)
                             (concat [(merge {:db/id txid :document/id document-id :session/uuid session-uuid}
                                             (when cust-uuid {:cust/uuid cust-uuid}))])
                             (d/transact conn)