Add trace id to tracing and compute-durations

--- src/com/wsscode/pathom/trace.cljc
+++ src/com/wsscode/pathom/trace.cljc
@@ -13,14 +13,28 @@
         ::timestamp (now)))))

 (defmacro tracing [env event & body]
-  `(do
-     (trace ~env (assoc ~event ::direction ::enter))
-     (let [res# (do ~@body)]
-       (trace ~env (assoc ~event ::direction ::leave))
-       res#)))
+  `(if (get ~env ::trace*)
+     (let [trace-id# (gensym "pathom-trace-")]
+       (trace ~env (assoc ~event ::direction ::enter ::id trace-id#))
+       (let [res# (do ~@body)]
+         (trace ~env {::direction ::leave ::id trace-id#})
+         res#))))

 (defn live-trace! [trace-atom]
   (add-watch trace-atom :live
     (fn [k r o n]
       (let [evt (peek n)]
         (print (str (pr-str [(::event evt) (dissoc evt ::event)]) "\n"))))))
+
+(defn compute-durations [trace]
+  (let [end-times
+        (into {} (comp (filter (comp #(identical? ::leave %) ::direction))
+                       (map (fn [{::keys [id timestamp]}] [id timestamp])))
+              trace)]
+    (into [] (comp (map (fn [e] (if-let [et (get end-times (::id e))]
+                                  (-> e
+                                      (assoc ::duration (- et (::timestamp e)))
+                                      (dissoc ::direction))
+                                  e)))
+                   (remove (fn [e] (identical? ::leave (::direction e)))))
+          trace)))


new way to connect MIDI devicesgs

new way to connect MIDI devicesgs

--- src/lights/my_show.clj
+++ src/lights/my_show.clj
@@ -262,25 +262,16 @@
     )
   )

-  (if (= interface "quneo")
-    (do
-      ; WIP. Right now this code forces cue into a loop and there is no way back. This cue works until stopped from web interface. After that is does not start anymore.
-      (cues/add-midi-control-to-cue-mapping "Bus 1" 0
-        :note 36 0 7 :use-velocity? true)
-      )
-    )
-
   (if (= interface "live")
     (do
       ; WIP. Right now this code forces cue into a loop and there is no way back. This cue works until stopped from web interface. After that is does not start anymore.
       (show/add-midi-control-to-var-mapping
         "Bus 1" 11 36 :front-1-note :max 255)
-      )

       (show/add-midi-control-to-var-mapping
           "Bus 1" 11 37 :main-adjust-hue :max 60)
         )
-    )
+  )

   (if (= interface "uno-clock")
     (show/sync-to-external-clock
@@ -294,6 +285,13 @@
     (show/sync-to-external-clock (afterglow.midi/sync-to-midi-clock "Traktor Virtual Output"))
   )
 )
+
+; Map Quneo MIDI controller, when it is connected
+(defn map-quneo
+  []
+  (cues/add-midi-control-to-cue-mapping "quneo" 0 :note 36 0 7)
+)
+(afterglow.midi/watch-for "quneo" map-quneo)

 ; Default settings
 (afterglow.show/set-variable! :sparkle-chance 0.1)


Remove unnecessary `recording` fn

Remove unnecessary `recording` fn

--- src/asciinema/player/source.cljs
+++ src/asciinema/player/source.cljs
@@ -248,17 +248,21 @@
   (change-speed [this speed]
     (put! @command-ch [:change-speed speed])))

-(defn recording [url start-at speed auto-play? loop? preload poster-time recording-fn]
-  (->Recording url start-at speed auto-play? loop? preload poster-time recording-fn (atom nil) (atom nil) (atom nil)))
-
-
 (defmethod make-source :asciicast [url {:keys [start-at speed auto-play loop preload poster-time]}]
-  (recording url start-at speed auto-play loop preload poster-time
-                   (fn [json]
-                     (-> json
-                         js/JSON.parse
-                         (js->clj :keywordize-keys true)
-                         initialize-asciicast))))
+  (->Recording url
+               start-at
+               speed auto-play
+               loop
+               preload
+               poster-time
+               (fn [json]
+                 (-> json
+                     js/JSON.parse
+                     (js->clj :keywordize-keys true)
+                     initialize-asciicast))
+               (atom nil)
+               (atom nil)
+               (atom nil)))

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


I added  :gen-class attribute to main.clj. Whithout this I got following message and could not run uberjar. > Warning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-clased.

--- src/clj/back_channeling/main.clj
+++ src/clj/back_channeling/main.clj
@@ -1,4 +1,5 @@
 (ns back-channeling.main
+  (:gen-class)
   (:require [com.stuartsierra.component :as component]
             [duct.middleware.errors :refer [wrap-hide-errors]]
             [duct.util.runtime :refer [add-shutdown-hook]]


Updated intro based on video series

Updated intro based on video series

--- src/clj/exploring_data/intro.clj
+++ src/clj/exploring_data/intro.clj
@@ -27,10 +27,10 @@

 (rest q)

-;; cons adds - note it doesn't change the symbol's value
-(cons 5 q)
+;; conj adds - note it doesn't change the symbol's value
+(conj q 5)

-(def q2 (cons 5 q))
+(def q2 (conj q 5))

 ;; Let's make a more interesting sequence
 (def numbers (seq [1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 2 3 1 2 3]))
@@ -61,20 +61,28 @@

 (reduce (fn [a b] (+ a b)) numbers)

-(frequencies numbers)
-
 ;; Predicate functions evaluate truth. Conventionally they end in a ?
 (defn divisible-by-3? [x]
   (= 0 (mod3 x)))

 (filter divisible-by-3? numbers)

-;; Add syntax for non-divisible
 (partition 4 numbers)

 (partition-by divisible-by-3? numbers)

 ;; Make more interesting sequences
+
+(def team-members ["Kevin" "Gary" "Roberto" "Allie" "Richard" "Liz" "Sebastian" "Cedric" "Jonathan"])
+(def pairs (->> (shuffle team-members)
+                (partition 2 2 (repeat nil))
+                (reverse)))
+
+(def team-of-three (->> (take 2 pairs)
+                        (apply concat)
+                        (filter (complement nil?))))
+
+(def teams (cons team-of-three (drop 2 pairs)))

 (let
     [pairs (reverse (partition 2 2 (repeat nil) (shuffle  team-members)))]


Adjusted door position on level 1.

Adjusted door position on level 1.

--- src/divergence/entity/levels.cljs
+++ src/divergence/entity/levels.cljs
@@ -71,8 +71,8 @@
   [(e/timestream)
    (e/player stage)
    ;(e/some-text stage)
-   (e/door 1320 430 stage)
-   (e/goal 1350 470 :key stage)
+   (e/door 1310 430 stage)
+   (e/goal 1340 470 :key stage)
    (e/starTilePrime -100 530 :s1 stage)
    (e/starTilePrime 0 430 :s2 stage)
    (e/starTilePrime 100 530 :s3 stage)


fixup

fixup

--- src/clj/freestuffly/notifier.clj
+++ src/clj/freestuffly/notifier.clj
@@ -34,7 +34,7 @@

 (defn send-email
   []
-  (let [credentials {:api-key (System/getenv "MAILGUN_API_KEY") :domain (System/getenv "YOUR_DOMAIN")}
+  (let [credentials {:api-key (System/getenv "MAILGUN_API_KEY") :domain (System/getenv "MAILGUN_DOMAIN")}
         params {
                 :from "emile@fierce-everglades-57947.herokuapp.com"
                 :to "emile.swarts123@gmail.com"


Also Rolodex.

Also Rolodex.

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -520,7 +520,8 @@
                                     :msg (msg "expose " (:title target))} card nil))}]}

    "Rolodex"
-   {:effect (req (prompt! state side card
+   {:msg "look at the top 5 cards of their Stack"
+    :effect (req (prompt! state side card
                           (str "Drag cards from the Temporary Zone  back onto your Stack") ["OK"] {})
                  (doseq [c (take 5 (:deck runner))] (move state side c :play-area)))}


Pass frame-count to fx shader

Pass frame-count to fx shader

--- src/cljc/robinson/animation.cljc
+++ src/cljc/robinson/animation.cljc
@@ -454,6 +454,7 @@
                           (zat/clear-fx! terminal)
                           (doseq [effect @effects]
                             (raat/apply-effect! effect terminal))
+                          (zat/assoc-fx-uniform! terminal "time" (swap! frame-count inc))
                           (zat/refresh! terminal)))
                       schedule-pool)))))

@@ -495,7 +496,7 @@
       (raat/update-palette! effect (fn [palette] new-palette)))))

 (defn reset-state! [terminal new-state]
-  {:pre [(get new-state :fx)]}
+  ;{:pre [(get new-state :fx)]}
   (raat/swap-matching-effect-or-filter!
     terminal
     (fn [fx] (instance? ARequiresState fx))


Fix and update state-tracker

Fix and update state-tracker

--- src/cljs/hacker_agent/debug.cljs
+++ src/cljs/hacker_agent/debug.cljs
@@ -66,12 +66,13 @@
 (defonce track-history? (atom true))

 (defn init-state-tracker! [state]
-  (swap! state-history conj @state)
+  (reset! state-history [[(t/now) @state]])
   (go-loop []
-    (<! (async/timeout 1000))
+    (<! (async/timeout 100))
     (when (and @track-history?
-               (not (= (last @state-history) @state)))
-      (swap! state-history conj @state))
+               (not (= (second (last @state-history))
+                       @state)))
+      (swap! state-history conj [(t/now) @state]))
     (recur)))

 (defn slider-atom [state history]


Assertion works for arrays, too.

Assertion works for arrays, too.

--- src/clojure/assert_json/core.clj
+++ src/clojure/assert_json/core.clj
@@ -10,12 +10,17 @@
   [m key]
   (get m key ::nothing-here))

+(defn- same-type?
+  [a b]
+  (or (= (type b) (type b))
+      (and (isa? a java.util.List) (isa? b java.util.List))))
+
 (defn assert-property
   "Assert that the map `m` contains the given `property` with the desired `value` and type."
   [m property value]
   (let [m-val (get-key m property)]
     (cond (= ::nothing-here m-val) (throw (property-not-found property))
-          (not= (type m-val) (type value)) (throw (wrong-property-type property m-val value))
+          (not (same-type? m-val value)) (throw (wrong-property-type property m-val value))
           (not= value m-val) (throw (wrong-property-value property m-val value))
           :default true)))


Only show element options tabs when more than one option is available.

--- frontend/src/uxbox/main/ui/workspace/sidebar/options.cljs
+++ frontend/src/uxbox/main/ui/workspace/sidebar/options.cljs
@@ -100,14 +100,15 @@
         contained-in? (into #{} menus)
         active (:menu @local (first menus))]
     [:div
-     [:ul.element-icons
-      (for [menu-id (get +menus-map+ (:type shape ::page))
-            :let [menu (get +menus-by-id+ menu-id)
-                  selected? (= active menu-id)]]
-        [:li#e-info {:on-click #(swap! local assoc :menu menu-id)
-                     :key (str "menu-" (:id menu))
-                     :class (when selected? "selected")}
-         (:icon menu)])]
+     (when (> (count menus) 1)
+       [:ul.element-icons
+        (for [menu-id (get +menus-map+ (:type shape ::page))
+              :let [menu (get +menus-by-id+ menu-id)
+                    selected? (= active menu-id)]]
+          [:li#e-info {:on-click #(swap! local assoc :menu menu-id)
+                       :key (str "menu-" (:id menu))
+                       :class (when selected? "selected")}
+           (:icon menu)])])
      (when-let [menu (get +menus-by-id+ active)]
        ((:comp menu) menu shape))]))


Remove path from example

Remove path from example

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -397,8 +397,7 @@
    Is turned into:

    {:query {:item :com.wsscode.pathom/reader-error
-            :com.wsscode.pathom.core/errors {:item {:error \"some error\"
-                                                    :path [:query :item]}}}
+            :com.wsscode.pathom.core/errors {:item {:error \"some error\"}}}

    This makes easier to reach for the error when rendering the UI."
   (reduce


Fix optimization spiting more data than requested

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -413,7 +413,9 @@
        :else
        (parser env' query)))))

-(defn join-seq-parallel [{:keys [query] :as env} coll]
+(defn join-seq-parallel [{:keys  [query]
+                          ::keys [entity-path-cache]
+                          :as    env} coll]
   (if (seq coll)
     (go-catch
       (pt/tracing env {::pt/event ::parallel-sequence-loop
@@ -426,10 +428,10 @@
                                      check-ast-opt?
                                      (reduce
                                        (fn [ent {:keys [key]}]
-                                         (if (contains? ent key)
-                                           ent
+                                         (if-let [[_ v] (find entity key)]
+                                           (assoc ent key v)
                                            (reduced nil)))
-                                       entity
+                                       {}
                                        (:children ast)))
                                    (join entity env)))
               env            (assoc env ::processing-sequence coll)
@@ -442,7 +444,9 @@
             out-chan
             (fn join-seq-pipeline [[ent i] res-ch]
               (go
-                (let [res (<!maybe (join-item (update env ::path conj (inc i)) ent))]
+                (let [{::keys [path] :as env'} (update env ::path conj (inc i))
+                      ent (merge (get @entity-path-cache path {}) ent)
+                      res (<!maybe (join-item env' ent))]
                   (>! res-ch res)
                   (async/close! res-ch))))
             from-chan)


summary of all sports

summary of all sports

--- src/ontrail/weekly.clj
+++ src/ontrail/weekly.clj
@@ -57,19 +57,30 @@
     (kw coll)
     0))

-(defn accumulate [kw totals result]
-  {:sport kw :distance (+ (:distance totals) (get-entry result :distance))
+(defn accumulate [sport totals result]
+  {:sport sport :distance (+ (:distance totals) (get-entry result :distance))
    :duration (+ (:duration totals) (get-entry result :duration))})
+
+(defn accumulate-if-sport-is [sport totals result]
+  (if (= sport (:sport result))
+    (accumulate sport totals result)
+    totals))

 (defn humanize [coll]
   (assoc coll :distance (to-human-distance (:distance coll)) :duration (to-human-time (:duration coll))))

+(defn zero-result[sport] {:sport sport :distance 0 :duration 0})
+
+(defn summary-distinct-sports [results]
+  (let [sports-distinct (distinct (map :sport results))]
+    (map humanize (sort-by :duration >
+                           (for [sport sports-distinct]
+                             (reduce (partial accumulate-if-sport-is sport) (cons (zero-result sport) results)))))))
+
 (defn weekly-sums [results]
-  (if (>= (count results) 1)
-    (let [kw-all (keyword "Kaikki")
-          all (humanize (reduce (partial accumulate kw-all) (cons {:sport kw-all :distance 0 :duration 0} results)))]
-      (cons all []))
-    [{}]))
+  (let [sport-all "Kaikki"
+        summary-all (humanize (reduce (partial accumulate sport-all) (cons (zero-result sport-all) results)))]
+    (cons summary-all (summary-distinct-sports results))))

 (defn interval-as-exlist [user week-interval]
     (let [start (.getStart week-interval) end (.getEnd week-interval)


Further refinement of the validators

Further refinement of the validators

--- src/parmenides/ocd.clj
+++ src/parmenides/ocd.clj
@@ -29,7 +29,8 @@
                  '({:tag :nt, :keyword :date}
                    {:tag :opt,
                     :parser {:tag :cat, :parsers
-                             ({:tag :string, :string " "} {:tag :nt, :keyword :time})}})})
+                             ({:tag :string, :string " "}
+                              {:tag :nt, :keyword :time})}})})
       (assoc :start-production :ocd-underspecified)))

 (def date? (comp not insta/failure? date-parser))
@@ -39,12 +40,15 @@

 (declare Organization Bill Vote Person Event Post Jurisdiction)

+(def Image (s/either sc/URI (s/enum "") sc/URI-Reference s/Str))
+
 (def Organization
   {(s/required-key "name") s/Str
    (s/required-key "id") (Id "organization")

-   (s/optional-key "image") s/Str
-   (s/optional-key "classification") s/Str
+   (s/optional-key "image") Image
+   (s/optional-key "classification")
+   (s/enum "party" "committee" "lower" "upper" "legislature" "executive")
    (s/optional-key "jurisdiction") (s/maybe (s/recursive #'Jurisdiction))
    (s/optional-key "parent") (s/maybe (s/recursive #'Organization))})

@@ -59,7 +63,8 @@
    (s/optional-key "classification")
    [(s/enum "bill" "resolution" "concurrent resolution" "joint resolution"
             "memorial" "proposed bill" "contract" "appropriation"
-            "constitutional amendment" "nomination" "appointment" "commemoration")]})
+            "constitutional amendment" "nomination" "appointment" "commemoration"
+            "joint memorial")]})

 (def Vote
   {(s/required-key "id") (Id "vote")
@@ -86,6 +91,7 @@
   {(s/required-key "id") (Id "jurisdiction")

    (s/optional-key "name") s/Str
+
    (s/optional-key "classification")
    (s/enum "government" "legislature" "executive" "school" "park" "sewer" "forest" "transit")})

@@ -98,7 +104,7 @@
 (def Person
   {(s/required-key "gender") (s/enum "" "Male" "Female")
    (s/required-key "id") (Id "person")
-   (s/required-key "image") s/Str
+   (s/required-key "image") Image
    (s/required-key "memberships") [{(s/required-key "organization") (s/recursive #'Organization)
                                     (s/required-key "post") (s/maybe (s/recursive #'Post))}]
    (s/required-key "sort_name") s/Str
@@ -106,9 +112,9 @@

 (def Event
   {(s/required-key "description") s/Str
-   (s/required-key "timezone") s/Str
+   (s/required-key "timezone") s/Str ;;todo check for timezones?
    (s/required-key "name") s/Str
-   (s/required-key "start_time")  Date
+   (s/required-key "start_time") Date

    (s/required-key "classification")
    (s/enum "committee-meeting" "hearings" "floor_time" "redistricting" "special"
@@ -121,7 +127,12 @@
    (s/required-key "end_time") (s/maybe s/Str)
    (s/required-key "agenda") [{(s/required-key "description") s/Str
                                (s/required-key "order") s/Str
-                               (s/required-key "related_entities") s/Any ;;Is entity an abstract type?
+                               (s/required-key "related_entities")
+                               [{(s/required-key "note") (s/maybe s/Str)
+                                 (s/required-key "entity_type")
+                                 (s/enum "bill" "organization" "person")
+                                 (s/required-key "entity_id") (s/maybe (Id "")) ;;Hack
+                                 (s/required-key "entity_name") s/Str}]
                                (s/required-key "subjects") []}]
    (s/required-key "all_day") s/Bool
    (s/required-key "status") (s/enum "confirmed")


replaced accidentally deleted fn

replaced accidentally deleted fn

--- src/dynamodb_expression/core.clj
+++ src/dynamodb_expression/core.clj
@@ -1,5 +1,8 @@
 (ns dynamodb-expression.core
   (:require [clojure.string :as st]))
+
+(defn sanitize-placeholder [ph]
+  (st/replace ph #"[^0-9a-zA-Z_]" "_"))

 (defn update-expr []
   {:ops []})


not sure how this ever worked

not sure how this ever worked

--- src/leiningen/compile_native.clj
+++ src/leiningen/compile_native.clj
@@ -64,7 +64,7 @@
     (fix-install-path os src "jtokyocabinet")
     (make src)
     (make src "install")
-    (let [jar (file target "lib" "tokyocabinet.jar")]
+    (let [jar (file target "tokyocabinet" "tokyocabinet.jar")]
       (copy-entries jar (file "resources")
                     #(.endsWith (str %) ".class"))
       (fs/delete jar))))


Fix the input args spec for workflo.macros.bind/simplified-name

--- src/main/workflo/macros/bind.clj
+++ src/main/workflo/macros/bind.clj
@@ -67,8 +67,8 @@
                (s/valid? ::sq/query query) q/conform-and-parse)))

 (s/fdef simplified-name
-  :args (s/cat :sym-or-kw (s/or :sym symbol?
-                                :kw keyword?))
+  :args (s/cat :sym-or-kw (s/or :sym (s/and symbol? #(not= "." (name %)))
+                                :kw (s/and keyword? #(not= "." (name %)))))
   :ret string?)

 (defn simplified-name


No longer need to clean up reminders when deleting all orgs.

--- src/oc/storage/resources/org.clj
+++ src/oc/storage/resources/org.clj
@@ -274,8 +274,7 @@
   "Use with caution! Failure can result in partial deletes. Returns `true` if successful."
   [conn]
   {:pre [(db-common/conn? conn)]}
-  ;; Delete all reminders, interactions, entries, boards and orgs
-  (db-common/delete-all-resources! conn "reminders")
+  ;; Delete all interactions, entries, boards and orgs
   (db-common/delete-all-resources! conn common/interaction-table-name)
   (db-common/delete-all-resources! conn common/entry-table-name)
   (db-common/delete-all-resources! conn common/board-table-name)


font-size adjust command

font-size adjust command

--- re_view_prosemirror/src/re_view_prosemirror/commands.cljs
+++ re_view_prosemirror/src/re_view_prosemirror/commands.cljs
@@ -147,14 +147,15 @@
 (defn adjust-font-size [f state dispatch]
   (let [node (pm/cursor-node state)]
     (when-let [heading-level (condp = (.-type node)
-                               (pm/get-node state :paragraph) 7
-                               (pm/get-node state :heading) (.-level (.-attrs node))
+                               (pm/get-node state :paragraph) 4
+                               (pm/get-node state :heading) (let [level (.-level (.-attrs node))]
+                                                              (cond-> level
+                                                                      (>= level 4) (inc)))
                                :else nil)]
-      (let [target-index (min (f heading-level) 6)]
-        (when-not (> target-index 7)
-          ((if (= 7 target-index)
-             (pm/set-block-type :paragraph)
-             (pm/set-block-type :heading #js {:level target-index})) state dispatch))))))
+      (let [target-index (min (f heading-level) 7)]
+        ((cond (<= target-index 3) (pm/set-block-type :heading #js {:level target-index})
+               (= target-index 4) (pm/set-block-type :paragraph)
+               :else (pm/set-block-type :heading #js {:level (dec target-index)})) state dispatch)))))

 (defn clear-stored-marks [state dispatch]
   (dispatch (reduce (fn [tr mark]


Cast must happen inline.

Cast must happen inline.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -331,8 +331,7 @@

 (defn deserializable-exception [^Throwable throwable]
   (let [{:keys [data trace]} (Throwable->map throwable)
-        data (assoc data :original-exception (keyword (.getName (.getClass throwable))))
-        t ^Throwable (ex-info (.getMessage throwable) data)]
+        data (assoc data :original-exception (keyword (.getName (.getClass throwable))))]
     ;; First element may either be a StackTraceElement or a vector
     ;; of 4 elements, those of which construct a STE.
     (if (sequential? (first trace))
@@ -342,8 +341,10 @@
                        (nth % 2)
                        (nth % 3))
                      trace)]
-        (.setStackTrace t (into-array StackTraceElement ste)))
-      (.setStackTrace t (into-array StackTraceElement trace)))))
+        (doto ^Throwable (ex-info (.getMessage throwable) data)
+          (.setStackTrace (into-array StackTraceElement ste))))
+      (doto ^Throwable (ex-info (.getMessage throwable) data)
+        (.setStackTrace (into-array StackTraceElement trace))))))

 (defn handle-exception [task-info log e group-ch outbox-ch id job-id]
   (let [data (ex-data e)


Reduce use of assoc-in

Reduce use of assoc-in

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -167,11 +167,13 @@
           ;(println "Writing state checkpoint " replica-version epoch (mapv ws/state windows-state))
           (when-not (empty? (:windows event))
             (extensions/write-checkpoint log job-id replica-version epoch task-id slot-id :state (mapv ws/state (:windows-state state))))
-          (cond-> (assoc-in event [:state :messenger] new-messenger)
-            (= :input task-type)
-            (assoc-in [:state :barriers replica-version epoch]
-                      {:checkpoint (oi/checkpoint (:pipeline state))
-                       :completed? (oi/completed? (:pipeline state))})))
+          (assoc event
+                 :state
+                 (cond-> (assoc state :messenger new-messenger)
+                   (= :input task-type)
+                   (assoc-in [:barriers replica-version epoch]
+                             {:checkpoint (oi/checkpoint (:pipeline state))
+                              :completed? (oi/completed? (:pipeline state))}))))
         event))

 (defn ack-barriers [{:keys [task-type state] :as event}]
@@ -232,9 +234,11 @@
                (when (:completed? barrier)
                  (complete-job event)
                  (backoff-when-drained! event))
-               (-> event
-                   (assoc-in [:state :barriers] (dissoc-in barriers [replica-version epoch]))
-                   (assoc-in [:state :messenger] (m/flush-acks new-messenger)))))
+               (assoc event
+                      :state
+                      (-> state
+                          (update :barriers dissoc-in [replica-version epoch])
+                          (assoc :messenger (m/flush-acks new-messenger))))))
             ;; Maybe shouldn't have flush-acks here
             (assoc-in event [:state :messenger] (m/flush-acks new-messenger))))
         (assoc-in event [:state :messenger] new-messenger)))


fixing docstring locations, adding basic impls, adding TODOs

--- src/org/almibe/ligature/core.clj
+++ src/org/almibe/ligature/core.clj
@@ -1,12 +1,14 @@
 (ns org.almibe.ligature.core)

 (defprotocol LigatureStore
+  "A Store manages many named Datasets."
   (get-dataset [this dateset-name])
   (delete-dataset [this dateset-name])
   (all-datasets [this])
   (close [this]))

 (defprotocol LigatureDataset
+  "A Dataset manages a collection of Statements and supports ontologies and querying."
   (add-statements [this statements]) ; accepts a seq of statement tuples
   (remove-statements [this statements]) ; accepts a seq of statement tuples
   (all-statements [this]) ; accepts nothing but returns a seq
@@ -17,36 +19,61 @@
   (sparql-query [this query])
   (wander-query [this query]))

-(defn blank-node? [blank-node]
+(defn blank-node?
   "Accepts a String representing a Blank Node and returns true or false depending on if it is valid."
-  )
+  [blank-node]
+  (throw (RuntimeException. "TODO")))

-(defn iri? [iri]
+(defn iri?
   "Accepts a String representing an iri and returns true or false depending on if it is valid."
+  [iri]
+  (throw (RuntimeException. "TODO")))

-  )
+(defn string-literal?
+  "Accepts a String and returns if it is a valid string literal."
+  [literal]
+  (string? literal))

-(defn subject? [subject]
+(defn lang-literal?
+  "Accepts a Map and returns true or false depending on if it is a valid lang literal.
+  A lang literal should contain a :value key with a valid string literal and a :lang key with a valid lang code."
+  [literal]
+  (throw (RuntimeException. "TODO")))
+
+(defn typed-literal?
+  "Accepts a Map and returns true or false depending on if it is a valid typed literal.
+  A typed literal should contain a :valud key with a valid string literal and a :type key with a valid IRI."
+  [literal]
+  (throw (RuntimeException. "TODO")))
+
+(defn literal?
+  "Accepts a String or Map representing a literal and returns true or false depending on if it is valid."
+  [literal]
+  (or (string-literal? literal) (lang-literal? literal) (typed-literal? literal)))
+
+(defn subject?
   "Accepts a String representing a subject and returns true or false depending of
   whether or not that String is a valid IRI or Blank Node"
+  [subject]
   (or (iri? subject) (blank-node? subject)))

-(defn predicate? [])
+(defn predicate? [predicate]
+  "Accepts a String representing a predicate and returns true or false depending on if it is valid."
+  (iri? predicate))

-(defn object? [])
+(defn object? [object]
+  "Accepts a String or Map representing an object and returns true or false depending on if it is valid."
+  (or (iri? object) (blank-node? object) (literal? object)))

-
-
-(defn literal? [])
-
-(defn lang-literal? [])
-
-(defn typed-literal? [])
-
-(defn statement? [])
+(defn statement?
+  "Accepts a Map and returns true or false depending on if it is a valid Statement.
+  A valid Statement contains a :subject, :predicate, :object, and optionally a :graph key with valid values."
+  [statement]
+  (throw (RuntimeException. "TODO")))

 (defn statement
-  ([subject predicate object] (statement subject predicate object nil))
-  ([subject predicate object graph] :a))
-
-
+  "This function acts as a helper function for creating Statement maps."
+  ([subject predicate object]
+   {:subject subject :predicate predicate :object object})
+  ([subject predicate object graph]
+    {:subject subject :predicate predicate :object object :graph graph}))


Add markov-loop

Add markov-loop

--- src/overtone_workspace/beats.clj
+++ src/overtone_workspace/beats.clj
@@ -1,9 +1,7 @@
 (ns overtone-workspace.beats
   (:use [overtone.live]
-        [overtone-workspace sequencer]
-        [overtone-workspace ambi-rand]
+        [overtone-workspace sequencer ambi-rand]
         [overtone-workspace.synth grumbles laserbeam latchbell]))
-

 (def kick (sample "resources/kick.wav"))
 ;; (kick)
@@ -30,15 +28,47 @@
   (let [idx (Math/floor (* x (count logistics-scale)))
         note (nth logistics-scale idx)
         freq (midi->hz note)
-        dur (* 2/8 (/ 60.0 (metro :bpm)))
+        dur (* (rand) 4/8 (/ 60.0 (metro :bpm)))
         next-beat (+ 2/8 beat)
         next-x (* logistics-r x (- 1 x))] ;; x = r * x * (1 - x)
     (if (< 0 (rand-int 3))
       (at (metro beat)
-          (fmchord01 :freq freq :dur dur :amp 1)))
+          (fmchord01 :freq freq :dur dur :amp (+ 4 (rand 2)))))
     (apply-by (metro next-beat) #'logistics-loop [metro next-beat next-x])))
-
 ;; (logistics-loop sequencer-metro (sequencer-metro) 0.1)
+;; (stop)
+
+(def chord-chain-dict {:I   [:ii :iii :IV :V :vi :vii]
+                       :ii  [:V :vii]
+                       :iii [:IV :vi]
+                       :IV  [:ii :V :vii]
+                       :V   [:vi :I]
+                       :vi  [:ii :IV :V]
+                       :vii [:I]
+                       })
+(def MAJORDEGREE {:I     :i
+                  :II    :ii
+                  :III   :iii
+                  :IV    :iv
+                  :V     :v
+                  :VI    :vi
+                  :VII   :vii
+                  :_     nil})
+(defn markov-loop [metro beat dict deg]
+  (let [mi (deg DEGREE)
+        sc (if mi :minor :major)
+        d (if mi deg (deg MAJORDEGREE))
+        notes (chord-degree d :C3 sc)
+        dur (+ 12/8 (* (rand) 12/8 (/ 60.0 (metro :bpm))))
+        next-beat (+ 12/8 beat)
+        next-deg (choose (deg dict))]
+    (at (metro beat)
+        (doseq [n notes]
+          (let [freq (midi->hz n)]
+            (fmchord01 :freq freq :dur dur :amp 0.4))))
+    (apply-by (metro next-beat) #'markov-loop [metro next-beat dict next-deg])))
+;; (markov-loop sequencer-metro (sequencer-metro) chord-chain-dict :I)
+;; (chord-degree :i :c4 :major)
 ;; (stop)

 (volume (/ 25 127))
@@ -75,10 +105,10 @@
   (inst-fx! laserbeam fx-chorus)
   (clear-fx laserbeam))

-
 (def _ 0)
 (def beats {laserbeam [1 _ _ _ _ _ _ 1 _ _ 1 _ _ _ _ 1]
-            latchbell [1 _ 1 _ 1 _ 1 _ 1 _ 1 _ 1 _ _ 1]})
+            ;;latchbell [1 _ 1 _ 1 _ 1 _ 1 _ 1 _ 1 _ _ 1]
+            })
 ;; (def beats {laserbeam [1 _ _ _ _ _ _ 1 _ _ 1 _ _ _ _ 1]})
 (def *beats (atom beats))

@@ -108,7 +138,7 @@

   (init-latchbell-mod (:rate @latchbell-arg))
   (swap! *beats assoc laserbeam [d _ _ [d d] (vec (repeat 64 0.8)) _ _ d _ _ d _ b _ _ [d d d]])
-  (swap! *beats assoc laserbeam [_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _])
+  (swap! *beats assoc laserbeam [_])
   (swap! *beats assoc latchbell [a _ a _ a _ a _ a _ a _ a _ a _])
   (swap! *beats assoc latchbell [_])
   (swap! *beats assoc laserbeam [d _ _ _ b _ _ d _ _ d _ b _ _ d])
@@ -116,10 +146,12 @@
   (swap! *beats assoc grumble [g _ _ _ _ _ _ _ _  _ _ _ _ _ _ _])
   (swap! *beats assoc kick [[1 _ _ [1 1]] [_ _ _ 1] [_ _ 1 _] [_ _ _ [1 1 1]]])
   (swap! *beats assoc kick [_])
+  (swap! *beats dissoc kick)
   (stop-live-sequencer "beats")

   (reset! *beats beats)
   (stop))
+;;(volume 1.0)

 (defn rand-laser []
   (let [dur (/ 60.0 (sequencer-metro :bpm))]
@@ -129,7 +161,7 @@
 (init-latchbell-mod (:rate @latchbell-arg))
 (defn rand-latchbell []
   (let [dur (/ 60.0 (sequencer-metro :bpm))]
-        (latchbell :rate (:rate @latchbell-arg) :amp (:amp @latchbell-arg) :time-scale-max (:max @latchbell-arg))))
+    (latchbell :rate (:rate @latchbell-arg) :amp (:amp @latchbell-arg) :time-scale-max (:max @latchbell-arg))))

 (def fn-beats {ambi-rand [_]
                ;;ambi-rand (vec (repeat 16 1))


start orbit slides

start orbit slides

--- src/solar_system_of_js/core.cljs
+++ src/solar_system_of_js/core.cljs
@@ -56,6 +56,24 @@
             :typescript {:alpha 0}
             :soundscript {:alpha 0}
             :flow {:alpha 0}}
+   :coffeescript {:alpha 0
+                  :angle 0
+                  :radar {:alpha 0
+                          :offset 0}
+                  :r 900
+                  }
+   :dart {:alpha 0
+          :angle 0
+          :radar {:alpha 0
+                  :offset 0}
+          :r 1400
+                  }
+   :clojurescript {:alpha 0
+                   :angle 0
+                   :radar {:alpha 0
+                           :offset 0}
+                   :r 1900
+                  }
    })

 ;; Current state of the application.
@@ -399,6 +417,26 @@

     (restore!)))

+(defn draw-orbit!
+  [opts]
+  )
+
+(defn draw-radar!
+  [opts]
+  )
+
+(defn draw-coffeescript!
+  [opts]
+  )
+
+(defn draw-dart!
+  [opts]
+  )
+
+(defn draw-clojurescript!
+  [opts]
+  )
+
 ;;--------------------------------------------------------------------------------
 ;; Drawing
 ;;--------------------------------------------------------------------------------
@@ -431,6 +469,10 @@
   (draw-static! (:static @state))

   (draw-js-face! (:js-face @state))
+
+  (draw-coffeescript! (:coffeescript @state))
+  (draw-dart! (:dart @state))
+  (draw-clojurescript! (:clojurescript @state))

   (restore!))
@@ -637,6 +679,7 @@
               {:a :_ :b 1 :duration 1} [:static :sphere :alpha]
               {:a :_ :b 400 :duration 1} [:static :sphere :r])))

+     ;; show static language titles
      (let [angle (/ (* 2 PI) 3) ;; arc angle
            low 0.2]             ;; alpha of faded out title
        [;; show typescript
@@ -662,6 +705,37 @@
                  {:a :_ :b 1 :duration 1} [:static :soundscript :alpha]
                  {:a :_ :b (* 3 angle) :duration 1} [:static :sphere :angle]
                  )))])
+
+     ;; fade out staticsphere details
+     #(go
+        (<! (multi-animate!
+              {:a :_ :b 0 :duration 1} [:static :typescript :alpha]
+              {:a :_ :b 0 :duration 1} [:static :flow :alpha]
+              {:a :_ :b 0 :duration 1} [:static :soundscript :alpha]
+              {:a :_ :b 0 :duration 1} [:cam :x]
+              {:a :_ :b 0 :duration 1} [:static :sphere :angle]
+              {:a :_ :b 0 :duration 1} [:static :title :alpha]
+              {:a :_ :b 0.2 :duration 2} [:cam :zoom]
+              )))
+
+     ;; show coffeescript
+     #(go
+        (swap! state assoc :enable-orbits true)
+        (<! (multi-animate!
+              {:a :_ :b 1 :duration 1} [:coffeescript :alpha]
+              )))
+
+     ;; show dart
+     #(go
+        (<! (multi-animate!
+              {:a :_ :b 1 :duration 1} [:dart :alpha]
+              {:a :_ :b 0.1 :duration 1} [:cam :zoom])))
+
+     ;; show clojurescript
+     #(go
+        (<! (multi-animate!
+              {:a :_ :b 1 :duration 1} [:clojurescript :alpha]
+              {:a :_ :b 0.05 :duration 1} [:cam :zoom])))

      ])))

@@ -705,6 +779,13 @@
     (when-let [s (get @slide-states (dec (:slide @state)))]
       (reset! state s))))

+(defn skip-slide!
+  "Go to next slide skipping transitions if we can."
+  []
+  (when-not @in-transition?
+    (when-let [s (get @slide-states (inc (:slide @state)))]
+      (reset! state s))))
+
 (def key-names
   {37 :left
    38 :up
@@ -722,7 +803,9 @@
                (prev-slide!)
                (.preventDefault e))
       :right (do
-               (next-slide!)
+               (if shift
+                 (skip-slide!)
+                 (next-slide!))
                (.preventDefault e))
       nil)))


#28 give up fixing tracker

#28 give up fixing tracker

--- src/tamaki_core/file/tracker.clj
+++ src/tamaki_core/file/tracker.clj
@@ -1,10 +1,10 @@
 (ns tamaki-core.file.tracker
   (:require [clojure.java.io :as io]
             [clojure.data :as data]
-            [kalar-core.config :as config])                 ; FIXME
+            [tamaki-core.config :as config])
   (:import (clojure.lang PersistentList)))

-
+; FIXME

 (defn- create-modtime-map [^String directory]
   (letfn
@@ -23,9 +23,6 @@
        )]
     (get-child-map (io/file directory))))

-  (comment ([^PersistentList lst]
-   (let [a (reduce #(merge %1 %2) {} (for [l lst](create-modtime-map l)))]
-     a)))

 (defn- find-removed [old current]
   (keys (first (data/diff old current))))


Output test.

Output test.

--- test/onyx/plugin/output_test.clj
+++ test/onyx/plugin/output_test.clj
@@ -1,9 +1,34 @@
 (ns onyx.plugin.output-test
   (:require [midje.sweet :refer :all]
+            [com.stuartsierra.component :as component]
             [datomic.api :as d]
             [onyx.plugin.datomic]
             [onyx.queue.hornetq-utils :as hq-utils]
+            [onyx.system :refer [onyx-development-env]]
             [onyx.api]))
+
+(def id (java.util.UUID/randomUUID))
+
+(def env-config
+  {:hornetq/mode :vm
+   :hornetq/server? true
+   :hornetq.server/type :vm
+   :zookeeper/address "127.0.0.1:2185"
+   :zookeeper/server? true
+   :zookeeper.server/port 2185
+   :onyx/id id})
+
+(def peer-config
+  {:hornetq/mode :vm
+   :zookeeper/address "127.0.0.1:2185"
+   :onyx/id id
+   :onyx.peer/inbox-capacity 100
+   :onyx.peer/outbox-capacity 100
+   :onyx.peer/job-scheduler :onyx.job-scheduler/round-robin})
+
+(def dev (onyx-development-env env-config))
+
+(def env (component/start dev))

 (def db-uri (str "datomic:mem://" (java.util.UUID/randomUUID)))

@@ -47,26 +72,10 @@

 (hq-utils/write-and-cap! hq-config in-queue people 1)

-(def id (str (java.util.UUID/randomUUID)))
-
-(def coord-opts {:hornetq/mode :vm
-                 :hornetq/server? true
-                 :hornetq.server/type :vm
-                 :zookeeper/address "127.0.0.1:2185"
-                 :zookeeper/server? true
-                 :zookeeper.server/port 2185
-                 :onyx/id id
-                 :onyx.coordinator/revoke-delay 5000})
-
-(def peer-opts
-  {:hornetq/mode :vm
-   :zookeeper/address "127.0.0.1:2185"
-   :onyx/id id})
-
-(def workflow {:input {:to-datom :output}})
+(def workflow {:in {:to-datom :out}})

 (def catalog
-  [{:onyx/name :input
+  [{:onyx/name :in
     :onyx/ident :hornetq/read-segments
     :onyx/type :input
     :onyx/medium :hornetq
@@ -74,15 +83,15 @@
     :hornetq/queue-name in-queue
     :hornetq/host hornetq-host
     :hornetq/port hornetq-port
-    :hornetq/batch-size 2}
+    :onyx/batch-size 2}

    {:onyx/name :to-datom
     :onyx/fn :onyx.plugin.output-test/to-datom
-    :onyx/type :transformer
+    :onyx/type :function
     :onyx/consumption :concurrent
     :onyx/batch-size 2}

-   {:onyx/name :output
+   {:onyx/name :out
     :onyx/ident :datomic/commit-tx
     :onyx/type :output
     :onyx/medium :datomic
@@ -95,11 +104,12 @@
   {:datoms [{:db/id (d/tempid :com.mdrogalis/people)
              :user/name name}]})

-(def conn (onyx.api/connect :memory coord-opts))
+(def v-peers (onyx.api/start-peers! 1 peer-config))

-(def v-peers (onyx.api/start-peers conn 1 peer-opts))
-
-(onyx.api/submit-job conn {:catalog catalog :workflow workflow})
+(onyx.api/submit-job
+ peer-config
+ {:catalog catalog :workflow workflow
+  :task-scheduler :onyx.task-scheduler/round-robin})

 (doseq [_ (range (count people))]
   (.take tx-queue))
@@ -109,7 +119,7 @@
 (doseq [v-peer v-peers]
   ((:shutdown-fn v-peer)))

-(onyx.api/shutdown conn)
+(component/stop env)

 (fact (set results) => (set (map :name people)))


Factor out grammar generator as own def.

--- test/smallex/test/generators.clj
+++ test/smallex/test/generators.clj
@@ -156,8 +156,7 @@
                            (for [[k v p] (mapv conj (shuffle (vec m)) (range))]
                              [k (vary-meta v assoc :priority p)])))))))

-
-(deftest ^:examples test-grammar-generation
+(def grammar
   (->>
    (gen/bind (gen/sized aliases)
              (fn [alias-defs]
@@ -167,6 +166,8 @@
                {:aliases (into {}
                                (for [[k v] aliases]
                                  [(:value k) v]))
-                :rules rules}))
-   gen/sample
-   ppm))
+                :rules rules}))))
+
+
+(deftest ^:examples test-grammar-generation
+  (ppm (gen/sample grammar)))


updated for new tupelo.core/matches? definition

--- test/tst/tupelo_datomic/core.clj
+++ test/tst/tupelo_datomic/core.clj
@@ -88,143 +88,120 @@

   (testing "types"
     (is (thrown? Exception (td/new-attribute :some-attr :db.type/bogus)))
-    (let [result  (td/new-attribute :location :db.type/string) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/string       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/keyword) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/keyword       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/boolean) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/boolean       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/long) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/long       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/bigint) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/bigint       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/float) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/float       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/double) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/double       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/bigdec) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/bigdec       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/bytes) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/bytes       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/instant) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/instant       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/uuid) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/uuid       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/uri) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/uri       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/ref) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/ref       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } ))))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/string       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                  (td/new-attribute :location :db.type/string)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/keyword       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                  (td/new-attribute :location :db.type/keyword)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/boolean       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                  (td/new-attribute :location :db.type/boolean)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/long       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                  (td/new-attribute :location :db.type/long)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/bigint       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/bigint)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/float       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/float)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/double       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/double)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/bigdec       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/bigdec)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/bytes       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/bytes)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/instant       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/instant)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/uuid       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/uuid)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/uri       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/uri)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/ref       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/ref))))

   (testing "cardinality & unique"
-    (let [result  (td/new-attribute :location :db.type/string) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/string       :db/cardinality :db.cardinality/one
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/string :db.cardinality/many) ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/string       :db/cardinality :db.cardinality/many
-               :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/string :db.unique/value)  ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/string       :db/cardinality :db.cardinality/one
-               :db/unique       :db.unique/value      :db.install/_attribute :db.part/db } )))
-    (let [result  (td/new-attribute :location :db.type/string :db.unique/identity)  ]
-      (is (matches? result
-              {:db/id           _                     :db/ident       :location
-               :db/valueType    :db.type/string       :db/cardinality :db.cardinality/one
-               :db/unique       :db.unique/identity   :db.install/_attribute :db.part/db } ))))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/string       :db/cardinality :db.cardinality/one
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/string)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/string       :db/cardinality :db.cardinality/many
+                   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/string :db.cardinality/many)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/string       :db/cardinality :db.cardinality/one
+                   :db/unique       :db.unique/value      :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/string :db.unique/value)))
+    (is (matches? {:db/id           _                     :db/ident       :location
+                   :db/valueType    :db.type/string       :db/cardinality :db.cardinality/one
+                   :db/unique       :db.unique/identity   :db.install/_attribute :db.part/db }
+                 (td/new-attribute :location :db.type/string :db.unique/identity))))
 )

 (deftest t-new-entity
   (testing "new-entity"
-    (let [result  (td/new-entity     {:person/name "dilbert" :job/type :job.type/sucky} ) ]
-      (is (matches? result {:db/id _  :person/name "dilbert" :job/type :job.type/sucky} ))
-    )
-  )
+      (is (matches? {:db/id _  :person/name "dilbert" :job/type :job.type/sucky}
+           (td/new-entity     {:person/name "dilbert" :job/type :job.type/sucky} ))))
+
   (testing "new-entity with partition"
     (let [result  (td/new-entity  :dummy.part/name   {:person/name "dilbert" :job/type :job.type/sucky} )
           dbid    (grab :db/id result)
           part1   (first dbid)
           part2   (second dbid) ]
       ; result: {:db/id #db/id[:dummy.part/name -1000003] :person/name "dilbert" :job/type :job.type/sucky}
-      (is (matches? result   {:db/id _  :person/name "dilbert" :job/type :job.type/sucky} ))
-      (is (matches? dbid #db/id[:dummy.part/name _] ))  ; #db/id[:dummy.part/name -1000003]
-      (is (matches? part1 [:part :dummy.part/name]))
-      (is (matches? part2 [:idx _]))
+      (is (matches? {:db/id _  :person/name "dilbert" :job/type :job.type/sucky} result ))
+      (is (matches? #db/id[:dummy.part/name _] dbid ))  ; #db/id[:dummy.part/name -1000003]
+      (is (matches? [:part :dummy.part/name] part1 ))
+      (is (matches? [:idx _] part2 ))
       (is (s/validate ts/Eid (second part2))))))

 (deftest t-new-enum
-  (is (matches? (td/new-enum :weapon.type/gun)
-                {:db/id #db/id[:db.part/user _]  :db/ident :weapon.type/gun} ))
-  (is (matches? (td/new-enum :gun)
-                {:db/id #db/id[:db.part/user _]  :db/ident :gun} ))
+  (is (matches? {:db/id #db/id[:db.part/user _]  :db/ident :weapon.type/gun}
+                (td/new-enum :weapon.type/gun)))
+  (is (matches? {:db/id #db/id[:db.part/user _]  :db/ident :gun}
+                (td/new-enum :gun)))
   (is (thrown? Exception (td/new-enum "gun"))))

 ; #todo: need more tests for query-*, etc

 (deftest t-update
-  (testing "update"
-    (is (matches? (td/update 999 {:person/name "joe"  :car :car.type/bmw} )
-          {:db/id 999 :person/name "joe" :car :car.type/bmw} ))
-    (is (matches? (td/update [:person/name "joe"] {:car :car.type/bmw} )
-          {:db/id [:person/name "joe"] :car :car.type/bmw} ))
-  ))
+  (is (matches? {:db/id 999 :person/name "joe" :car :car.type/bmw}
+                (td/update 999 {:person/name "joe"  :car :car.type/bmw} )))
+  (is (matches? {:db/id [:person/name "joe"] :car :car.type/bmw}
+                (td/update [:person/name "joe"] {:car :car.type/bmw} ))))

 (deftest t-retract-value
-  (testing "retract-value"
-    (is (matches? (td/retract-value 999 :car :car.type/bmw)
-                   [:db/retract 999 :car :car.type/bmw] ))
-    (is (matches? (td/retract-value [:person/name "joe"] :car :car.type/bmw )
-                   [:db/retract [:person/name "joe"] :car :car.type/bmw] ))))
+  (is (matches? [:db/retract      999 :car :car.type/bmw]
+                (td/retract-value 999 :car :car.type/bmw)))
+  (is (matches? [:db/retract      [:person/name "joe"] :car :car.type/bmw]
+                (td/retract-value [:person/name "joe"] :car :car.type/bmw))))

 (deftest t-retract-entity
-  (testing "retract-entity"
-    (is (matches? (td/retract-entity 999 )
-                 [:db.fn/retractEntity 999] ))
-    (is (matches? (td/retract-entity [:person/name "joe"] )
-                 [:db.fn/retractEntity [:person/name "joe"] ] ))))
+  (is (matches?  [:db.fn/retractEntity 999] (td/retract-entity 999 )))
+  (is (matches?  [:db.fn/retractEntity [:person/name "joe"] ]
+                 (td/retract-entity    [:person/name "joe"] ))))

 ; The macro test must be in the same source file as the macro definition or it won't expand properly
 (deftest t-macro


minor syntax changes

minor syntax changes

--- src/pronouns/pages.clj
+++ src/pronouns/pages.clj
@@ -111,7 +111,7 @@
          (href "https://www.gnu.org/licenses/agpl.html" "AGPLv3")
          "! visit the project on "
          (href "https://github.com/witch-house/pronoun.is" "github")]
-     [:p "<3"]]))
+     [:p "<3"]]))

 (defn footer-block []
   [:footer (usage-block) (contact-block)])
@@ -126,6 +126,7 @@
       [:head
        [:title title]
        [:meta {:name "viewport" :content "width=device-width"}]
+       [:meta {:charset "utf-8"}]
        [:meta {:name "description" :content (u/strip-markup examples)}]
        [:meta {:name "twitter:card" :content "summary"}]
        [:meta {:name "twitter:title" :content title}]
@@ -164,6 +165,7 @@
       [:head
        [:title title]
        [:meta {:name "viewport" :content "width=device-width"}]
+       [:meta {:charset "utf-8"}]
        [:link {:rel "stylesheet" :href "/pronouns.css"}]]
       [:body
        (header-block title)
@@ -183,6 +185,7 @@
       [:head
        [:title title]
        [:meta {:name "viewport" :content "width=device-width"}]
+       [:meta {:charset "utf-8"}]
        [:link {:rel "stylesheet" :href "/pronouns.css"}]]
       [:body
        (header-block title)
@@ -199,6 +202,7 @@
       [:head
        [:title title]
        [:meta {:name "viewport" :content "width=device-width"}]
+       [:meta {:charset "utf-8"}]
        [:link {:rel "stylesheet" :href "/pronouns.css"}]]
       [:body
        (header-block title)


Get port from env var GBU_HTTP_PORT.

Get port from env var GBU_HTTP_PORT.

--- src/gbu/core.clj
+++ src/gbu/core.clj
@@ -5,9 +5,10 @@
             [ring.adapter.jetty :as jetty]
             [gbu.web :as web]))

-(defn http-port
+(defn http-port
   []
-  (or (System/getenv "GBU_HTTP_PORT") 5000))
+  (let [env-port (System/getenv "GBU_HTTP_PORT")]
+    (or (and env-port (Integer/parseInt env-port)) 5000)))

 (defroutes app
   (GET "/" [] (web/home))


Improve the comment on clear-subsscription-cache!

--- src/re_frame/subs.cljc
+++ src/re_frame/subs.cljc
@@ -18,17 +18,15 @@
 (def query->reaction (atom {}))

 (defn clear-subscription-cache!
-  "Runs on-dispose for all subscriptions we have in the subscription cache.
-  Used to force recreation of new subscriptions. Should only be necessary
-  in development.
-
-  The on-dispose functions for the subscriptions will remove themselves from the
-  cache.
-
-  Useful when reloading Figwheel code after a React exception, as React components
-  aren't cleaned up properly. This means a subscription's on-dispose function isn't
-  run when the components are destroyed. If a bad subscription caused your exception,
-  then you can't fix it without reloading your browser."
+  "Causes all subscriptions to be removed from the cache.
+  Does this by:
+     1. running on-dispose on all cached subscriptions
+     2. These on-dispose will then do the removal of themselves.
+
+  This is a development time tool. Useful when reloading Figwheel code
+  after a React exception, because React components won't have been
+  cleaned up properly. And this, in turn, means the subscriptions within those
+  components won't have been cleaned up correctly. So this forces the issue."
   []
   (doseq [[k rxn] @query->reaction]
     (dispose! rxn))


Ensure that (:streams core) is always a vec.

Clojure.core/concat always returns a LazySeq, not a vec, and LazySeq has some
synchronized badness (see src/jvm/clojure/lang/LazySeq.java, line 59).

--- src/riemann/config.clj
+++ src/riemann/config.clj
@@ -100,7 +100,7 @@
   [& things]
   (locking core
     (swap! next-core assoc :streams
-           (concat (:streams @next-core) things))))
+           (reduce conj (:streams @next-core) things))))

 (defn index
   "Set the index used by this core. Returns the index."


Reorganize Requires

Reorganize Requires

--- src/lens/app.clj
+++ src/lens/app.clj
@@ -1,16 +1,18 @@
 (ns lens.app
   (:use plumbing.core)
-  (:require [lens.route :refer [routes]]
+  (:require [bidi.bidi :as bidi]
+            [bidi.ring :as bidi-ring]
+            [io.clojure.liberator-transit]
+            [ring.middleware.params :refer [wrap-params]]
+            [ring.middleware.keyword-params :refer [wrap-keyword-params]]
+            [ring.middleware.format :refer [wrap-restful-format]]
+            [lens.route :refer [routes]]
             [lens.handler :refer [handlers]]
             [lens.middleware.datomic :refer [wrap-connection]]
             [ring.middleware.params :refer [wrap-params]]
             [ring.middleware.keyword-params :refer [wrap-keyword-params]]
             [lens.middleware.wan-exception :refer [wrap-exception]]
-            [lens.middleware.cors :refer [wrap-cors]]
-            [bidi.ring :as bidi-ring]
-            [io.clojure.liberator-transit]
-            [ring.middleware.format :refer [wrap-restful-format]]
-            [bidi.bidi :as bidi]))
+            [lens.middleware.cors :refer [wrap-cors]]))

 (defn path-for [routes]
   (fn [handler & params]


Move logging to separate file

Move logging to separate file

--- src/silly_image_store/handler.clj
+++ src/silly_image_store/handler.clj
@@ -1,7 +1,7 @@
  (ns silly-image-store.handler
   (:require [silly-image-store.store :as store]
+            [silly-image-store.logging :refer :all]
             [environ.core :refer [env]]
-            [clojure.tools.logging :as log]
             [compojure.core :refer :all]
             [ring.middleware.json :refer :all]
             [compojure.handler :as handler]
@@ -32,11 +32,6 @@
   (route/resources "/")
   (route/not-found "Not Found"))

-(defn wrap-request-logging [handler]
-  (fn [{requester :remote-addr uri :uri action :request-method :as request}]
-    (log/info (str action " " uri " from " requester))
-    (handler request)))
-
 (def app
   (-> (handler/site app-routes)
       (wrap-json-response)


comments

comments

--- src/simple/inspect.clj
+++ src/simple/inspect.clj
@@ -1,6 +1,9 @@
 (ns simple.inspect
   (:require [clojure.inspector :refer :all]))

+; shows how you can inspect a map or a tree
+; graphically without any additional software
+; the below will start a new  jframe
 (def a {:a 1 :b 2 :c {:a 2 :b 1}})
 (inspect-tree a)
-; jframe starts
+


Placeholder

Placeholder

--- src/tick/alpha/api.clj
+++ src/tick/alpha/api.clj
@@ -242,6 +242,11 @@
 (defn / [x divisor]
   (core// x divisor))

+;; Temporal adjusters
+
+#_(defn adjust [t adjuster]
+  (core/adjust t adjuster))
+
 ;; Useful functions

 #_(defn dates-over [interval]


Fix versions

Fix versions

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -399,11 +399,11 @@
     :model {:refinement/create-state-update {:doc "Fn (trigger, state, state-event) to generate a serializable state machine update."
                                               :type :function
                                               :optional? false
-                                              :added "0.0.0"}
+                                              :added "0.9.0"}
             :refinement/apply-state-update {:doc "Fn (trigger, state, entry) to apply the refinement state machine update entry to a state."
                                              :type :function
                                              :optional? false
-                                             :added "0.8.0"}}}
+                                             :added "0.9.0"}}}
    :trigger
    {:summary "Implement different trigger behaviours e.g. timers, segments, etc."
     :link nil


util/restlet.clj: added delay after server shutdown

To ensure port bindings get released before server is recreated.

--- src/org/altlaw/util/restlet.clj
+++ src/org/altlaw/util/restlet.clj
@@ -17,4 +17,5 @@
      (.start server#)
      (try ~@body
           (finally (.stop server#)
-                   (.. server# getServers clear)))))
+                   (.. server# getServers clear)
+                   (Thread/sleep 1000)))))


Remove already implemented in bide impl for IPathRepr protocol.

--- src/uxbox/main/ui.cljs
+++ src/uxbox/main/ui.cljs
@@ -156,13 +156,6 @@

    ["/workspace/:project/:page" :workspace/page]])

-(extend-protocol bc/IPathRepr
-  nil
-  (-repr [it] "")
-
-  cljs.core.Keyword
-  (-repr [it] (name it)))
-
 ;; --- Main Entry Point

 (defn init-routes


Remove docstring inside function body

Remove docstring inside function body

--- src/zweikopf/multi.clj
+++ src/zweikopf/multi.clj
@@ -107,7 +107,6 @@
   ([m f]
    (apply-to-keys-and-values m f f))
   ([m key-f value-f]
-   "Applies function f to all values in map m"
    (into {} (for [[k v] m]
               [(key-f k) (value-f v)]))))


fix test

fix test

--- test/metabase/util/stats_test.clj
+++ test/metabase/util/stats_test.clj
@@ -57,7 +57,7 @@
 (expect "10000+" (bin-large-number 100000))

-(expect "unknown" ((anonymous-usage-stats) :running_on))
+(expect :unknown ((anonymous-usage-stats) :running_on))
 (expect true ((anonymous-usage-stats) :check_for_updates))
 (expect true ((anonymous-usage-stats) :site_name))
 (expect true ((anonymous-usage-stats) :friendly_names))


Adding a 406 test to app-routes

Adding a 406 test to app-routes

--- test/pandora/http/routes_test.clj
+++ test/pandora/http/routes_test.clj
@@ -8,7 +8,13 @@
 (facts :articles
   (let [a-request (-> (request :get "/articles/foo")
                       (header "Accept" vars/hal+json))
-        response (r/app-routes (request :get "/articles/foo"))]
+        response (r/app-routes a-request)]
     response => (contains {:headers map? :body string? :status integer?})
     (:status response) => 200
     (get-in response [:headers "Content-Type"]) => (contains vars/hal+json)))
+
+(facts :articles :no-acceptable
+  (let [a-request (-> (request :get "/articles/foo")
+                      (header "Accept" "application/something"))
+        response (r/app-routes a-request)]
+    (:status response) => 406))


Add html entity test

Add html entity test

--- test/reagenttest/testreagent.cljs
+++ test/reagenttest/testreagent.cljs
@@ -8,7 +8,8 @@
             [reagent.core :as r]
             [reagent.dom.server :as server]
             [reagent.impl.util :as util]
-            [reagenttest.utils :as u :refer [with-mounted-component found-in]]))
+            [reagenttest.utils :as u :refer [with-mounted-component found-in]]
+            [goog.string :as gstr]))

 (def tests-done (atom {}))

@@ -1072,4 +1073,9 @@

   (is (re-find #"<custom-element class=\"foobar\">foo</custom-element>"
                (server/render-to-static-markup
-                 [:custom-element.foobar "foo"]))) )
+                 [:custom-element.foobar "foo"]))))
+
+(deftest html-entities
+  (is (= "<i> </i>"
+         (server/render-to-static-markup
+           [:i (gstr/unescapeEntities " ")]))))


Test linear regression with fixed variables


Simplified test

Simplified test

--- test/yada/malformed_body_test.clj
+++ test/yada/malformed_body_test.clj
@@ -6,9 +6,6 @@
             [ring.mock.request :as mock]
             [clojure.edn :as edn]
             [byte-streams :as bs]))
-
-(defn to-string [s]
-  (bs/convert s String))

 (deftest schema-error-is-available-in-context-error
   (let [resource     (resource {:consumes  [{:media-type #{"application/edn"
@@ -27,11 +24,11 @@
     (let [response @(handler edn-request)]
       (is (some? response))
       (is (= 400 (:status response)))
-      (let [body (-> response :body to-string edn/read-string)]
+      (let [body (-> response :body bs/to-string edn/read-string)]
         (is (= '{:foo (not (integer? :asdf))} body))))

     (let [response @(handler form-request)]
       (is (some? response))
       (is (= 400 (:status response)))
-      (let [body (-> response :body to-string edn/read-string)]
+      (let [body (-> response :body bs/to-string edn/read-string)]
         (is (= '{:foo (not (integer? :asdf))} body))))))


Remove first null when parsing

Remove first null when parsing

--- src/subman/sources/addicted.clj
+++ src/subman/sources/addicted.clj
@@ -1,5 +1,6 @@
 (ns subman.sources.addicted
-  (:require [net.cgrand.enlive-html :as html]))
+  (:require [net.cgrand.enlive-html :as html]
+            [subman.helpers :as helpers]))

 (defn fetch
   "Fetch url content"
@@ -71,7 +72,8 @@
              :content
              first
              (clojure.string/split  #" ")
-             last))
+             last
+             helpers/remove-first-0))

 (defn- get-episode-name-element
   "Get episode name holder element"
@@ -89,7 +91,8 @@
                       :content
                       first
                       :content
-                      first)
+                      first
+                      helpers/remove-first-0)
           :name (-> line
                     get-episode-name-element
                     :content


fix find attrnodes

fix find attrnodes

--- src/synthesis_crawlers/core.clj
+++ src/synthesis_crawlers/core.clj
@@ -159,20 +159,23 @@
             (recur (into (rest nodes) (.children node)) done)
             (recur (into (rest nodes) (.children node)) (conj done node))))))))

-(s/fdef find-attr-nodes
-        :args (s/cat :nodes #(or (instance? Elements %) element?) :knowledge ::knowledge)
-        :ret #(instance? Elements %))
-(defn find-attr-nodes
-  "returns the elements which contain text similar to the specified knowledge"
-  [nodes knowledge]
-  (filter #(not-empty (matched-knowledge (.text %) knowledge)) nodes))
-
 (s/fdef reach?
         :args (s/cat :a element? :b element?))
 (defn reach?
   "returns true iff b is reachable from a"
   [a b]
   (->> (filter #(= % b) (.getAllElements a)) empty? not))
+
+(s/fdef find-attr-nodes
+        :args (s/cat :nodes #(or (instance? Elements %) element?) :knowledge ::knowledge))
+(defn find-attr-nodes
+  "returns the elements which contain text similar to the specified knowledge"
+  [nodes knowledge]
+  (reduce
+    (fn [nodes node]
+      (conj (filter #(not (reach? % node)) nodes) node))
+    []
+    (filter #(not-empty (matched-knowledge (.text %) knowledge)) nodes)))

 #_(s/fdef find-nodes
   :args (s/cat :pages ::pages :attr-knowledge ::attr-knowledge))


Update ns_to_markdown.clj

Update ns_to_markdown.clj

--- docs/src/ns_to_markdown.clj
+++ docs/src/ns_to_markdown.clj
@@ -10,7 +10,10 @@
      - it reads the namespace within the file using the ClojureScript analyzer,
        extracting public var metadata such as function names, arglists and docstrings.
      - it writes a single markdown-based API doc to stdout
-     - you can see the page it outputs here: http://day8.github.io/re-frame/api-re-frame.core/
+     - you can see the page it outputs here: http://day8.github.io/re-frame/api-re-frame.core/
+       But only take note of the central content. The navigation sidebars are automatically
+       generated by the Static Site Generator based off of H3 elements. They are not created by
+       this script. So, just the central, page content.

    Workflow:
      - the output is designed to be incorporated into a Static Site generator, like `mkdocs`.


Fixing tick evals

Fixing tick evals

--- docs/src/tick/docs/app.cljs
+++ docs/src/tick/docs/app.cljs
@@ -17,10 +17,10 @@
       (fn []
         (eval-str
           env
-          (str "(ns tick.repl (:require [tick.alpha.api :as t])
-                              (:refer-clojure))" s)
+          (str "(require '[tick.alpha.api :as t])\n\n" s)
           (str "[" label "]")
-          {:eval js-eval
+          {:ns 'tick.repl
+           :eval js-eval
            :loader (partial boot/load env)}
           (fn [x] (cb x)))))))


shadow docs - include cljs.core fns

shadow docs - include cljs.core fns

--- docs/src/tick/docs/app.cljs
+++ docs/src/tick/docs/app.cljs
@@ -17,8 +17,8 @@
       (fn []
         (eval-str
           env
-          (str "(ns tick.repl (:require [tick.alpha.api :as t]
-                                        ))" s)
+          (str "(ns tick.repl (:require [tick.alpha.api :as t])
+                              (:refer-clojure))" s)
           (str "[" label "]")
           {:eval js-eval
            :loader (partial boot/load env)}


WIP stacktrace

WIP stacktrace

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -138,17 +138,14 @@
                                                   (js/PLANCK_LOAD "cljs/core.js.map")))})))

 (defn print-error [error]
-  #_(prn error)
-  (let [cause (.-cause error)]
+  (let [cause (or (.-cause error) error)]
+    (println (.-message cause))
     (load-core-source-maps!)
-    (println (.-message cause))
-    #_(println (.-stack cause))
     (let [canonical-stacktrace (st/parse-stacktrace
                                  {}
                                  (.-stack cause)
                                  {:ua-product :safari}
-                                 {:output-dir "file:///goog/.."})]
-
+                                 {:output-dir "file://(/goog/..)?"})]
       (println
         (st/mapped-stacktrace-str
           canonical-stacktrace


Scope completions to typed namespace

Scope completions to typed namespace

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -87,10 +87,13 @@
   (let [namespace-candidates (map str
                                (keys (:cljs.analyzer/namespaces @planck.core/st)))
         top-form? (re-find #"^\s*\(\s*[^()\s]*$" buffer)
-        all-candidates (set (concat namespace-candidates
-                                    (completion-candidates-for-ns 'cljs.core false)
-                                    (completion-candidates-for-ns @current-ns true)
-                                    (when top-form? (map str repl-specials))))]
+        typed-ns (second (re-find #"(\b[a-zA-Z-.]+)\/[a-zA-Z-]+$" buffer))
+        all-candidates (set (if typed-ns
+                              (completion-candidates-for-ns (symbol typed-ns) false)
+                              (concat namespace-candidates
+                                      (completion-candidates-for-ns 'cljs.core false)
+                                      (completion-candidates-for-ns @current-ns true)
+                                      (when top-form? (map str repl-specials)))))]
     (let [buffer-match-suffix (re-find #"[a-zA-Z-]*$" buffer)
           buffer-prefix (subs buffer 0 (- (count buffer) (count buffer-match-suffix)))]
       (clj->js (if (= "" buffer-match-suffix)


Tab-completion for core macros

Tab-completion for core macros

Fixes #98

Former-commit-id: 26f75997b52e3253f38b9b377ab1caea012f7620

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -248,6 +248,7 @@
          (completion-candidates-for-ns (symbol typed-ns) false)
          (concat namespace-candidates
            (completion-candidates-for-ns 'cljs.core false)
+           (completion-candidates-for-ns 'cljs.core$macros false)
            (completion-candidates-for-ns @current-ns true)
            (when top-form?
              (concat


Add a test for `/{foo}.html` style routes

Just like path `///` would not match `/{foo}/`, `/..html` does not match
`/{foo}.html`.

--- test/cljc/reitit/core_test.cljc
+++ test/cljc/reitit/core_test.cljc
@@ -121,6 +121,7 @@
                               :foo/bar "ei/toista/kertaa"}]
                      (by-path "/olipa/kerran/avaruus/vaan/ei/toista/kertaa")))
               (is (= [::html {:name "10"}] (by-path "/files/file-10.html")))
+              (is (= [nil nil] (by-path "/files/file-..html")))
               (is (= [::loru {:eskon "viitan", :saum "aa"}] (by-path "/viitan/aa/pium\u2215paum")))
               (is (= [nil nil] (by-path "/ei/osu/pium/paum")))
               (is (= [::emoji {:🌈 "brackets"}] (by-path "/brackets🤔/🎈")))


If you're gonna thread, thread

If you're gonna thread, thread

--- test/cljs/fatlip/core_test.cljs
+++ test/cljs/fatlip/core_test.cljs
@@ -29,16 +29,16 @@
            (count (-> cm-graph :layers (get 0) :items))
            3)
         "Number of nodes in layer 0")
-    (is (= (count (-> graph :layers (get 1) :nodes))
-           (count (-> cm-graph :layers (get 1) :items))
+    (is (= (-> graph :layers (get 1) :nodes count)
+           (-> cm-graph :layers (get 1) :items count)
            6)
         "Number of nodes in layer 1")
-    (is (= (count (-> graph :layers (get 2) :nodes))
-           (count (-> cm-graph :layers (get 2) :items))
+    (is (= (-> graph :layers (get 2) :nodes count)
+           (-> cm-graph :layers (get 2) :items count)
            3)
         "Number of nodes in layer 2")
-    (is (= (count (-> graph :layers (get 3) :nodes))
-           (count (-> cm-graph :layers (get 3) :items))
+    (is (= (-> graph :layers (get 3) :nodes count)
+           (-> cm-graph :layers (get 3) :items count)
            1)
         "Number of nodes in layer 3")
     (is (= (count (:ps graph)) 2) "Number of p nodes")


Fix dorun-when-idle

Fix dorun-when-idle

--- src/asciinema/player/source.cljs
+++ src/asciinema/player/source.cljs
@@ -214,7 +214,7 @@
     (letfn [(make-cb [coll]
               (fn []
                 (when (seq coll)
-                  (ric (make-job (rest coll))))))]
+                  (ric (make-cb (rest coll))))))]
       (ric (make-cb coll)))))

 (defn start-preloader [{:keys [recording-ch-fn command-ch force-load-ch preload? poster-time] :as recording} msg-ch]


fix for Film Critic message when adding hosted agenda to score area

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -192,8 +192,8 @@
                  :effect (req (let [c (move state :runner (first (:hosted card)) :scored)]
                                 (gain-agenda-point state :runner (get-agenda-points state :runner c))))
                  :msg (msg (let [c (first (:hosted card))]
-                             (str "add " (:title c) " to their score area and gain "
-                             (:agendapoints c) " agenda point" (when (> (get-agenda-points state :runner c) 1) "s"))))}]}
+                             (str "add " (:title c) " to their score area and gain " (get-agenda-points state :runner c)
+                                  " agenda point" (when (> (get-agenda-points state :runner c) 1) "s"))))}]}

    "Gang Sign"
    {:events {:agenda-scored {:effect (req (system-msg state :runner (str "can access cards in HQ by clicking on Gang Sign"))


Optimise day 20 solution a bit.

Optimise day 20 solution a bit.

--- clojure/src/advent2017/day20.clj
+++ clojure/src/advent2017/day20.clj
@@ -31,13 +31,18 @@
 (def puzzle (read-puzzle "day20.data" (comp lines->particles
                                             ->lines)))

-(defn tick-particle [{:keys [p v a] :as particle}]
-  (let [v' (mapv + v a)
-        p' (mapv + p v')]
-    (assoc particle :v v' :p p')))
+(defn tick-particle [{:keys [^longs p ^longs v ^longs a] :as particle}]
+  (let [[px py pz]           p
+        [vx vy vz]           v
+        [ax ay az]           a
+        [vx' vy' vz' :as v'] [(+ vx ax) (+ vy ay) (+ vz az)]
+        p'                   [(+ px vx') (+ py vy') (+ pz vz')]]
+    (assoc particle
+           :v v'
+           :p p')))

-(defn metric [c]
-  (apply + (map #(* ^long % ^long %) c)))
+(defn ^long metric [^longs [x y z]]
+  (+ (* x x) (* y y) (* z z)))

 (defn sorted-by? [f xs]
   (loop [[x & xs'] xs]


Use more idiomatic infinite loop.

Use more idiomatic infinite loop.

As part of the warnings I was finally able to get from Eastwood, this
showed up since the conditional was always true. I now know a better way
to write this kind of loop, so might as well clean up this warning too.

--- src/afterglow/dj_link.clj
+++ src/afterglow/dj_link.clj
@@ -123,14 +123,15 @@
                (-> current
                    (assoc :socket socket)
                    (assoc :watcher
-                          (future (while true
+                          (future (loop []
                                     (let [packet (receive socket)
                                           data (.getData packet)]
                                       ;; Check packet length
                                       ;; TODO: Check header bytes, perhaps use Protobuf for this?
                                       (when (= 96 (.getLength packet))
                                         (update-known-sources packet data)
-                                        (update-synced-metronomes packet data))))))))))
+                                        (update-synced-metronomes packet data)))
+                                    (recur))))))))
     (catch Exception e
       (timbre/warn e "Failed while trying to set up DJ-Link reception.")
       (shut-down))))


Mocked API calls

Mocked API calls

--- server/src/server/handler.clj
+++ server/src/server/handler.clj
@@ -1,10 +1,28 @@
 (ns server.handler
   (:require [compojure.core :refer :all]
             [compojure.route :as route]
-            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))
+            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
+            [jopbox.client :refer :all]
+            [ring.util.response :refer [response]]
+            [ring.middleware.json :refer [wrap-json-response]]))
+
+;(def app-key (System/getenv "DROPBOX_APP_KEY"))
+;(def app-secret (System/getenv "DROPBOX_APP_SECRET"))
+;
+;(def consumer (make-consumer app-key app-secret))
+;(def request-token (fetch-request-token consumer))

 (defroutes app-routes
-  (GET "/pictures" [] "[]")
+
+  (GET "/categories" []
+    (response ["Travel" "Nature" "People" "Inspiration" "Other"]))
+
+  (GET "/pictures/:category" [category]
+    (response [{ :thumbnail "1453387_10153573511785500_1899755281_n.jpg" :actual "1453387_10153573511785500_1899755281_n.jpg" }
+               { :thumbnail "1501290_10153594457450500_512797407_o.jpg" :actual "1501290_10153594457450500_512797407_o.jpg" }
+               { :thumbnail "10919772_10204037928682634_3559155281616018900_o.jpg" :actual "10919772_10204037928682634_3559155281616018900_o.jpg"  }
+               { :thumbnail "11537596_10205200764592805_3267665941076830075_o.jpg" :actual "11537596_10205200764592805_3267665941076830075_o.jpg" }]))
+
   (route/files "/")
   (route/not-found "Page not found"))

@@ -14,4 +32,4 @@
       (update-in req [:uri]
         #(if (= "/" %) "/index.html" %)))))

-(def app (-> (routes app-routes) (wrap-dir-index)))
+(def app (-> (routes app-routes) (wrap-json-response) (wrap-dir-index)))


adding the newly added dependencies with requires

requiring parts of buddy, more ring middleware to deal with request parsing and JSON

--- src/bitfondue/handler.clj
+++ src/bitfondue/handler.clj
@@ -1,12 +1,22 @@
 (ns bitfondue.handler
   (:require (compojure [core :refer :all]
-                       [route :as route])
-            [cemerick.friend :as friend]
-            (cemerick.friend [workflows :as workflows]
-                             [credentials :as creds])
-            [ring.util.response :as resp]
+                       [route :as route]
+                       [response :refer [render]])
+            [clojure.java.io :as io]
+            [ring.util.response :refer [response redirect content-type status]]
+            (ring.middleware [session :refer [wrap-session]]
+                             [params :refer [wrap-params]]
+                             [json :refer [wrap-json-response wrap-json-body]])
+            [hiccup.core :as h]
+            [clj-time.core :as time]
+            [buddy.sign.jwe :as jwe]
+            [buddy.core.nonce :as nonce]
+            [buddy.auth :refer [authenticated? throw-unauthorized]]
+            [buddy.auth.backends.token :refer [jwe-backend]]
+            [buddy.auth.middleware :refer [wrap-authentication wrap-authorization]]
             (bitfondue.models [users :as users]))
-  (:use [ring.adapter.jetty :as ring]))
+  (:use [ring.adapter.jetty :as ring])
+  (:gen-class))

 (defroutes app-routes
   (GET "/" [] "Success!")


first pass at simplistic mining loop

first pass at simplistic mining loop

--- src/block_chain/miner.clj
+++ src/block_chain/miner.clj
@@ -59,21 +59,29 @@

 (defn generate-block
   [transactions]
-  (let [unhashed {:header {:parent-hash (latest-block-hash)
-                           :transactions-hash (transactions-hash transactions)
-                           :timestamp (current-time-seconds)
-                           :nonce 0}
-                  :transactions transactions}]
-    (assoc-in unhashed [:header :hash] (block-hash unhashed))))
+  {:header {:parent-hash (latest-block-hash)
+            :transactions-hash (transactions-hash transactions)
+            :timestamp (current-time-seconds)
+            :nonce 0}
+   :transactions transactions})

 (defn hex->int
-  "Read long hex string and convert it to big integer."
+  "Read hex string and convert it to big integer."
   [hex-string]
   (bigint (java.math.BigInteger. hex-string 16)))

 (defn meets-target? [{{target :target hash :hash} :header}]
  (< (hex->int hash) (hex->int target)))

+(defn hashed [block]
+  (assoc-in block [:header :hash] (block-hash block)))

 (defn mine [block]
-  (let [attemtp]))
+  (let [attempt (hashed block)]
+    (if (meets-target? attempt)
+      attempt
+      (recur (update-in block [:header :nonce] inc)))))
+
+
+#_(let [unhashed ]
+    (assoc-in unhashed [:header :hash] (block-hash unhashed)))


session auth only for slack callback

session auth only for slack callback

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -266,9 +266,17 @@
     (db/delete-goal db user-id int-id)
     (response {})))

+(defn wrap-session-auth [handler jwt]
+  (fn [req]
+    (if (:user-id req)
+      (handler req)
+      (let [token (get-in req [:cookies "auth-token" :value])
+            user (jwt/unsign jwt token)]
+        (handler (assoc req :user-id (:user-id user)))))))
+
 (defn routes [component]
   (compojure.core/routes
-   (GET "/slack-callback" _ (partial slack-callback component))
+   (GET "/slack-callback" _ (wrap-session-auth (partial slack-callback component) (:jwt component)))
    (POST "/slack" _ (partial slack component))
    (PUT "/time/:timestamp" _ (partial timestamp component))
    (POST "/token" _ (partial token component))
@@ -291,14 +299,6 @@
    (POST "/signup" _ (partial signup component))
    (GET "/healthcheck" _ (health-check component))))

-(defn wrap-session-auth [handler jwt]
-  (fn [req]
-    (if (:user-id req)
-      (handler req)
-      (let [token (get-in req [:cookies "auth-token" :value])
-             user (jwt/unsign jwt token)]
-        (handler (assoc req :user-id (:user-id user)))))))
-
 (defn wrap-user [handler jwt]
   (fn [req]
     (let [token (get-in req [:headers "authorization"])
@@ -311,7 +311,6 @@
     (debug "Starting server")
     (let [stop (http/run-server
                 (-> (routes component)
-                    (wrap-session-auth (:jwt component))
                     (wrap-user (:jwt component))
                     (wrap-restful-format :formats [:json-kw :edn :transit-json :transit-msgpack])
                     (wrap-defaults (-> api-defaults


Added Card, Columns and Board definitions

Updated the render the function to show the board and two columns

--- src/cljs/kanban/core.cljs
+++ src/cljs/kanban/core.cljs
@@ -8,4 +8,20 @@
 (defn greeting []
   [:h1 (:text @app-state)])

-(reagent/render [greeting] (js/document.getElementById "app"))
+(defn Card []
+  [:div.card
+   "a card"])
+
+(defn Column []
+  [:div.column
+   [:h2 "a column"]])
+
+(defn Board []
+  [:div.board
+   [Column]
+   [Column]])
+
+(reagent/render [Board] (js/document.getElementById "app"))
+
+;; Original render line
+;; (reagent/render [greeting] (js/document.getElementById "app"))


Fixed semantic error in products.clj

Fixed semantic error in products.clj

--- src/clouseau/products.clj
+++ src/clouseau/products.clj
@@ -39,8 +39,9 @@
 (ns clouseau.products
     "Module that contains database configurations for all products.")

-(def products [
+(def products
     "Database configurations for all products."
+     [
      ["Fedora 20"
         {:classname   "org.sqlite.JDBC"
          :subprotocol "sqlite"


simplify address generation

simplify address generation

--- src/clj/just_married/api/labels.clj
+++ src/clj/just_married/api/labels.clj
@@ -62,19 +62,8 @@
   (apply + (map count (vals address))))

 (defn format-address
-  [{:keys [group_name country address]}]
-  {:pre [(or (nil? country)
-             (contains? (set (keys countries-mappping)) country))]}
-
-  (if (= country "IT")
-    (format "%s\n%s"
-            group_name
-            (or address ""))
-
-    (format "%s\n%s\n%s"
-            group_name
-            (or address "")
-            (or (countries-mappping country) ""))))
+  [{:keys [group_name address]}]
+  (format "%s\n%s" group_name (or address "")))

 (defn group-addresses
   [addresses n-cols]


Add support for to-stream to trident DSL

--- src/clj/marceline/storm/trident.clj
+++ src/clj/marceline/storm/trident.clj
@@ -394,6 +394,10 @@
   [stream group-fields]
   (.groupBy stream (apply fields group-fields)))

+(defn to-stream
+  [stream]
+  (.toStream stream))
+
 (defn partition-by
   [stream group-fields]
   (.partitionBy stream (apply fields group-fields)))


No need for go block where put! can do

No need for go block where put! can do

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -2,7 +2,7 @@
   (:require [reagent.core :as reagent :refer [atom]]
             [asciinema-player.view :as view]
             [asciinema-player.util :as util]
-            [cljs.core.async :refer [chan >! <! timeout close! dropping-buffer]]
+            [cljs.core.async :refer [chan >! <! put! timeout close! dropping-buffer]]
             [clojure.walk :as walk]
             [clojure.set :refer [rename-keys]]
             [ajax.core :refer [GET]])
@@ -316,10 +316,10 @@
         mouse-moves (chan (dropping-buffer 1))
         user-activity (activity-chan mouse-moves 2000)
         dispatch (fn [[event-name & args :as event]]
-                   (go
-                     (if (= event-name :mouse-move)
-                       (>! mouse-moves true)
-                       (>! events event))))]
+                   (if (= event-name :mouse-move)
+                     (put! mouse-moves true)
+                     (put! events event))
+                   nil)]
     (go-loop []
       (swap! state process-event dispatch (<! events))
       (recur))


Setup the handlers to load image tags one at a time

--- src/cljs/comic_reader/handlers.cljs
+++ src/cljs/comic_reader/handlers.cljs
@@ -46,11 +46,14 @@
   (rf/register-handler
    :url-list
    (fn [db [_ url-list]]
-     (assoc db :url-list url-list)))
+     (api/get-img-tag (:site db) (first url-list))
+     (assoc db :url-list (rest url-list))))

   (rf/register-handler
    :next-image
    (fn [db [_ img-tag]]
-     (if (vector? (:comic-imgs db))
-       (update-in db [:comic-imgs] conj img-tag)
-       (assoc db :comic-imgs [img-tag])))))
+     (api/get-img-tag (:site db) (first (:url-list db)))
+     (let [db (update-in db [:url-list] rest)]
+      (if (vector? (:comic-imgs db))
+        (update-in db [:comic-imgs] conj img-tag)
+        (assoc db :comic-imgs [img-tag]))))))


scores spec

scores spec

--- src/cljs/triboard/logic/scores.cljs
+++ src/cljs/triboard/logic/scores.cljs
@@ -23,8 +23,7 @@
 ;; Public API
 ;; ----------------------------------------------------------------------------

-(s/def ::weight number?)
-(s/def ::scores (s/map-of ::player/player ::weight))
+(s/def ::scores (s/map-of ::player/player int?))

 (s/fdef update-scores
   :args (s/cat :scores ::scores :transition ::transition/transition)


Added genome_uniform_addition and genome_uniform_deletion instructions.

--- src/clojush/instructions/genome.clj
+++ src/clojush/instructions/genome.clj
@@ -423,4 +423,36 @@
                                         (merge @push-argmap {:uniform-silence-mutation-rate rate}))))
                         :genome)))
       state)))
+
+(define-registered
+  genome_uniform_deletion
+  ^{:stack-types [:genome :float]}
+  (fn [state]
+    (if (and (not (empty? (:float state)))
+             (not (empty? (:genome state))))
+      (let [rate (mod (first (:float state)) 1.0)
+            genome (first (:genome state))]
+        (->> (pop-item :float state)
+             (pop-item :genome)
+             (push-item (vec (:genome (uniform-deletion
+                                        {:genome genome}
+                                        (merge @push-argmap {:uniform-deletion-rate rate}))))
+                        :genome)))
+      state)))
+
+(define-registered
+  genome_uniform_addition
+  ^{:stack-types [:genome :float]}
+  (fn [state]
+    (if (and (not (empty? (:float state)))
+             (not (empty? (:genome state))))
+      (let [rate (mod (first (:float state)) 1.0)
+            genome (first (:genome state))]
+        (->> (pop-item :float state)
+             (pop-item :genome)
+             (push-item (vec (:genome (uniform-addition
+                                        {:genome genome}
+                                        (merge @push-argmap {:uniform-addition-rate rate}))))
+                        :genome)))
+      state)))
 ;; @@