remove unused worksheet

remove unused worksheet

--- ws/news-compounds.clj
+++ ws/news-compounds.clj
@@ -1,50 +0,0 @@
-;; gorilla-repl.fileformat = 1
-
-;; **
-;;; # News Compounds
-;;;
-;;; This worksheet studies the evolutionary patterns in news compounds for each broadcaster.
-;; **
-
-;; @@
-(ns news-comppounds
-  (:refer-clojure :exclude [find sort])
-  (:require [gorilla-plot.core :as plot]
-            [gorilla-repl.table :as table]
-            [gg4clj.core :as gg4clj]
-            [monger.collection :as mc]
-            [ceres-analytics.core :refer [t0 tmax hour-range day-range]]
-            [ceres-analytics.db :refer [db broadcasters]]
-            [ceres-analytics.measures :as ms]
-            [ceres-analytics.news-measures :as nm]
-            [ceres-analytics.cascade :as cs]
-            [clojure.data.priority-map :refer [priority-map]]
-            [clj-time.core :as t]
-            [clj-time.coerce :as c]
-            [clj-time.periodic :as p]
-            [incanter.stats :as stats]
-            [clj-time.format :as f]
-            [monger.core :as mg]
-            [monger.joda-time]
-            [monger.operators :refer :all]
-            [aprint.core :refer [aprint]]
-            [monger.query :refer :all]))
-;; @@
-;; =>
-;;; {"type":"html","content":"nil","value":"nil"}
-;; <=
-
-;; @@
-(def cmpnds (cs/compounds nm/news-authors t0 tmax))
-;; @@
-
-;; @@
-
-;; @@
-;; =>
-;;; {"type":"list-like","open":"[","close":"]","separator":" ","items":[{"type":"html","content":"nil","value":"nil"},{"type":"list-like","open":"{","close":"}","separator":", ","items":[{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":":nodes","value":":nodes"},{"type":"list-like","open":"[","close":"]","separator":" ","items":[],"value":"[]"}],"value":"[:nodes []]"},{"type":"list-like","open":"","close":"","separator":" ","items":[{"type":"html","content":":links","value":":links"},{"type":"list-like","open":"[","close":"]","separator":" ","items":[],"value":"[]"}],"value":"[:links []]"}],"value":"{:nodes [], :links []}"}],"value":"[nil {:nodes [], :links []}]"}
-;; <=
-
-;; @@
-
-;; @@


Test for functions create-reply and use-wildchars?

--- test/clj_mrazik/irc_bot_test.clj
+++ test/clj_mrazik/irc_bot_test.clj
@@ -209,3 +209,22 @@
         (is (not (message-for-me? "bot" "?" {:text "?" :target ""})))
         (is (not (message-for-me? "bot" "?" {:text "" :target ""})))))

+(deftest test-create-reply
+    "Check the behaviour of function clj-mrazik.irc-bot/create-reply"
+    (testing "the function create-reply"
+        (are [x y] (= x (create-reply y))
+            {:target "#"}                  {:target "#"}
+            {:target "#channel"}           {:target "#channel"}
+            {:target "#channel message"}   {:target "#channel message"}
+            {:target "nick" :nick "nick"}  {:target "" :nick "nick"})))
+
+(deftest test-use-wildchars?
+    "Check the behaviour of function clj-mrazik.irc-bot/use-wildchars?"
+    (testing "the function use-wildchars?"
+        (are [x y] (= x (use-wildchars? y))
+            true "*word"
+            true "word*"
+            true "*word*"
+            true "*"
+            false "word")))
+


tests for :on, :off

tests for :on, :off


ctor-pull test stuff

ctor-pull test stuff

--- test/clojure/migae/ctor_pull.clj
+++ test/clojure/migae/ctor_pull.clj
@@ -1,4 +1,5 @@
 (ns migae.ctor-pull
+  "Unit tests for pull constructor entity-map*"
   (:refer-clojure :exclude [name hash])
   (:import [com.google.appengine.tools.development.testing
             LocalServiceTestHelper
@@ -47,11 +48,10 @@
 (use-fixtures :each ds-fixture)

 (deftest ^:ctor-pull ctor-pull-notfound
-  (testing "co-constructor notfound"
-    (try (ds/entity-map* [:A/B])
-         (catch EntityNotFoundException e
-           (is (= "No entity was found matching the key: A(\"B\")"
-                  (.getMessage e)))))))
+  (testing "pull constructor: entity not found"
+    (let [ex (try (ds/entity-map* [:Foo/BAR :NOT/FOUND])
+                  (catch EntityNotFoundException e e))]
+      (is (= (type ex) EntityNotFoundException)))))

 (deftest ^:ctor-pull ctor-pull
   (testing "pull ctor"
@@ -64,4 +64,11 @@
       (is (= (:b em2) nil))
       )))

+(deftest ^:ctor-pull ctor-pull-kinded
+  (testing "pull ctor"
+    (let [ems (ds/entity-map* [:C]) ; fetch emaps of kind :C
+          ]
+      (log/trace "ems:" ems)
+      )))

+


fix text + exo

fix text + exo

--- resources/workshop/do_things.clj
+++ resources/workshop/do_things.clj
@@ -166,6 +166,8 @@
     :cocked-pistol     :sirens
     :say-what?))

+""
+

 (exercice
   "En cas d'urgence,sonorez les alarmes "
@@ -210,7 +212,7 @@

 "Utilisez *when* lorsque vous voulez faire plusieurs choses quand une certaine condition est vrai, et vous ne voulez pas faire quelque chose quand la condition est fausse.

-Cela couvre les opérateurs de contrôle de flux essentiels!"
+Cela couvre les opérateurs de contrôle essentiels!"

@@ -687,10 +689,10 @@
 (exercice

   "Le reste de rien n'est pas si stricte"
-  (= __ (try
+  [(= __ (try
           (rest '())
           (catch IllegalStateException e
-            "No dice!"))) ())
+            "No dice!")))] ())

 (exercice
   "Pour diviser une collection, vous pouvez utiliser la fonction de partition"


Import ocp-build from OCamlPro/typerex@b2a8dbddac0ae973fdf2d1f3a509d134ed84d681

This is supposed to make ocp-build work again on windows


Add additional logging on exceptions (#1039)

--- scheduler/src/cook/mesos/api.clj
+++ scheduler/src/cook/mesos/api.clj
@@ -2711,6 +2711,24 @@
           (update :body body-matchers)
           (update :response resp-matchers)))))

+(defn- truncate
+  "Truncates `in-str` to a maximum length of `max-len` and adds an ellipsis if truncated."
+  [in-str max-len]
+  (let [ellipsis "..."
+        ellipsis-len (count ellipsis)]
+    (if (and (string? in-str) (> (count in-str) max-len) (> max-len ellipsis-len))
+      (str (subs in-str 0 (- max-len ellipsis-len)) ellipsis)
+      in-str)))
+
+(defn- logging-exception-handler
+  "Wraps `base-handler` with an additional `log/error` call which logs the request and exception"
+  [base-handler]
+  (fn logging-exception-handler [ex data req]
+    (log/error ex "Error when processing request"
+               (-> (dissoc req ::c-mw/options :body :ctrl :request-time :servlet-request :ssl-client-cert)
+                   (update-in [:headers] (fn [headers] (pc/map-vals (fn [value] (truncate value 80)) headers)))))
+    (base-handler ex data req)))
+
 ;;
 ;; "main" - the entry point that routes to other handlers
 ;;
@@ -2729,9 +2747,11 @@
                    :data {:info {:title "Cook API"
                                  :description "How to Cook things"}
                           :tags [{:name "api", :description "some apis"}]}}
+         ; Wrap all of the default exception handlers with more logging
+         :exceptions {:handlers (pc/map-vals (fn [handler] (logging-exception-handler handler))
+                                             (get-in c-mw/api-middleware-defaults [:exceptions :handlers]))}
          :format nil
          :coercion cook-coercer}
-
         (c-api/context
           "/rawscheduler" []
           (c-api/resource


drop requirements on SAM fns that could be set in globals (#169)

--- src/crucible/aws/serverless/function.clj
+++ src/crucible/aws/serverless/function.clj
@@ -14,6 +14,8 @@
   (spec-or-ref
    (s/or :string string?
          :s3-location ::sam/s3-location)))
+
+(s/def ::inline-code (spec-or-ref string?))

 (s/def ::function-name (spec-or-ref string?))

@@ -42,10 +44,13 @@
 (s/def ::tags ::sam/tags)

 (s/def ::function
-  (s/keys :req [::handler
-                ::runtime
-                ::code-uri]
-          :opt [::function-name
+  (s/keys :opt [::handler ; required but could be in globals
+                ::runtime ; required but could be in globals
+                ;; either code-uri or inline-code are required but either could
+                ;; be defined in globals
+                ::code-uri
+                ::inline-code
+                ::function-name
                 ::description
                 ::memory-size
                 ::timeout


Calculate level 2 subscriptions correctly again

--- src/day8/re_frame/trace/metamorphic.cljc
+++ src/day8/re_frame/trace/metamorphic.cljc
@@ -162,12 +162,9 @@
   (= :render (:op-type trace)))

 (defn unchanged-l2-subscription? [sub]
-  (and
-    (= :re-run (:type sub))
-    (= 2 (:layer sub))
-    (and (contains? sub :previous-value)
-         (contains? sub :value)
-         (= (:previous-value sub) (:value sub)))))
+  (and (get-in sub [:sub/traits :unchanged?])
+       (not-any? #(= :sub/dispose %) (:order sub))
+       (= 2 (get sub :layer))))

 (defn finish-run? [event]


figwheel.main: fall back to regular cljs repl when not root terminal process

--- figwheel-main/src/figwheel/main.cljc
+++ figwheel-main/src/figwheel/main.cljc
@@ -797,7 +797,13 @@
         (let [repl-fn (or (when-not (false? (:rebel-readline (::config *config*)))
                             (fw-util/require-resolve-var 'rebel-readline.cljs.repl/repl*))
                           cljs.repl/repl*)]
-          (repl-fn repl-env repl-options))))))
+          (try
+            (repl-fn repl-env repl-options)
+            (catch clojure.lang.ExceptionInfo e
+              (if (-> e ex-data :type (= :rebel-readline.jline-api/bad-terminal))
+                (do (println (.getMessage e))
+                    (cljs.repl/repl* repl-env repl-options))
+                (throw e)))))))))

 (defn serve [{:keys [repl-env repl-options eval-str join?]}]
   (log-server-start repl-env)


Tidy up sql generation

Tidy up sql generation

--- adressverzeichnis/clj-migrate/migrate.clj
+++ adressverzeichnis/clj-migrate/migrate.clj
@@ -69,10 +69,11 @@
 (defn get-adress [{:keys [Straße Zusatz Postleitzahl Ort]}]
   (when-not (every? str/blank? [Straße Zusatz Postleitzahl Ort])
     {:label ""
-     :strasse Straße
-     :zusatz Zusatz
-     :plz Postleitzahl
-     :stadt Ort}))
+     :strasse (or Straße "")
+     :zusatz (or Zusatz "")
+     :plz (or Postleitzahl "")
+     :stadt (or Ort "")
+     :land "Deutschland"}))

 (defn build-number [vorwahl nummer]
   (str vorwahl nummer))
@@ -83,15 +84,15 @@
   (let [not-blank? (complement str/blank?)]
     (cond-> []
       (not-blank? Telefonnummer1)
-      (conj {:label Telefonbezeichner1
+      (conj {:label (or Telefonbezeichner1 "")
              :nummer (build-number Vorwahl1 Telefonnummer1)})

       (not-blank? Telefonnummer2)
-      (conj {:label Telefonbezeichner2
+      (conj {:label (or Telefonbezeichner2 "")
              :nummer (build-number Vorwahl2 Telefonnummer2)})

       (not-blank? Telefonnummer3)
-      (conj {:label Telefonbezeichner3
+      (conj {:label (or Telefonbezeichner3 "")
              :nummer (build-number Vorwahl3 Telefonnummer3)}))))

 (defn parse-out-tel [person]
@@ -146,70 +147,81 @@
       (update :nicht_abdrucken #(Boolean/parseBoolean %))
       (update :stand #(get stand-map % nil))))

-(defmulti format-value type)
-(defmethod format-value String [value]
-  (str "'" value "'"))
-(defmethod format-value Boolean [value] value)
-(defmethod format-value nil [_] "NULL")
-
-(defn adress-sql [address old-id]
-  (let [fields (keys address)
-        values (map #(format-value (get address %)) fields)]
-    (if (every? str/blank? values)
-      ""
-      (str
-       "INSERT INTO public.adressverzeichnis_adresse (" (str/join "," (map name fields)) ",erstellt,veraendert,land,person_id) VALUES ("
-       (str/join "," values)
-       ",'now','now', 'Deutschland', (SELECT id FROM public.adressverzeichnis_person WHERE adressverzeichnis_person.alte_id = " old-id "));"))))
-
-(defn phone-sql [phone old-id]
-  (let [fields (keys phone)
-        values (map #(format-value (get phone %)) fields)]
-    (str
-      "INSERT INTO public.adressverzeichnis_telefon (" (str/join "," (map name fields)) ",erstellt,veraendert,person_id) VALUES ("
-      (str/join "," values)
-      ",'now','now', (SELECT id FROM public.adressverzeichnis_person WHERE adressverzeichnis_person.alte_id = " old-id "));")))
-
-(defn phones-sql [phones old-id]
-  (str/join "\n" (map #(phone-sql % old-id) phones)))
-
-(defn permissions-sql [permissions old-id]
-  (let [fields (keys (second (first permissions)))
-        values
-        (for [[organ-name permission] permissions
-              :let [values (map #(format-value (get permission %)) fields)]
-              :when (some true? values)]
-          (str "(" (str/join "," values) ",'now','now',"
-               "(SELECT id FROM public.adressverzeichnis_person WHERE adressverzeichnis_person.alte_id = " old-id "),"
-               "(SELECT id FROM public.adressverzeichnis_organ WHERE name = '" organ-name "'))"))]
-    (when (seq values)
-      (str
-       "INSERT INTO public.adressverzeichnis_manuelleberechtigung (" (str/join "," (map name fields)) ", erstellt, veraendert, person_id, organ_id) "
-       "VALUES "(str/join ", " values)";"))))
-
-(defn ordensgruppe-mitgliedschaft-sql [ordensgruppe old-id]
-  (when-not (str/blank? ordensgruppe)
-    (str
-      "INSERT INTO public.adressverzeichnis_amt (erstellt, veraendert, bestaetigt, gruppierung_id, person_id, typ_id)
-       VALUES ('now', 'now', false, "
-      (str/join ","
-        [(str "(SELECT id from public.adressverzeichnis_gruppierung WHERE adressverzeichnis_gruppierung.name = '" ordensgruppe "')")
-         (str "(SELECT id from public.adressverzeichnis_person WHERE adressverzeichnis_person.alte_id = " old-id ")")
-         (str "(SELECT id from public.adressverzeichnis_amttyp WHERE adressverzeichnis_amttyp.name = 'Mitglied')")])
-      ");")))
-
-(defn person-sql [person]
-  (let [person (dissoc person :Gruppe :Älterengemeinschaft  :Amt :Ordensamt :Übergeordnetegruppe :Änderungsdatum :Hilfsgruppe)
-
-        fields (keys (dissoc person :address :numbers :permissions :Ordensgruppe))
-        old-id (:alte_id person)]
-    (str/join "\n"
-     [(str "INSERT INTO adressverzeichnis_person (" (str/join "," (map name fields)) ",erstellt, veraendert) VALUES (" (str/join "," (map #(format-value (get person %)) fields)) ",'now','now');")
-      (adress-sql (:address person) old-id)
-      (phones-sql (:numbers person) old-id)
-      (permissions-sql (:permissions person) old-id)
-      (ordensgruppe-mitgliedschaft-sql (:Ordensgruppe person) old-id)
-      ""])))
+
+;;;; SQL-Map generation functions
+
+(defn amttypen-sql [_persons]
+  (-> (insert-into :public.adressverzeichnis_amttyp)
+      (values [{:name "Mitglied"}])))
+
+(defn ordensmitgliedschaften-sql [persons]
+  (-> (insert-into :public.adressverzeichnis_amt)
+      (values
+       (for [{:keys [Ordensgruppe alte_id]} persons
+             :when Ordensgruppe]
+         {:bestaetigt false
+          :gruppierung_id
+          (-> (select :id) (from :public.adressverzeichnis_gruppierung) (where [:= :name Ordensgruppe]))
+          :person_id
+          (-> (select :id) (from :public.adressverzeichnis_person) (where [:= :alte_id alte_id]))
+          :typ_id
+          (-> (select :id) (from :public.adressverzeichnis_amttyp) (where [:= :name "Mitglied"]))}))))
+
+(defn addresses-sql [persons]
+  (-> (insert-into :public.adressverzeichnis_adresse)
+      (values (for [{:keys [address alte_id]} persons]
+                (assoc address
+                       :person_id
+                       (-> (select :id)
+                           (from :public.adressverzeichnis_person)
+                           (where [:= :alte_id alte_id])))))))
+
+(defn phones-sql [persons]
+  (-> (insert-into :public.adressverzeichnis_telefon)
+      (values
+       (apply concat
+        (for [{:keys [numbers alte_id]} persons]
+          (for [phone numbers]
+            (assoc phone
+                   :person_id
+                   (-> (select :id)
+                       (from :public.adressverzeichnis_person)
+                       (where [:= :alte_id alte_id])))))))))
+
+(defn persons-sql [persons]
+  (-> (insert-into :public.adressverzeichnis_person)
+      (values
+       (map #(merge
+              {:anmerkung ""
+               :anrede ""
+               :titel ""
+               :vorname ""
+               :fahrtenname ""
+               :nachname ""}
+              (select-keys % #{:stand :anmerkung :email :nicht_abdrucken :geburtstag :titel :fahrtenname :nachname :alte_id :todestag :vorname :nrw :anrede}))
+          persons))))
+
+(def organe #{"Bundesrat" "Bundesmädchenrat" "Bundesjungenrat" "Bundesthing"})
+
+(defn organs-sql []
+  (-> (insert-into :public.adressverzeichnis_organ)
+      (values (for [organ organe]
+                {:name organ}))))
+
+(defn permission-sql [permissions alte_id]
+  (for [[organ permission] permissions
+        :when (some true? (map second permission))]
+    (assoc permission
+           :organ_id (-> (select :id) (from :public.adressverzeichnis_organ) (where [:= :name organ]))
+           :person_id (-> (select :id) (from :public.adressverzeichnis_person) (where [:= :alte_id alte_id])))))
+
+(defn pemissions-sql [persons]
+  [(organs-sql)
+   (-> (insert-into :public.adressverzeichnis_manuelleberechtigung)
+       (values
+        (apply concat
+          (for [{:keys [permissions alte_id]} persons]
+            (permission-sql permissions alte_id)))))])

 (defn ordensgruppe-typ [ordensgruppe]
   (and ordensgruppe
@@ -249,7 +261,6 @@
                  :when (not (str/blank? gemeinschaft))]
              {:name gemeinschaft}))))

-
 (defn unmittelbar?
   ([{:keys [Übergeordnetegruppe Gruppe]}]
    (= Übergeordnetegruppe Gruppe))
@@ -318,19 +329,26 @@
    (first)
    (str ";")))

+(defn wrap-in-transaction [& x]
+  (str (apply str "BEGIN;\n" x) "\nCOMMIT;"))
+
 (print
   (let [persons (map parse-person old)
         gruppierungen (disj (into #{} (map #(select-keys % #{:Übergeordnetegruppe :Gruppe})) persons) {})]
-      (str "BEGIN;\n"
-        (str/join "\n"
+    (wrap-in-transaction
+      (str/join "\n"
+        (map format-sql
           (concat
-            (map format-sql
-              (concat
-                [(gruppierungs-typ-sql)]
-                (gruppierungen-sql (topo-sort gruppierungen))
-                (let [ordensgruppen (into #{} (map #(select-keys % #{:Ordensgruppe :Älterengemeinschaft})) persons)]
-                  [(älterengemeinschaften-sql (set (map :Älterengemeinschaft ordensgruppen)))
-                   (ordensgruppe-types-sql (disj (set (map ordensgruppe-typ (map :Ordensgruppe ordensgruppen))) nil))
-                   (ordensgruppen-sql ordensgruppen)])))
-            #_(map person-sql persons)))
-        "\nCOMMIT;")))+           [(gruppierungs-typ-sql)]
+           (gruppierungen-sql (topo-sort gruppierungen))
+           (let [ordensgruppen (into #{} (map #(select-keys % #{:Ordensgruppe :Älterengemeinschaft})) persons)]
+             [(älterengemeinschaften-sql (set (map :Älterengemeinschaft ordensgruppen)))
+              (ordensgruppe-types-sql (disj (set (map ordensgruppe-typ (map :Ordensgruppe ordensgruppen))) nil))
+              (ordensgruppen-sql ordensgruppen)])
+           [(persons-sql persons)
+            (addresses-sql persons)
+            (phones-sql persons)]
+           (pemissions-sql persons)
+           [(amttypen-sql persons)
+            (ordensmitgliedschaften-sql persons)]))))))
+


:sparkles: Add download lightbox to view mode

--- frontend/src/uxbox/view/ui/viewer/nav.cljs
+++ frontend/src/uxbox/view/ui/viewer/nav.cljs
@@ -9,6 +9,7 @@
   (:require [potok.core :as ptk]
             [uxbox.builtins.icons :as i]
             [rumext.core :as mx :include-macros true]
+            [uxbox.main.data.lightbox :as udl]
             [uxbox.view.store :as st]
             [uxbox.view.data.viewer :as dv]))

@@ -17,7 +18,8 @@
   (let [toggle-sitemap #(st/emit! (dv/toggle-flag :sitemap))
         toggle-interactions #(st/emit! (dv/toggle-flag :interactions))
         sitemap? (contains? flags :sitemap)
-        interactions? (contains? flags :interactions)]
+        interactions? (contains? flags :interactions)
+        on-download #(udl/open! :download)]
     [:div.view-nav
      [:ul.view-options-btn
       [:li.tooltip.tooltip-right
@@ -33,4 +35,6 @@
       [:li.tooltip.tooltip-right
        {:alt "share"} i/export]
       [:li.tooltip.tooltip-right
-       {:alt "save SVG"} i/save]]]))
+       {:alt "save SVG"
+        :on-click on-download}
+       i/save]]]))


Make types tests somewhat complete.

Make types tests somewhat complete.

--- test/guangyin/internal/types_test.clj
+++ test/guangyin/internal/types_test.clj
@@ -2,12 +2,32 @@
   (:require [clojure.test :refer :all]
             [guangyin.internal.fields :refer :all]
             [guangyin.internal.types :refer :all]))
+
+(deftest test-wrapped
+  (let [obj (Object.)
+        wrapped (wrap obj)]
+    (is (= obj @wrapped))
+    (is (= obj (unwrap obj)))
+    (is (= obj (unwrap wrapped)))
+    (is (= wrapped (wrap wrapped)))
+    (is (with-out-str (prn obj)) (with-out-str (prn wrapped)))))
+
+(deftest test-date-time-format
+  (let [dtf java.time.format.DateTimeFormatter/ISO_INSTANT
+        wrapped (wrap dtf)
+        str "1970-01-01T00:00:00Z"]
+    (is (= dtf @wrapped))
+    (is (= dtf (unwrap dtf)))
+    (is (= dtf (unwrap wrapped)))
+    (is (= str (wrapped (java.time.Instant/parse str))))))

 (deftest test-temporal
   (let [date (java.time.LocalDate/parse "2015-01-10")
         newdate (java.time.LocalDate/parse "2016-01-10")
         wrapped (wrap date)]
     (is (= date @wrapped))
+    (is (= date (unwrap date)))
+    (is (= date (unwrap wrapped)))
     (is (= 2015 (:year wrapped)))
     (is (= 1 (:month-of-year wrapped)))
     (is (= 10 (:day-of-month wrapped)))
@@ -18,3 +38,38 @@
     (is (= :year (.key (find wrapped :year))))
     (is (= 2015 (.val (find wrapped :year))))
     (is (= newdate @(assoc wrapped :year 2016)))))
+
+(deftest test-temporal-accessor
+  (let [month (java.time.Month/of 6)
+        wrapped (wrap month)]
+    (is (= month @wrapped))
+    (is (= month (unwrap month)))
+    (is (= month (unwrap wrapped)))
+    (is (= 6 (:month-of-year wrapped)))
+    (is (= nil (:year wrapped)))
+    (is (= 42 (get wrapped :year 42)))))
+
+(deftest test-duration
+  (let [duration (java.time.Duration/parse "PT1H2M3S")
+        wrapped (wrap duration)]
+    (is (= duration @wrapped))
+    (is (= duration (unwrap duration)))
+    (is (= duration (unwrap wrapped)))
+    (is (= nil (:days wrapped)))
+    (is (= 1 (:hours wrapped)))
+    (is (= 62 (:minutes wrapped)))
+    (is (= 3723 (:seconds wrapped)))
+    (is (= 3723000 (:millis wrapped)))
+    (is (= 3723000000 (:micros wrapped)))
+    (is (= 3723000000000 (:nanos wrapped)))))
+
+(deftest test-temporal-amount
+  (let [period (java.time.Period/parse "P1Y2M3D")
+        wrapped (wrap period)]
+    (is (= period @wrapped))
+    (is (= period (unwrap period)))
+    (is (= period (unwrap wrapped)))
+    (is (= 1 (:years wrapped)))
+    (is (= 2 (:months wrapped)))
+    (is (= 3 (:days wrapped)))
+    (is (= nil (:hours wrapped)))))


cleanup

cleanup

--- src/selmer/tags.clj
+++ src/selmer/tags.clj
@@ -102,6 +102,17 @@
           [(TextNode. "")]))
     context-map))

+(defn if-numeric-handler [[p1 p2 p3 p4 :as params] if-tags else-tags render]
+  (cond
+    (and p4 (not= p1 "not"))
+    (throw (Exception. (str "invalid params for if-tag: " params)))
+
+    (= "not" p1)
+    #(render-if-numeric render true (parse-numeric-params p2 p3 p4) % if-tags else-tags)
+
+    :else
+    #(render-if-numeric render false (parse-numeric-params p1 p2 p3) % if-tags else-tags)))
+
 (defn render-if-any-all [not? op params if-tags else-tags render]
   (let [filters (map compile-filter-body params)]
     (fn [context-map]
@@ -111,17 +122,6 @@
         (let [test (op #{true} (map #(if-result (% context-map)) filters))]
           (if not? (not test) test))
         if-tags else-tags))))
-
-(defn if-numeric-handler [[p1 p2 p3 p4 :as params] if-tags else-tags render]
-  (cond
-    (and p4 (not= p1 "not"))
-    (throw (Exception. (str "invalid params for if-tag: " params)))
-
-    (= "not" p1)
-    #(render-if-numeric render true (parse-numeric-params p2 p3 p4) % if-tags else-tags)
-
-    :else
-    #(render-if-numeric render false (parse-numeric-params p1 p2 p3) % if-tags else-tags)))

 (defn if-handler [params tag-content render rdr]
   (let [{if-tags :if else-tags :else} (tag-content rdr :if :else :endif)]
@@ -152,7 +152,7 @@
     (fn [context-map] (render content context-map))))

 (defn now-handler [args _ _ _]
-  (fn [context-map]
+  (fn [context-map]
     ((:date @filters) (java.util.Date.) (clojure.string/join " " args))))

 (defn comment-handler [args tag-content render rdr]
@@ -226,7 +226,7 @@
            (apply str (map #(.render-node ^selmer.node.INode % context-map) node))))])))

 (defn tag-handler [handler & tags]
-  (fn [args tag-content render rdr]
+  (fn [args tag-content render rdr]
      (if-let [content (if (> (count tags) 1) (apply (partial tag-content rdr) tags))]
        (-> (fn [context-map]
              (render


update some cheatsheet sections

update some cheatsheet sections

--- cljs-cheatsheet/cljs_cheatsheet/html.cljs
+++ cljs-cheatsheet/cljs_cheatsheet/html.cljs
@@ -95,8 +95,14 @@
         [:tr.odd-372e6
           [:td.label-9e0b7 "Compare"]
           [:td.body-885f4
-            (fn-link "and" )
-            (fn-link "or")]]
+            (fn-link "=")
+            (fn-link "not=")
+            (fn-link "and")
+            (fn-link "or")
+            ;; TODO: need to add the .cljsdoc file for these
+            ;; (fn-link "not")
+            ;; (fn-link "identical?")
+            (fn-link "compare")]]
         [:tr.even-ff837
           [:td.label-9e0b7 "Loop"]
           [:td.body-885f4
@@ -191,7 +197,8 @@
             (fn-link "<")
             (fn-link ">")
             (fn-link "<=")
-            (fn-link ">=")]]
+            (fn-link ">=")
+            (fn-link "compare")]]
         [:tr.even-ff837
           [:td.label-9e0b7 "Cast"]
           [:td.body-885f4


naive support to date casting in parser

naive support to date casting in parser

--- src/spcr/parser.clj
+++ src/spcr/parser.clj
@@ -16,6 +16,23 @@
     (Float. str)
     str))

+(defn str->num [str]
+  (Float. str))
+
+(defn date? [str]
+  (re-matches #"[0-9]{4}-[0-9]{2}-[0-9]{2}" str))
+
+(defn str->date [str]
+  (.parse
+      (java.text.SimpleDateFormat. "yyyy-MM-dd")
+      str))
+
+(defn try-cast [str]
+  (cond
+   (numeric? str)  (str->num str)
+   (date? str) (str->date str)
+   :default str))
+
 (defn file->list [path]
   (with-open [input-file (io/reader path)]
     (doall
@@ -23,7 +40,7 @@

 (defn list->dicts [[header & body]]
   (let [keys (map keyword header)]
-    (map #(zipmap keys (map cast-numerics %))
+    (map #(zipmap keys (map try-cast %))
          body)))

 (defn file->dicts [path]


disable export

disable export

--- src/survey/core.clj
+++ src/survey/core.clj
@@ -115,9 +115,9 @@
                                  :handle-ok (slurp "resources/data/questionnaire.json")))
   (ANY "/answers" []
      (resource
-      :allowed-methods [:post :get]
+      :allowed-methods [:post ]
       :available-media-types ["application/json"]
-      :handle-ok (read-answer)
+;;      :handle-ok (read-answer)
       :post! (fn [ctx]
                (if-let [body (body-as-string ctx)]
                  (try


Allow setting the global log level [IMMUTANT-481]

--- core/src/immutant/util.clj
+++ core/src/immutant/util.clj
@@ -120,3 +120,10 @@
                  (apply str ".set")
                  symbol)]
     ((eval `#(~setter %1 %2)) bean value)))
+
+(defn set-log-level!
+  "Sets the global log level for the interal logging system.
+
+   Valid options for `level` are: :OFF, :ERROR, :WARN, :INFO, :DEBUG, :TRACE, :ALL"
+  [level]
+  (WunderBoss/setLogLevel (name level)))


Remove wrap-server middleware.

Remove wrap-server middleware.

--- src/webdev/core.clj
+++ src/webdev/core.clj
@@ -28,10 +28,6 @@
   (fn [req]
     (hdlr (assoc req :webdev/db db))))

-(defn wrap-server [hdlr]
-  (fn [req]
-    (assoc-in (hdlr req) [:headers "Server"] "Webdev Spike")))
-
 (def sim-methods {"PUT" :put "DELETE" :delete})

 (defn wrap-simulated-methods [hdlr]
@@ -42,13 +38,12 @@
       (hdlr req))))

 (def app
-  (wrap-server
-    (wrap-file-info
-      (wrap-resource
-        (wrap-db
-          (wrap-params
-            (wrap-simulated-methods routes)))
-        "static"))))
+  (wrap-file-info
+    (wrap-resource
+      (wrap-db
+        (wrap-params
+          (wrap-simulated-methods routes)))
+      "static")))

 (defn -main [port]
   (migration/create-table db)


delta-position 0.1.0.1: update the project file.

--- delta-position/project.clj
+++ delta-position/project.clj
@@ -1,9 +1,9 @@
-(defproject leijure/delta-position "0.1.0"
+(defproject leijure/delta-position "0.1.0.1"
   :description "incremental position"
   ;; :url "TBD"
   :license {:name "Apache License 2.0"
             :url "http://www.apache.org/licenses/"}
-  :dependencies [[org.clojure/clojure "1.6.0"]]
+  :dependencies [[org.clojure/clojure "1.7.0"]]
   :source-paths ["src"]
   :test-paths ["test"]
-  :main leijure.delta-position)
+  :aot :all)


use activeElement for paste also

use activeElement for paste also

--- src-cljs/frontend/clipboard.cljs
+++ src-cljs/frontend/clipboard.cljs
@@ -227,7 +227,7 @@
           ;; don't apply if input or textarea is focused, unless the copy-hack
           ;; element is selected (see components.canvas)
           (or (= "_copy-hack" (.-id target))
-              (not (contains? #{"input" "textarea"} (str/lower-case (.-tagName target))))))
+              (not (contains? #{"input" "textarea"} (str/lower-case (.-tagName js/document.activeElement))))))
     (when-let [layer-data (some->> (.getData (.-clipboardData e) "text")
                             (parse-pasted))]
       (let [canvas-size (utils/canvas-size)]


Allow blocks to work on iPad

Allow blocks to work on iPad

By using the touch start event when things are clicked

--- idecode/myappshare/mainapp.cljs
+++ idecode/myappshare/mainapp.cljs
@@ -181,17 +181,18 @@

 (defn add-blocks [section-name  block-names]
-  (div {
-         :onMouseOver
-         (fn [e]
-           (js/uuuttt
-             (str "<xml>"
-                  (apply str
-                         (map (fn [x] (str "<block type=\"" x "\"></block>"))
-                              block-names))
-                  "</xml>")))
-         }
-       section-name))
+  (let [xxx (fn [e]
+              (js/uuuttt
+                (str "<xml>"
+                     (apply str
+                            (map (fn [x] (str "<block type=\"" x "\"></block>"))
+                                 block-names))
+                     "</xml>")))]
+    (div {
+           :onMouseOver  xxx
+           :onTouchStart  xxx
+           }
+         section-name)))


Search refactor

Search refactor

--- src/clj/clj_templates/search.clj
+++ src/clj/clj_templates/search.clj
@@ -16,38 +16,78 @@
   {:hit-count (get-in es-response [:body :hits :total])
    :templates (mapv (comp adapt-template-to-api :_source) (get-in es-response [:body :hits :hits]))})

-(defn index-template
-  ([es-client {:keys [template-name build-system] :as template} {:keys [refresh?]}]
-   (es/request es-client {:url    (es-utils/url (conj index-url (str template-name "-" build-system) (when refresh? "?refresh=true")))
-                          :method :post
-                          :body   template}))
-  ([es-client template]
-   (index-template es-client template {})))
+(defn search-query [search-string]
+  {:function_score
+   {:query              {:multi_match {:query  search-string
+                                       :type   :best_fields
+                                       :fields ["template-name.raw^3"
+                                                "template-name^3"
+                                                "description^2"
+                                                "github-readme"]}}
+    :field_value_factor {:field    "downloads"
+                         :modifier "log1p"}}})
+
+(def match-all-query
+  {:function_score
+   {:query              {:match_all {}}
+    :field_value_factor {:field "downloads"}}})
+
+(def ngram-analysis
+  {:analysis
+   {:filter   {:autocomplete_filter
+               {:type     "ngram"
+                :min_gram 1
+                :max_gram 20}}
+    :analyzer {:autocomplete
+               {:type      "custom"
+                :tokenizer "standard"
+                :filter    ["lowercase" "autocomplete_filter"]}}}})
+
+(def mappings
+  {:template
+   {:properties
+    {:template-name {:type            "text"
+                     :analyzer        "autocomplete"
+                     :search_analyzer "standard"
+                     :fields          {:raw {:type "keyword"}}}
+     :description   {:type            "text"
+                     :analyzer        "autocomplete"
+                     :search_analyzer "standard"}
+     :build-system  {:type "keyword"}
+     :github-url    {:type "keyword"}
+     :github-id     {:type "keyword"}
+     :github-stars  {:type "integer"}
+     :github-readme {:type            "text"
+                     :analyzer        "autocomplete"
+                     :search_analyzer "standard"}
+     :homepage      {:type "keyword"}
+     :downloads     {:type "integer"}}}})
+
+(defn search-templates [es-client search-string from size]
+  (adapt-to-api
+    (es/request es-client {:url    (es-utils/url search-url)
+                           :method :get
+                           :body   {:query (search-query search-string)
+                                    :from  from
+                                    :size  size}})))

 (defn match-all-templates [es-client from size]
   (adapt-to-api
     (es/request es-client {:url    (es-utils/url search-url)
                            :method :get
-                           :body   {:query {:function_score {:query              {:match_all {}}
-                                                             :field_value_factor {:field "downloads"}}}
+                           :body   {:query match-all-query
                                     :from  from
                                     :size  size}})))

-(defn search-templates [es-client search-string from size]
-  (adapt-to-api
-    (es/request es-client {:url    (es-utils/url search-url)
-                           :method :get
-                           :body   {:query {:function_score
-                                            {:query              {:multi_match {:query  search-string
-                                                                                :type   :best_fields
-                                                                                :fields ["template-name.raw^3"
-                                                                                "template-name^3"
-                                                                                "description^2"
-                                                                                "github-readme"]}}
-                                             :field_value_factor {:field    "downloads"
-                                                                  :modifier "log1p"}}}
-                                    :from  from
-                                    :size  size}})))
+(defn index-template
+  ([es-client {:keys [template-name build-system] :as template} {:keys [refresh?]}]
+   (es/request es-client {:url    (es-utils/url (conj index-url
+                                                      (str template-name "-" build-system)
+                                                      (when refresh? "?refresh=true")))
+                          :method :post
+                          :body   template}))
+  ([es-client template]
+   (index-template es-client template {})))

 (defn delete-index [es-client]
   (es/request es-client {:url    (es-utils/url base-url)
@@ -57,40 +97,15 @@
 (defn create-index [es-client]
   (es/request es-client {:url    (es-utils/url base-url)
                          :method :put
-                         :body   {:settings {:analysis
-                                             {:filter   {:autocomplete_filter
-                                                         {:type     "ngram"
-                                                          :min_gram 1
-                                                          :max_gram 20}}
-                                              :analyzer {:autocomplete
-                                                         {:type      "custom"
-                                                          :tokenizer "standard"
-                                                          :filter    ["lowercase" "autocomplete_filter"]}}}}
-                                  :mappings {:template
-                                             {:properties
-                                              {:template-name {:type            "text"
-                                                               :analyzer        "autocomplete"
-                                                               :search_analyzer "standard"
-                                                               :fields          {:raw {:type "keyword"}}}
-                                               :description   {:type            "text"
-                                                               :analyzer        "autocomplete"
-                                                               :search_analyzer "standard"}
-                                               :build-system  {:type "keyword"}
-                                               :github-url    {:type "keyword"}
-                                               :github-id     {:type "keyword"}
-                                               :github-stars  {:type "integer"}
-                                               :github-readme {:type            "text"
-                                                               :analyzer        "autocomplete"
-                                                               :search_analyzer "standard"}
-                                               :homepage      {:type "keyword"}
-                                               :downloads     {:type "integer"}}}}}}))
+                         :body   {:settings ngram-analysis
+                                  :mappings mappings}}))

 (defmethod ig/init-key :search/elastic [_ {:keys [hosts default-headers]}]
   (let [es-client (es/client {:default-headers default-headers
                               :hosts           hosts})]
     (try
       (create-index es-client)
-      (catch Exception e))
+      (catch Exception _))
     es-client))

 (defmethod ig/halt-key! :search/elastic [_ es-client]


Correct name of injected value in make-routes

--- src/clj/comic_reader/web_app.clj
+++ src/clj/comic_reader/web_app.clj
@@ -40,7 +40,7 @@
                        "js/foundation.min.js")
      ~@js]))

-(defn- make-routes [site-scraper]
+(defn- make-routes [repository]
   (c/routes
     (c/GET "/" []
       (render-page
@@ -61,7 +61,7 @@
        :js [(page/include-js "js/compiled/devcards.js")]))

     (c/context "/api/v1" []
-      (-> (make-api-routes site-scraper)
+      (-> (make-api-routes repository)
           wrap-params
           wrap-edn-params))


Package-level api-doc and cleanup in lambdacd.steps.shell

--- src/clj/lambdacd/steps/shell.clj
+++ src/clj/lambdacd/steps/shell.clj
@@ -1,11 +1,10 @@
 (ns lambdacd.steps.shell
+  "Build step to run scripts in a separate shell process. Needs `bash` to run."
   (:require [lambdacd.steps.support :as support]
             [clojure.java.io :as io]
             [clojure.string :as string]
             [me.raynes.conch.low-level :as sh]
-            [lambdacd.util :as utils]
             [clojure.core.async :as async]
-            [lambdacd.util :as util]
             [lambdacd.util.internal.temp :as temp-util])
   (:import (java.util UUID)
            (java.io IOException)


Don't reload if editor isn't found

Don't reload if editor isn't found

--- src/clj/nightcode/controller.clj
+++ src/clj/nightcode/controller.clj
@@ -294,9 +294,11 @@
   (when-let [webview (.lookup scene "#webview")]
     (let [text (.executeScript (.getEngine webview) "getTextContent()")
           text (str "(do" \newline text \newline ")" \newline)
-          builder-webview (b/get-builder-webview @pref-state @runtime-state)
-          builder-bridge (-> (.getEngine builder-webview) (.executeScript "window") (.getMember "java"))]
-      (.onenter builder-bridge text))))
+          builder-webview (b/get-builder-webview @pref-state @runtime-state)]
+      (some-> (.getEngine builder-webview)
+              (.executeScript "window")
+              (.getMember "java")
+              (.onenter text)))))

 (defn -onReloadFile [this ^ActionEvent event]
   (-> event .getSource .getScene reload-file!))
@@ -307,9 +309,11 @@
   (when-let [webview (.lookup scene "#webview")]
     (when-let [text (.executeScript (.getEngine webview) "getSelectedText()")]
       (let [text (str "(do" \newline text \newline ")" \newline)
-            builder-webview (b/get-builder-webview @pref-state @runtime-state)
-            builder-bridge (-> (.getEngine builder-webview) (.executeScript "window") (.getMember "java"))]
-        (.onenter builder-bridge text)))))
+            builder-webview (b/get-builder-webview @pref-state @runtime-state)]
+        (some-> (.getEngine builder-webview)
+                (.executeScript "window")
+                (.getMember "java")
+                (.onenter text))))))

 (defn -onReloadSelection [this ^ActionEvent event]
   (-> event .getSource .getScene reload-selection!))


Simplified sexp-to-definition'

Simplified sexp-to-definition'

--- parser/parser.clj
+++ parser/parser.clj
@@ -193,20 +193,18 @@
                  (sexp-to-arguments (pair-left body))))
                  (sexp-to-function-body range rest)))

-(def sexp-to-definition' (kind-symbol name rest range)
-     (result-flatmap (fn (kind)
-                         (match (type-definition? kind)
-                                True   (sexp-to-type-definition name rest range)
-                                False
-                         (match (function-definition? kind)
-                                True   (sexp-to-function-definition name rest range)
-                                False  (Error (MalformedDefinitionError range)))))
-                     (symbol-to-string kind-symbol)))
+(def sexp-to-definition' (name rest range kind)
+     (match (type-definition? kind)
+            True   (sexp-to-type-definition name rest range)
+            False
+     (match (function-definition? kind)
+            True   (sexp-to-function-definition name rest range)
+            False  (Error (MalformedDefinitionError range)))))

 (def sexp-to-definition (expression)
      (match expression
             (List (Cons kind (Cons name rest)) range)
-                (sexp-to-definition' kind name rest range)
+                (result-flatmap (sexp-to-definition' name rest range) (symbol-to-string kind))
             (List _ range)
                 (Error (MalformedDefinitionError range))
             (Symbol _ range)


only use hawk on osx

only use hawk on osx

--- src/main/shadow/cljs/devtools/server/fs_watch.clj
+++ src/main/shadow/cljs/devtools/server/fs_watch.clj
@@ -10,13 +10,13 @@

 (defn start [config directories file-exts publish-fn]
   (let [ns-sym
-        (if (str/includes? os-name "Windows")
-          ;; jvm on windows supports watch fine
-          'shadow.cljs.devtools.server.fs-watch-jvm
+        (if (str/includes? os-name "Mac")
           ;; macOS doesn't have native support so it uses polling
           ;; which means 2sec delay, hawk does the native stuff
           ;; so its a lot faster but doesn't properly support delete
-          'shadow.cljs.devtools.server.fs-watch-hawk)]
+          'shadow.cljs.devtools.server.fs-watch-hawk
+          ;; jvm on windows/linux supports watch fine
+          'shadow.cljs.devtools.server.fs-watch-jvm)]

     (log/debug ::fs-watch {:ns ns-sym})


shuffle parents while generating in (lightning-bolt)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -145,7 +145,7 @@
       (log/debug (str "lightning-bolt(depth=" depth "; total-depth=" total-depth "; cat=" (get-in spec [:synsem :cat]) ")"))
       (let [morph (if morph morph (fn [input] (get-in input [:rule] :default-morph-no-rule)))
             depth (if depth depth 0)
-            parents (filter #(not (fail? %)) (mapfn (fn [rule] (unifyc spec rule)) grammar))]
+            parents (shuffle (filter #(not (fail? %)) (mapfn (fn [rule] (unifyc spec rule)) grammar)))]
         (let [lexical ;; 1. generate list of all phrases where the head child of each parent is a lexeme.
               (mapcat (fn [parent]
                         (if (= false (get-in parent [:head :phrasal] false))


less calls to (vals)

less calls to (vals)

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -145,18 +145,18 @@
                   (fn [bolt-at]
                     (if (= false (get-in bolt-at [:phrasal]))
                       [(do-defaults (assoc-in bolt path bolt-at) model)]
-                      (let [comps-map (comp-paths-to-bolts-map bolt-at model (+ 1 depth) max-depth)]
-                        (when (not (some empty? (vals comps-map)))
-                          (let [comp-paths (keys comps-map)
-                                comp-bolts (vals comps-map)]
-                            (mapfn #(do-defaults (assoc-in bolt path %) model)
-                                   (add-comps bolt-at
-                                              model
-                                              comp-paths
-                                              comp-bolts
-                                              (+ 1 depth)
-                                              max-depth
-                                              top-bolt)))))))
+                      (let [comps-map (comp-paths-to-bolts-map bolt-at model (+ 1 depth) max-depth)
+                            comp-paths (keys comps-map)
+                            comp-bolts (vals comps-map)]
+                        (when (not (some empty? comp-bolts))
+                          (mapfn #(do-defaults (assoc-in bolt path %) model)
+                                 (add-comps bolt-at
+                                            model
+                                            comp-paths
+                                            comp-bolts
+                                            (+ 1 depth)
+                                            max-depth
+                                            top-bolt))))))
                   bolts-at))))))))
 (defn generate2
   "Return all expressions matching spec _spec_ given the model _model_."
@@ -171,7 +171,7 @@
               ;; that for every path that points to a complement of a bolt,
               ;; there is a non-empty set of bolts that satisfies
               ;; that complement's path.
-              (when (not (some empty? (vals comps-map)))
+              (when (not (some empty? comp-bolts))
                 (mapfn #(do-defaults % model)
                        (add-comps bolt
                                   model


Small UI _

Small UI _

--- src/ci3/server/core.clj
+++ src/ci3/server/core.clj
@@ -8,11 +8,30 @@
    [unifn.formats]
    [unifn.core :as u]
    [unifn.env :as e]
+   [hiccup.core :as hiccup]
+   [hiccup.page :as page]
+   [garden.core :as css]
+   [clojure.walk :as walk]
    [ci3.k8s :as k8s]))
+
+(defn layout [cnt]
+  (page/html5
+   [:head
+    [:meta {:charset "utf-8"}]
+    [:link {:rel "stylesheet" :href "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css"}]
+    [:link {:rel "stylesheet" :href     "https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"}]]
+   [:body
+    [:style (css/css [:body {:padding "0 20px"} [:.top {:padding "5px 10px" :background-color "#eee" :margin-bottom "10px"}]])]
+    [:div.container-fluid.top "ci3"]
+    cnt]))

 (defmethod u/*fn ::routes
   [{{routes :routes} :cache}]
   {:response {:body (var-get routes)}})
+
+(defmethod u/*fn ::index
+  [arg]
+  {:response {:body (layout [:b "CI3"])}})

 (defmethod u/*fn ::watches [_]
   {:response {:status 200
@@ -28,8 +47,41 @@
   [{req :request}]
   {:response {:status 200 :body "Ok! Wait for hook"}})

+
+(defmethod u/*fn
+  ::builds
+  [{req :request}]
+  (let [bs (walk/keywordize-keys (k8s/list k8s/cfg :builds))]
+    {:response
+     {:status 200
+      :body
+      (layout
+         [:div.container
+          (for [b (reverse (sort-by (fn [x] (get-in x [:payload :commit :timestamp])) (:items bs)))]
+              [:div {:key (get-in b [:metadata :name])}
+               [:a {   :href (str "/builds/" (get-in b [:metadata :name]))}
+                [:b (get-in b [:payload :commit :timestamp])]
+                " by "
+                [:span (get-in b [:commit :author :name])]
+                " - "
+                [:span (get-in b [:commit :message])]]
+               [:div "pod: "   (get-in b [:metadata :name])]
+               [:hr]])])
+      :headers {"Content-Type" "text/html"}}}))
+
+(defmethod u/*fn
+  ::logs
+  [{{{id :id} :route-params} :request}]
+  (let [logs (k8s/curl {} (str  "api/v1/namespaces/default/pods/build-" id "/log"))]
+    {:response
+     {:status 200
+      :body (layout
+             [:div.container-fluid
+              [:pre logs]])
+      :headers {"Content-Type" "text/html"}}}))
+
 (def routes
-  {:GET ::routes
+  {:GET ::index
    "repositories" {:GET ::repositories}
    "watches"      {:GET ::watches}
    "webhook" { [:id] {:POST ::repo/webhook


Whitespace

Whitespace

--- src/clojars/web/jar.clj
+++ src/clojars/web/jar.clj
@@ -50,10 +50,10 @@

 (defn- vcs-host-tree-link [jar link-text]
   (try
-   (when-some [url (vcs-host-tree-url jar)]
-     (link-to url link-text))
-   (catch Exception _
-     nil)))
+    (when-some [url (vcs-host-tree-url jar)]
+      (link-to url link-text))
+    (catch Exception _
+      nil)))

 (defn dependency-link [db dep]
   (link-to
@@ -99,24 +99,24 @@
        :name jar_name}]
      [{:url  (str "https://clojars.org/groups/" group_name)
        :name group_name}
-       ;; TODO: Not sure if this is a dirty hack or a stroke of brilliance
+      ;; TODO: Not sure if this is a dirty hack or a stroke of brilliance
       {:url  (str "https://clojars.org/" (jar-name jar))
        :name jar_name}])))

 (defn- vcs-logo [type]
   (apply helpers/retinized-image
-   (case type
-     :github ["/images/github-mark.png" "GitHub"]
-     :gitlab ["/images/gitlab-mark-black.png" "GitLab"]
-     ["/images/git-mark.png" "VCS"])))
+         (case type
+           :github ["/images/github-mark.png" "GitHub"]
+           :gitlab ["/images/gitlab-mark-black.png" "GitLab"]
+           ["/images/git-mark.png" "VCS"])))

 (defn- vcs-host-link [jar]
   (let [unknown [:p (vcs-logo :unknown) "N/A"]]
     (if-some [{:keys [repo-url type user repo-name]} (vcs-host-info jar)]
       (try
         (link-to repo-url
-                (vcs-logo type)
-                (format "%s/%s" user repo-name))
+                 (vcs-logo type)
+                 (format "%s/%s" user repo-name))
         (catch Exception _
           unknown))
       unknown)))
@@ -208,8 +208,8 @@
       [:li (link-to (jar-versioned-url (assoc jar
                                               :version (:version v)))
                     (:version v))])]
-    ;; by default, 5 versions are shown. If there are only 5 to
-    ;; see, then there's no reason to show the 'all versions' link
+   ;; by default, 5 versions are shown. If there are only 5 to
+   ;; see, then there's no reason to show the 'all versions' link
    (when (> count 5)
      [:p (link-to (str (jar-url jar) "/versions")
                   (str "Show All Versions (" count " total)"))])))


Create indexes with more unique names because of concurrent testing in travis.

--- test/clj_ravendb/client_deleting_indexes_test.clj
+++ test/clj_ravendb/client_deleting_indexes_test.clj
@@ -6,19 +6,20 @@
             [clj-ravendb.config :refer :all]))

 (let [caching-client (client ravendb-url ravendb-database {:caching :aggressive :ssl-insecure? true :oauth-url oauth-url :api-key api-key})
-      client (client ravendb-url ravendb-database {:ssl-insecure? true :oauth-url oauth-url :api-key api-key})]
-  (doseq [i ["test-index" "test-index2"]]
+      client (client ravendb-url ravendb-database {:ssl-insecure? true :oauth-url oauth-url :api-key api-key})
+      indexes [(str "test-index" (System/currentTimeMillis)) (str "test-index" (System/currentTimeMillis))]]
+  (doseq [i indexes]
     (put-index! client {:index i
                         :where [[:== :name "TestDocument"]]
                         :select [:name]}))
   (deftest test-delete-index-returns-correct-status-code
     (testing "deleting an index returns the correct status code"
-      (let [actual (delete-index! client "test-index")
+      (let [actual (delete-index! client (first indexes))
             expected 204]
         (is (= expected (actual :status))))))

   (deftest test-delete-index-returns-correct-status-code-when-using-caching-client
     (testing "deleting an index returns the correct status code"
-      (let [actual (delete-index! caching-client "test-index2")
+      (let [actual (delete-index! caching-client (second indexes))
             expected 204]
         (is (= expected (actual :status)))))))


Join lines to get realistic look

Join lines to get realistic look

--- src/harnocode/core.cljs
+++ src/harnocode/core.cljs
@@ -50,7 +50,7 @@
     (first group)))

 (defmethod fill-group 0 [[result tokens] group]
-  [(conj result (string/join (repeat (count group) "_"))) tokens])
+  [(conj result (string/join (repeat (count group) " "))) tokens])

 (defmethod fill-group 1 [[result tokens] group]
       (let [[column rest-ts] (fill-column tokens (count group))]
@@ -61,7 +61,7 @@
     (first (reduce fill-group [[] ts] groups))))

 (defn arrange-tokens [ts img]
-  (map #(arrange-tokens-line ts %) img))
+  (map #(string/join (arrange-tokens-line ts %)) img))

 ;; Tries hard to make piece of code look like img


Remove contrib dependencies from r.m.file.

--- ring-core/src/ring/middleware/file.clj
+++ ring-core/src/ring/middleware/file.clj
@@ -1,7 +1,5 @@
 (ns ring.middleware.file
   "Static file serving."
-  (:use [clojure.contrib.def :only (defvar-)]
-        [clojure.contrib.except :only (throw-if-not)])
   (:require [ring.util.codec :as codec]
             [ring.util.response :as response])
   (:import java.io.File))
@@ -10,7 +8,8 @@
   "Ensures that a directory exists at the given path, throwing if one does not."
   [^String dir-path]
   (let [dir (File. dir-path)]
-    (throw-if-not (.exists dir) "Directory does not exist: %s" dir-path)))
+    (if-not (.exists dir)
+      (throw (Exception. (format "Directory does not exist: %s" dir-path))))))

 (defn wrap-file
   "Wrap an app such that the directory at the given root-path is checked for a


add usage example

add usage example

--- src/babel/italiano/benchmark.cljc
+++ src/babel/italiano/benchmark.cljc
@@ -43,6 +43,7 @@
   (run-benchmark times))

 ;; lein run -m babel.italiano.benchmark/parse-mark 20 "i gatti neri hanno bevuto il vino rosso"
+;; (parsemark 100 "gli uomini alti hanno bevuto il vino rosso alla casa rossa")
 (defn parsemark [times expr]
   (count (take (Integer. times)
                (repeatedly


don't require commodity-id on account update

--- src/clj_money/models/accounts.clj
+++ src/clj_money/models/accounts.clj
@@ -32,7 +32,7 @@
 (s/def ::commodity-id integer?)
 (s/def ::parent-id (s/nilable integer?))
 (s/def ::new-account (s/keys :req-un [::entity-id ::name ::type ::commodity-id] :opt-un [::parent-id]))
-(s/def ::existing-account (s/keys :req-un [::id ::entity-id ::type ::commodity-id ::name] :opt-un [::parent-id]))
+(s/def ::existing-account (s/keys :req-un [::id ::entity-id ::type ::name] :opt-un [::parent-id ::commodity-id]))
 ; :balance and :children-balance are not specified because they are always calculated and not passed in

 (def ^:private coercion-rules


reword messages

reword messages

--- src/me/panzoo/story.clj
+++ src/me/panzoo/story.clj
@@ -56,7 +56,7 @@
       (java.io.InputStreamReader.)
       (slurp))
     (catch Exception e
-      (message "failed to read resource " resource-name)
+      (message "Failed to read resource " resource-name)
       (if continue-on-failure?
         (message "    continuing anyway...")
         (do (message "    aborting...")
@@ -68,7 +68,7 @@
   [path & continue-on-failure?]
   (try (slurp path)
     (catch java.io.FileNotFoundException _
-      (message path " not found; reading as a resource instead")
+      (message "Using internal " path)
       (slurp-resource path continue-on-failure?))))

 (defn encode-anchor [s]
@@ -293,7 +293,7 @@
 (defn maybe-associate-brush [path lang]
   (when-let [b (and lang (second (languages lang)))]
     (when-not (@*brushes* b)
-      (message path " associated with brush " b)
+      (message "Associating "path " with brush " b)
       (swap! *brushes* conj b))))

 ; The output of each file is wrapped in `article` or `section` tags. Article


Load patch tablet changes in table read methods.

--- src/merkle_db/table.clj
+++ src/merkle_db/table.clj
@@ -454,6 +454,19 @@
   (fn decode-entry [[k r]] [(key/decode lexicoder k) r]))

+(defn- load-changes
+  "Return the table's patch changes as a map from keys to records or
+  tombstones. This will load the table's patch tablet if present and merge in
+  any locally pending changes."
+  [^Table table]
+  (->>
+    (when-let [patch (some->> (::patch table)
+                              (mdag/get-data (.store table)))]
+      (::patch/changes patch))
+    (into (or (.pending table) (sorted-map)))
+    (not-empty)))
+
+
 (defn- -scan
   ([table]
    (-scan table nil))
@@ -465,7 +478,7 @@
        (patch/patch-seq
          ; Merged patch data to apply to the records.
          (patch/filter-patch
-           (.pending table) ; TODO: merge ::patch
+           (load-changes table)
            {:fields (:fields opts)
             :start-key start-key
             :end-key end-key})
@@ -494,7 +507,7 @@
   ([^Table table id-keys opts]
    (let [lexicoder (table-lexicoder table)
          id-keys (into #{} (map (partial key/encode lexicoder)) id-keys)
-         patch-map (.pending table) ; TODO: merge ::patch
+         patch-map (load-changes table)
          patch-entries (select-keys patch-map id-keys)
          extra-keys (apply disj id-keys (keys patch-entries))
          patch-entries (patch/filter-patch patch-entries {:fields (:fields opts)})


Update driver.clj

Update driver.clj

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -53,17 +53,21 @@
              :special-type    (apply schema/enum field/special-types)
              :preview-display schema/Bool
              :pk?             schema/Bool}]})
+
+(def DescribeTableField
+  "Schema for fields returned by `describe-table`."
+  {:name                                schema/Str
+   :base-type                           (apply schema/enum field/base-types)
+   :special-type                        (apply schema/enum field/special-types)
+   :preview-display                     schema/Bool
+   :pk?                                 schema/Bool
+   (schema/optional-key :nested-fields) #{(schema/recursive #'DescribeTableField)}})

 (def DescribeTable
   "Schema for the expected output of `describe-table`."
   {:name   schema/Str
    :schema (schema/maybe schema/Str)
-   :fields #{{:name                                schema/Str
-              :base-type                           (apply schema/enum field/base-types)
-              :special-type                        (apply schema/enum field/special-types)
-              :preview-display                     schema/Bool
-              :pk?                                 schema/Bool
-              (schema/optional-key :nested-fields) #{(schema/recursive #'describe-table-schema)}}}})
+   :fields #{DescribeTableField}})

 (def DescribeDatabase
   "Schema for the expected output of `describe-database`."


Add more examples

Add more examples

--- src/clojure/clojure_walkthrough/cjia/ch08_xx.clj
+++ src/clojure/clojure_walkthrough/cjia/ch08_xx.clj
@@ -87,8 +87,8 @@
 (defn largest-of [numbers]
   (compute-across larger-of numbers (first numbers)))

-(defn all-greater-than [theshold numbers]
-  (compute-across #(if (> %2 threshold) (conj %1 %2) %1) numbers [])))
+(defn all-greater-than [threshold numbers]
+  (compute-across #(if (> %2 threshold) (conj %1 %2) %1) numbers []))

 (total-of [5 7 9 3 4 1 2 8]) ;; 39
 (largest-of [5 7 9 3 4 1 2 8]) ;; 9
@@ -104,4 +104,71 @@

 (all-greater-than 5 [5 7 9 3 4 1 2 8]) ;; [7 9 8]

-;; 8.1.3: filtering lists of things (TBC)
+;; Filtering lists of things
+(defn all-lesser-than [threshold numbers]
+  (compute-across #(if (< %2 threshold) (conj %1 %2) %1) numbers []))
+
+(all-lesser-than 5 [5 7 9 3 4 1 2 8]) ;; [3 4 1 2]
+
+(defn select-if [pred elements]
+  (compute-across #(if (pred %2) (conj %1 %2) %1) elements []))
+
+(select-if odd? [5 7 9 3 4 1 2 8]) ; [5 7 9 3 1]
+
+(defn all-lesser-than [threshold numbers]
+  (select-if #(< % threshold) numbers))
+
+(all-lesser-than 5 [5 7 9 3 4 1 2 8]) ; [3 4 1 2]
+
+;; the built-in filter
+
+(filter odd? [5 7 9 3 4 1 2 8]) ; (5 7 9 3 1)
+
+(defn all-lesser-than [threshold numbers]
+  (filter #(< % threshold) numbers))
+
+(all-lesser-than 5 [5 7 9 3 4 1 2 8]) ; (3 4 1 2)
+
+(defn price-with-tax [tax-rate amount]
+  (->> (/ tax-rate 100)
+       (+ 1)
+       (* amount)))
+
+(price-with-tax 9.5M 100) ; 109.500M
+
+(defn with-california-taxes [prices]
+  (map #(price-with-tax 9.25M %) prices))
+
+(def prices [100 200 300 400 500])
+
+(with-california-taxes prices) ; (109.2500M 218.5000M 327.7500M 437.0000M 546.2500M)
+
+(defn price-with-ca-tax [price]
+  (price-with-tax 9.25M price))
+
+(defn price-with-ny-tax [price]
+  (price-with-tax 8.0M price))
+
+(defn price-calculator-for-tax [state-tax]
+  (fn [price]
+    (price-with-tax state-tax price)))
+
+(defn of-n-args [a b c d e]
+  (str a b c d e))
+
+(defn of-k-args [d e]
+  (of-n-args 1 2 3 d e))
+
+(of-k-args \a \b) ; "123ab"
+
+(defn partially-applied [of-n-args & n-minus-k-args]
+  (fn [& k-args]
+    (apply of-n-args (concat n-minus-k-args k-args))))
+
+(def of-2-args (partially-applied of-n-args \a \b \c))
+
+(def of-3-args (partially-applied of-n-args \a \b))
+
+(of-2-args 4 5) ; "abc45"
+
+(of-3-args 3 4 5) ; "ab345"


Add vertical cursor movement

Add vertical cursor movement

--- src/clojure/playasophy/wonderdome/mode/bombs.clj
+++ src/clojure/playasophy/wonderdome/mode/bombs.clj
@@ -3,7 +3,8 @@
     [clojure.tools.logging :as log]
     [playasophy.wonderdome.geometry.sphere :as sphere]
     [playasophy.wonderdome.mode.core :as mode]
-    [playasophy.wonderdome.util.color :as color]))
+    [playasophy.wonderdome.util.color :as color]
+    [playasophy.wonderdome.util.control :as control]))

 (defn- distance
@@ -16,7 +17,7 @@

 (defrecord BombsMode
-  [barrel-radius cursor-position]
+  [barrel-radius barrel-height cursor-position]

   mode/Mode

@@ -26,18 +27,30 @@
       [:button/press :L]
       this

+      [:axis/direction :y-axis]
+      (let [delta (* (or (:value event) 0)
+                     (or (:elapsed event) 0)
+                     0.0003)
+            new-z (-> cursor-position :z (+ delta) (min barrel-height) (max 0.0))]
+        (assoc-in this [:cursor-position :z] new-z))
+      (assoc-in this [:cursor-position :z]
+             (control/adjust (:z cursor-position) event
+                             :rate 0.03
+                             :min-val 0.0
+                             :max-val barrel-height))
+
       this))

   (render
     [this pixel]
     (let [delta (distance barrel-radius (:barrel pixel) cursor-position)]
-      (if (< delta 0.05) (color/gray 1.0) color/none))))
+      (if (< delta 0.06) (color/gray 1.0) color/none))))

 (defn init
   "Creates a new bombs mode with starting parameters"
   ([]
-   (init 0.099 {:theta 0 :z 0.15}))
-  ([barrel-radius cursor-position]
-   (BombsMode. barrel-radius cursor-position)))
+   (init 0.099 (* 0.068 8) {:theta 0 :z 0.20}))
+  ([barrel-radius barrel-height cursor-position]
+   (BombsMode. barrel-radius barrel-height cursor-position)))


doc: add coalesce usage example

doc: add coalesce usage example

--- src/riemann/streams.clj
+++ src/riemann/streams.clj
@@ -1082,7 +1082,13 @@
   and removed from the state table thereafter.

   Use coalesce to combine states that arrive at different times--for instance,
-  to average the CPU use over several hosts."
+  to average the CPU use over several hosts.
+
+  Every 10 seconds, print a sequence of events including all the events which
+  share the same :foo and :bar attributes:
+
+  (by [:foo :bar]
+    (coalesce 10 prn))"
   [& [dt & children]]
   (let [children (if (number? dt) children (cons dt children))
         dt (if (number? dt) dt 1)


Formatting

Formatting

--- src/riemann/streams.clj
+++ src/riemann/streams.clj
@@ -1278,14 +1278,11 @@
       stream)))

 (defn split*
-  "Given a list of function and stream pairs, passes
-   the current event onto the stream associated with
-   the first passing condition.
-
-   Conditions are functions as for where*.
-   An odd number of forms will make the last form
-   the default stream.
-   Example:
+  "Given a list of function and stream pairs, passes the current event onto the
+  stream associated with the first passing condition.
+
+   Conditions are functions as for where*.  An odd number of forms will make
+  the last form the default stream. For example:

    (split*
      (fn [e] (< 2 (:metric e))) (with :state \"critical\" index)
@@ -1299,8 +1296,8 @@
         (call-rescue event [stream])))))

 (defmacro split
-  "Behave as for split*, expecting predicates to be
-  expressions - as for where - instead of functions"
+  "Behave as for split*, expecting predicates to be expressions - as for where
+  - instead of functions"
   [& clauses]
   (let [clauses (mapcat (fn [clause]
                           (if (nil? (second clause))
@@ -1310,14 +1307,12 @@
     `(split* ~@clauses)))

 (defmacro splitp
-  "Takes a binary predicate, an expression and a set of
-   clauses.
-
-   For each clause, (pred test-expr expr) is evaluated, note
-   the order change from condp.
-
-   If a binary clause matches, its associated stream will be
-   executed."
+  "Takes a binary predicate, an expression and a set of clauses.
+
+   For each clause, (pred test-expr expr) is evaluated, note the order change
+  from condp.
+
+   If a binary clause matches, its associated stream will be executed."
   [pred expr & clauses]
   (let [clauses (for [[test-expr stream] (partition-all 2 clauses)]
                   (if (nil? stream)


E-mail address in status gets detected.

E-mail address in status gets detected.

Fixes #96.

Note: 5054a336a2204e85ee57d8dc149660f96f6d562e@.


Now get application returns 404 if the application doesn't exist in exploud.

--- src/exploud/web.clj
+++ src/exploud/web.clj
@@ -28,6 +28,12 @@
 (def default-region "eu-west-1")

 (def default-user "exploud")
+
+(defn get-application
+  [name]
+  (if-let [body (exp/application default-region name)]
+    {:status 200 :body body}
+    (error-response (str "The application '" name "' does not exist.") 404)))

 (defroutes routes
   (context
@@ -60,7 +66,7 @@
         [] {:status 200 :body (exp/applications)})

    (GET "/applications/:application"
-        [application] {:status 200 :body (exp/application default-region application)})
+        [application] (get-application application))

    (PUT "/applications/:application"
         [application description email owner] {:status 201 :body (exp/upsert-application default-region application {:description description


Remove per-resource metrics

Remove per-resource metrics

--- src/exploud/web.clj
+++ src/exploud/web.clj
@@ -24,8 +24,6 @@
              [instrument :refer [instrument]]]
             [nokia.ring-utils
              [error :refer [wrap-error-handling error-response]]
-             [metrics :refer [wrap-per-resource-metrics replace-outside-app
-                              replace-guid replace-mongoid replace-number]]
              [ignore-trailing-slash :refer [wrap-ignore-trailing-slash]]]
             [overtone.at-at :as at-at]
             [ring.middleware
@@ -219,8 +217,4 @@
       (wrap-json-params)
       (wrap-keyword-params)
       (wrap-params)
-      (wrap-per-resource-metrics [replace-guid
-                                  replace-mongoid
-                                  replace-number
-                                  (replace-outside-app "/1.x")])
       (expose-metrics-as-json)))


remapping of routes and form specs

remapping of routes and form specs

--- src/fxc/handler.clj
+++ src/fxc/handler.clj
@@ -35,15 +35,26 @@
    :length 6
    :entropy 3.1})

+
+(def generate-form-spec
+  {:renderer :bootstrap3-stacked
+   :fields [{:name "PIN:"   :type :text}]
+   :validations [[:required [:field :value]]]
+   :action "/generate"
+   :method "post"})
+
 (def recovery-form-spec
   {:renderer :bootstrap3-stacked
-   :fields [{:name "1st: "  :type :text}
-            {:name "2nd: "  :type :text}
-            {:name "3rd: "  :type :text}]
-   :validations [[:required [:field :value]]]
+   :fields [{:name "1"  :type :text}
+            {:name "2"  :type :text}
+            {:name "3"  :type :text}]
+   :validations [[:required ["1" "2" "3"]]]
+
    :action "/recover"
    :method "post"})

+(defn parse-int [s]
+  (Integer. (re-find  #"\d+" s )))

 (defn render-page [{:keys [title body] :as content}]
   (page/html5
@@ -64,39 +75,43 @@
 (defroutes app-routes

   (GET "/" []
+      (render-page
+       {:title "PIN Secret Sharing"
+        :body [:div {:class "secrets row center"}
+               [:div {:class "content input-form"}
+                (fc/render-form generate-form-spec)]]}))

-  (let [pin (:integer (rand/create (:length settings)))
-        main   (fxc/render-slice  settings (:type settings) pin 0)
-        slices (fxc/create-secret settings (:type settings) pin)]
+  (POST "/g*" {params :params}
+    (let [pin    (biginteger (params "PIN:"))
+          main   (fxc/render-slice  settings (:type settings) pin 0)
+          slices (fxc/create-secret settings (:type settings) pin)]

-    (render-page
-     {:title "FXC.dyne.org - Shared PIN Generator"
-      :body [:div {:class "secrets row center"}
-             [:div {:class "password"}
-              "Your PIN:" [:div {:class "content"}
-                      (fxc/extract-pin settings main)]]
-             [:div {:class "slices"}
-              [:h3 (str "Split in " (:total settings)
-                        " shared secrets, quorum "
-                        (:quorum settings) ":")]
-              [:ul
-               (map #(conj [:li {:class "content"}] %)
-                    (map #(fxc/extract-share settings %)
-                    (:slices slices)))]]]})))
-
+      (render-page
+       {:title "PIN Secret Sharing"
+        :body [:div {:class "secrets row center"}
+               [:div {:class "password"}
+                "Your PIN:" [:div {:class "content"}
+                             (fxc/extract-pin settings main)]]
+               [:div {:class "slices"}
+                [:h3 (str "Split in " (:total settings)
+                          " shared secrets, quorum "
+                          (:quorum settings) ":")]
+                [:ul (map #(conj [:li {:class "content"}] %)
+                          (map #(fxc/extract-share settings %)
+                               (:slices slices)))]]]})))
+
   (GET "/r*" []
-       (render-page {:title "Shared PIN Recovery"
-                     :body [:div {:class "recovery row center"}
-                            [:div {:class "input-form"}
-                            (fc/render-form recovery-form-spec)
-                            ]]}))
+    (render-page {:title "PIN Secret Recovery"
+                  :body [:div {:class "recovery row center"}
+                         [:div {:class "content input-form"}
+                          (fc/render-form recovery-form-spec)
+                          ]]}))

-  (POST "/r*" []
-        (render-page {:title "Shared PIN Recovery"
-                      :body "WIP"}))
-
-  (route/resources "/"
-                   "/r*")
+  (POST "/r*" {params :params}
+    (render-page {:title "PIN Secret  Recovery"
+                  :body (let [para (fp/parse-params recovery-form-spec params)])
+                  para
+                  }))

   (route/not-found "Not Found"))


Fix built-in? alias logic

Fix built-in? alias logic

--- src/yetibot/core/commands/alias.clj
+++ src/yetibot/core/commands/alias.clj
@@ -1,5 +1,6 @@
 (ns yetibot.core.commands.alias
   (:require
+    [clojure.set :refer [difference]]
     [taoensso.timbre :refer [info warn error]]
     [clojure.string :as s]
     [yetibot.core.util.format :refer [pseudo-format-n *subst-prefix*
@@ -61,25 +62,26 @@
     (dorun (map wire-alias alias-cmds))))

 (defn- built-in? [cmd]
-  (let [as (model/find-all)]
-    (and (not ((set (map :cmd-name as)) cmd))
-         ((set (keys (help/get-docs))) cmd))))
+  ;; subtract known aliases from every command registered in `help`
+  ((difference
+    (set (keys (help/get-docs)))
+    (set (map :cmd-name (model/find-all))))
+   ;; if the command is in the resulting set it's a built-in
+   cmd))

 (defn create-alias
   "alias <alias> = \"<cmd>\" # alias a cmd, where <cmd> is a normal command expression. Note the use of quotes, which treats the right-hand side as a literal allowing the use of pipes. Use $s as a placeholder for all args, or $n (where n is a 1-based index of which arg) as a placeholder for a specific arg."
   {:yb/cat #{:util}}
   [{[_ a-name a-cmd] :match user :user}]
   (info "create alias" a-name a-cmd "user:" user)
-  (let [cmd-name (cleaned-cmd-name a-name)
-        cmd (remove-surrounding-quotes a-cmd)
-        alias-map {:user-id (:username user) :cmd-name cmd-name :cmd cmd}
-        ;; get wire-alias response before `add-alias` to determine whether it
-        ;; was updated or created
-        response (wire-alias alias-map)
-        ]
+  (let [cmd-name (cleaned-cmd-name a-name)]
     (if (built-in? cmd-name)
       (str "Can not alias existing built-in command " a-name)
-      (do
+      (let [cmd (remove-surrounding-quotes a-cmd)
+            alias-map {:user-id (:username user) :cmd-name cmd-name :cmd cmd}
+            ;; get wire-alias response before `add-alias` to determine whether
+            ;; it was updated or created
+            response (wire-alias alias-map)]
         (add-alias alias-map)
         response))))


Better comment on buffer-size option.

Better comment on buffer-size option.

--- src/grafter/rdf.clj
+++ src/grafter/rdf.clj
@@ -199,6 +199,11 @@
   The :format option is supplied by the wrapping function and may be
   nil, or act as an indicator about the format of the triples to read.
   Implementers can choose whether or not to ignore or require the
-  format parameter."
+  format parameter.
+
+  The :buffer-size option can be used to configure the buffer size at
+  which statements are parsed from an RDF stream.  Its default value
+  of 32 was found to work well in practice, and also aligns with chunk
+  size of Clojure's lazy sequences."
   [this & {:keys [format buffer-size] :as options}]
   (pr/to-statements this options))


Remove cache when deleting an item

Remove cache when deleting an item

--- src/tixi/mutators/delete.cljs
+++ src/tixi/mutators/delete.cljs
@@ -9,5 +9,6 @@
   (when (not-empty ids)
     (mu/snapshot!)
     (doseq [id ids]
+      (swap! d/data update-in [:cache] dissoc id)
       (ml/delete-from-locks! id (d/completed-item id))
       (msh/update-state! update-in [:completed] dissoc id))))


removed lines from main to clean up function

--- src/trend_compliance/core.clj
+++ src/trend_compliance/core.clj
@@ -67,6 +67,10 @@
       (keyword (re-find #"(?x)\S+" (str (first line))))
       (re-find #"[^\\\"]+" (str (second line)))))))

+;; (defn compare-ip
+;;   "compare the ip held in log to the ips on compliance list"
+;;   [
+
 (defn read-detail
   "read in a large detail file"
   [file-name]
@@ -90,12 +94,8 @@
           wired (first file-names)
           wireless (second file-names)
           detail (nth file-names 2)
-          wired-csv-data (read-csv wired)
-          wireless-csv-data (read-csv wireless)
-          wired-data-map (map create-data-map wired-csv-data)
-          wireless-data-map (map create-data-map wireless-csv-data)
-          wired-list (create-final-list wired-data-map)
-          wireless-list (create-final-list wireless-data-map)]
+          wired-list (create-final-list (map create-data-map (read-csv wired)))
+          wireless-list (create-final-list (map create-data-map (read-csv wireless)))]
       (println "=============== Wired List: ===============")
       (pp/pprint wired-list)
       (println "\n=============== Wireless List: ===============")


Add better language example.

Add better language example.

--- src/tryclojure/views/home.clj
+++ src/tryclojure/views/home.clj
@@ -61,43 +61,22 @@
       [:div#container
        [:div.prose-holder
         [:div.prose
-         [:p "Use Isla to write your own story:
+         [:div.story.story-code "
+           isla is a
+           person

+           isla lunch
+           is 'Jelly Tots'

+

+           drum is a
+           toy

+

+
+           isla toys
+           is a list

+           add drum
+           to
+           isla toys

           "]
-         [:div.story.story-code "
-           my name
-           is 'Mary'

-
-           my summary
-           is 'You are a boy.
-           You have no shoes.'

-
-           hallway is a
-           room

-
-           hallway summary
-           is
-           'A candle burns on a table.'
-          "]
-         [:p "
-           Then, play through your adventure:
-          "]
-         [:div.story.story-playthrough "
-           > play The Hallway
-
Are you sitting comfortably? Then, we shall begin.

-           > look
-
You are in a hallway.  A candle burns on a table.
-           You can see a door.

-           > open door
-
The door is locked.

-           > look at table
-
You find a key.

-          "]
-         [:p "
-           No public demo, yet.  The
-           code is on github.
-          "]
-         ]]
-       [:div.footer "by mary rose cook"]
          ]]]
        (footer)


Maybe some error handling

Maybe some error handling

--- src/icecap/rest.clj
+++ src/icecap/rest.clj
@@ -20,11 +20,15 @@
 (defroutes routes
   (context "/v0/caps" {store :store kdf :kdf scheme :scheme}
            (POST "/" {plan :body-params :as request}
-                 (let [{cap :cap} (spy (<!! (create-cap plan
-                                                        :store store
-                                                        :kdf kdf
-                                                        :scheme scheme)))]
-                   {:body (cap-url request cap)}))
+                 (info request)
+                 (let [{cap :cap error :error}
+                       (spy (<!! (create-cap (spy plan)
+                                             :store store
+                                             :kdf kdf
+                                             :scheme scheme)))]
+                   (if cap
+                     {:body (cap-url request cap)}
+                     {:error (str error)})))
            (context "/:encoded-cap" [encoded-cap]
                     (GET "/" []
                          (let [cap (spy (safebase64-decode encoded-cap))]


Add tools.namespace.repl stuff to repl.

Add tools.namespace.repl stuff to repl.

--- src/incise/repl.clj
+++ src/incise/repl.clj
@@ -1,2 +1,3 @@
 (ns incise.repl
-  (:require [incise.core :refer :all]))
+  (:require [clojure.tools.namespace.repl :refer :all]
+            [incise.core :refer :all]))


Make the app-routes dynamic in the system.

This should make it possible to reload app-routes and restart the
system.

--- src/vignette/system.clj
+++ src/vignette/system.clj
@@ -14,7 +14,7 @@
     (swap! (:running (:state this))
            (fn [_]
              (run-server
-               (app-routes this)
+               (#'app-routes this)
                {:port port}))))
   (stop [this]
     (when-let [stop-fn @(:running (:state this))]


Fix react warnings

Fix react warnings

--- src/warehouse/core.cljs
+++ src/warehouse/core.cljs
@@ -135,42 +135,49 @@

 (defmulti show-change-set (fn [change-set] (:type change-set)))

-(defmethod show-change-set :create [{change-set-data :data} change-set]
-  [:ul.change-set
-   (for [component change-set-data]
-     [:li.component
-      (let [data (:data component)
-            metadata (:metadata component)]
-        [:ul
-         [:li (str "Name: " (:name metadata))]
-         [:li "Data:"
-          [:ul
-           (map (fn [[k v] kvs]
-                  (if-not (= k :id)
-                    [:li
-                     [:span.label (str (key->label k) ": ")]
-                     [:span.value v]]))
-                (into [] data))]]
-         [:button {:on-click #(swap! app-state assoc-in [:components (:id metadata) :amount] 0)} "Revert"]])])])
-
-(defmethod show-change-set :update [{change-set-data :data} change-set]
-  [:ul.change-set
-   (for [component change-set-data]
-     [:li.component
-      (let [data (:data component)
-            metadata (:metadata component)]
-        [:ul
-         [:li (str "Name: " (:name metadata))]
-         [:li "Data:"
-          [:ul
-           (map (fn [[k v] kvs]
-                  (if-not (= k :id)
-                    [:li
-                     [:span.label (str (key->label k) ": ")]
-                     [:span.value
-                      [:span.old (first v)]
-                      [:span.new (second v)]]]))
-                data)]]])])])
+(defmethod show-change-set :create [change-set k]
+  (def change-set-data (:data change-set))
+  ^{:key k} [:ul.change-set
+             (map (fn [component k]
+                    ^{:key k} [:li.component
+                               (let [data (:data component)
+                                     metadata (:metadata component)]
+                                 [:ul
+                                  [:li (str "Name: " (:name metadata))]
+                                  [:li "Data:"
+                                   [:ul
+                                    (map (fn [[k v] kvs]
+                                           (if-not (= k :id)
+                                             ^{:key k} [:li
+                                                        [:span.label (str (key->label k) ": ")]
+                                                        [:span.value v]]))
+                                         (into [] data))]]
+                                  [:button {:on-click #(swap! app-state assoc-in [:components (:id metadata) :amount] 0)} "Revert"]])]
+                    )
+                  change-set-data
+                  (range (count change-set-data) 0 -1))])
+
+(defmethod show-change-set :update [change-set k]
+  (def change-set-data (:data change-set))
+  ^{:key k} [:ul.change-set
+             (map (fn [component k]
+                    ^{:key k} [:li.component
+                     (let [data (:data component)
+                           metadata (:metadata component)]
+                       [:ul
+                        [:li (str "Name: " (:name metadata))]
+                        [:li "Data:"
+                         [:ul
+                          (map (fn [[k v] kvs]
+                                 (if-not (= k :id)
+                                   ^{:key k}[:li
+                                             [:span.label (str (key->label k) ": ")]
+                                             [:span.value
+                                              [:span.old (first v)]
+                                              [:span.new (second v)]]]))
+                               data)]]])])
+                  change-set-data
+                  (range (count change-set-data) 0 -1))])

 (defn page []
   (let [adding (atom false)
@@ -223,10 +230,15 @@
                                 (reset! adding false))} "Save"]
           [:button {:type "button" :on-click #(reset! adding false)} "Cancel"]])
        (when (true? @showing-changeset)
-         (for [change-set-col @change-sets]
-           (for [change-set change-set-col]
-             (do
-               (show-change-set change-set)))))
+         (let [cs (reverse @change-sets)
+               k1 (range (count cs) 0 -1)]
+
+           (map (fn [change-set-col k2]
+                  (map show-change-set
+                       change-set-col
+                       (map #(str k2 "." %) (range (count change-set-col) 0 -1))))
+                cs
+                k1)))
        [:ul {:class "components-list"}
         (for [[k v] (get-visible-components)]
           ^{:key (:name v)} [:li {:class "component"}


track expected total item counts

track expected total item counts

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -115,7 +115,12 @@

 (def ^{:private true} q (dq/queues "/tmp/indexer-queue" {}))

-(defn scheduler-put! [& args] (apply dq/put! q :indexing-jobs args))
+(def ^{:private true} item-counts (atom 0))
+
+(defn scheduler-put! [job & args]
+  (do
+    (swap! item-counts + (or (:size (meta job)) 0))
+    (apply dq/put! q :indexing-jobs job args)))

 (defn- scheduler-take! [& args] (apply dq/take! q :indexing-jobs args))

@@ -123,7 +128,10 @@

 (defn- scheduler-retry! [& args] (apply dq/retry! args))

-(defn- scheduler-stats [] (get (dq/stats q) "indexing_jobs"))
+(defn- scheduler-stats []
+  (->> {:expected-item-counts (deref item-counts)}
+       (into (get (dq/stats q) "indexing_jobs"))
+       ))

 (defn schedule-jobs-sample [db]


Newton's method is functional for simple polynomials. Committed by Ben Weintraub.

--- src/jackal/core.clj
+++ src/jackal/core.clj
@@ -7,28 +7,51 @@
   (println "Hello, World!"))

 (defn newtons-method
+  "Run Neton's Method for root finding until the error is less than epsilon."
   [func guess epsilon]
-  ())
+  (loop [x guess]
+    (let [y (eval-polynomial-at func x)]
+      (if (>= y epsilon)
+        ;; do newtons method
+        (recur
+         (x-intercept (slope-at func x) x y))
+        x))))
+
+(defn slope-at
+  "Find the slope of the polynomial func at x."
+  [func x]
+  (eval-polynomial-at
+   (differentiate func)
+   x))
+
+(defn determine-tangent-line
+  "Determine the tangent line at x of the polynomial"
+  [poly x]
+  (let [slope (slope-at poly x)]
+    [slope (y-intercept slope x (eval-polynomial-at poly x))]))

 (defn differentiate
+  "Differentiate simple polynomials."
   [func]
   (let [length (count func)]
     (drop-last (map-indexed
                 (fn [index item] (* item (- (- length index) 1)))
                 func))))

-(defn differentiate-at
-  [func x]
-  (eval-polynomial-at
-   (differentiate func)
-   x))
+(defn x-intercept
+  "Find the x-intercept of the line represented by mx+b."
+  [m x y]
+  (/ (- 0 (y-intercept m x y)) m))

-(defn tangent-line-root
-  [m b]
-  (/ (- 0 b) m))
+
+(defn y-intercept
+  "Find the y-intercept of the line with slope m and coordinate (x,y)"
+  [m x y]
+  (- y (* m x)))

 ;; needs refactoring to be more functional
 (defn eval-polynomial-at
+  "Evaluate the polynomial at x"
   [poly x]
   (let [length (count poly)]
     (loop [i length
@@ -43,6 +66,7 @@
         sum))))

 (defn eval-term-at
+  "Evaluate a single term of the polynomial."
   [coefficient power x]
   (*
    coefficient


Macros are hard

Macros are hard

--- src/korhal/core.clj
+++ src/korhal/core.clj
@@ -18,7 +18,7 @@

 (defmacro swap-keys [swap-atom & forms]
   (for [pair (partition 2 forms)]
-    `(swap! swap-atom swap-key ~@pair)))
+    `(swap! ~swap-atom swap-key ~@pair)))

 (defn korhal-main [& args]
   (let [ai (korhal.core.)


Add typical-fluid-density

Add typical-fluid-density


fix test

fix test

--- test/bones/editable_test.cljs
+++ test/bones/editable_test.cljs
@@ -81,7 +81,7 @@
              (editable/request cofx [:x :y :z {:command :connect :tap {:n 5}}])))))
   (testing "if tap has :defaults they merge into inputs"
     (let [cofx {:client "[the client]" :db {:editable {:y {:z {:inputs {:shaft :triangle}}}}}}]
-      (is (= {:client "[the client]", :command :connect, :args {:shaft :triangle :m 5}, :tap {:defaults {:m 5}}}
+      (is (= {:client "[the client]", :command :connect, :args {:shaft :triangle :m 5}, :tap {:defaults {:m 5} :form-type :y :identifier :z}}
              (editable/request cofx [:x :y :z {:command :connect :tap {:defaults {:m 5}}}])))))
   )


symbol hash code sanity check

symbol hash code sanity check

--- test/cljs/cljs/core_test.cljs
+++ test/cljs/cljs/core_test.cljs
@@ -1859,5 +1859,10 @@
   (assert (= (char 65) \A))
   (assert (= (char \A) \A))

+  ;; compile time run symbol hash codes
+
+  (assert (= (hash 'foo) (hash (symbol "foo"))))
+  (assert (= (hash 'foo/bar) (hash (symbol "foo" "bar"))))
+
   :ok
   )


[test/network-test] Use dfeault params for sgd optimizer.

--- test/cortex/network_test.cljc
+++ test/cortex/network_test.cljc
@@ -38,10 +38,8 @@
         training-labels XOR-LABELS
         n-epochs 1000
         loss-fn (opt/mse-loss)
-        learning-rate 0.01
-        momentum 0.9
         batch-size 1
-        optimizer (opt/sgd-optimiser (core/parameter-count net) { :learn-rate learning-rate :momentum momentum })
+        optimizer (opt/sgd-optimiser (core/parameter-count net))
         network (net/train net optimizer loss-fn training-data training-labels batch-size n-epochs)
         score-percent (net/evaluate net training-data training-labels)]
     (is (< (abs-diff score-percent 1.0) 0.001))))


changed tests in core_test into normal functions

--- test/distillery/core_test.clj
+++ test/distillery/core_test.clj
@@ -101,15 +101,15 @@
     (print-word-list correction-list)
     ))

-(deftest test-resources
+(defn test-resources []
   (dt/prepare-output-dir job-descr))

-(deftest test-analyze
+(defn test-analyze []
   (-> job-descr
       dt/load-speech-recognition-results
       dt/analyze-speech-recognition-results))

-(deftest test-index
+(defn test-index []
   (let [job (-> job-descr
                 dt/load-speech-recognition-results
                 dt/analyze-speech-recognition-results)
@@ -123,7 +123,7 @@
        [task (vals tasks)]
        (task job)))))

-(deftest test-complete
+(defn test-complete []
   (let [job (-> job-descr
                 dt/load-speech-recognition-results
                 dt/analyze-speech-recognition-results)


bit more testing of multiple occurences of ns references

--- test/mranderson/move_test.clj
+++ test/mranderson/move_test.clj
@@ -23,7 +23,12 @@
             [example.a.four :as four]))

 (defn foo []
-  (example.a.four/foo))")
+  (example.a.four/foo))
+
+(def delayed-four
+  (do
+    (require 'example.a.four)
+    (resolve 'example.a.four/foo)))")

 (def ex-1
   "(ns example.one
@@ -37,14 +42,12 @@
   (let [temp-file (File/createTempFile dir-name nil)]
     (.delete temp-file)
     (.mkdirs temp-file)
-    (println "temp directory" (.getAbsolutePath temp-file))
     temp-file))

 (defn- create-source-file! [^File file ^String content]
   (.delete file)
   (.mkdirs (.getParentFile file))
   (.createNewFile file)
-  (println "writing file: " (.getAbsolutePath file))
   (spit file content)
   file)

@@ -66,14 +69,6 @@

       (sut/move-ns 'example.a.four 'example.b.four src-dir ".clj" [src-dir])

-      (println "affected after move")
-      (doseq [a [file-one file-two new-file-four]]
-        (println (.getAbsolutePath a))
-        (prn (slurp a)))
-      (println "unaffected after move")
-      (println (.getAbsolutePath file-three))
-      (prn (slurp file-three))
-
       (t/is (.exists new-file-four)
           "new file should exist")
       (t/is (not (.exists old-file-four))
@@ -89,4 +84,6 @@
        "file with a reference to ns in body should refer with a symbol")
       (t/is (every? #(.contains (slurp %) "example.b.four")
                     [file-one file-two new-file-four])
-            "affected files should refer to new ns"))))
+            "affected files should refer to new ns")
+      (t/is (= 4 (count (re-seq #"example.b.four" (slurp file-two))))
+            "all occurances of old ns should be replace with new"))))


Pipeline ext not required in validation test

--- test/onyx/validation_test.clj
+++ test/onyx/validation_test.clj
@@ -1,6 +1,5 @@
 (ns onyx.validation-test
-  (:require [onyx.peer.pipeline-extensions :as p-ext]
-            [onyx.test-helper :refer [load-config with-test-env]]
+  (:require [onyx.test-helper :refer [load-config with-test-env]]
             [taoensso.timbre :refer [info] :as timbre]
             [clojure.test :refer [deftest is testing]]
             [onyx.schema :as os]


fix mistake in last fix to this test: complement should be {:reflexive true}, not {:sem {:reflexive true}}

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -317,10 +317,10 @@

 (deftest a-casa-generate
   (let [result (generate
-                {:synsem {:cat :prep
+                {:comp {:synsem {:reflexive false}}
+                 :synsem {:cat :prep
                           :sem {:pred :a
                                 :obj {:pred :house
-                                      :reflexive false
                                       :spec {:def :none}}}}})] ;; "a casa", not "a tua casa", "a della casa", etc
     (is (= (fo result) "a casa"))))


Added localizations for the example.

Added localizations for the example.

--- app/src/clj_web_example/localization.cljc
+++ app/src/clj_web_example/localization.cljc
@@ -1,6 +1,11 @@
 (ns clj-web-example.localization)

-(def dictionary {:hello "Hello World!"})
+(def dictionary {:title "Hello World!"
+                 :messages "Messages"
+                 :new-message "New message"
+                 :sender "Sender"
+                 :message "Message"
+                 :submit "Submit"})

 (defn tr
   [key]


[#1950] Refine logs

[#1950] Refine logs

--- backend/src/akvo/lumen/component/flow.clj
+++ backend/src/akvo/lumen/component/flow.clj
@@ -34,10 +34,11 @@
      (str (:url flow-api) "/check_permissions")
      {:as :json
       :headers (api-headers token)
+      :throw-entire-message? true
+      :unexceptional-status #(<= 200 % 299)
       :form-params body
       :content-type :json})
-    (catch Exception e (log/error e :fail :body body :headers (api-headers token) :error-message (.getMessage e)))))
-
+    (catch Exception e (log/error :fail :body body :response (ex-data e)))))

 (defmethod ig/init-key ::api  [_ {:keys [url] :as opts}]
   opts)


fix dim

fix dim

--- src/neuseg/dpln.clj
+++ src/neuseg/dpln.clj
@@ -43,7 +43,7 @@
           idm (Integer. idm)
           odm (Integer. odm)
           train-label (double-array (flatten (map labelize (flatten (partition 1 2 (nthrest data 2))))))]
-    (.finetune nn (DoubleMatrix. total idm train-label) lr epochs))))
+    (.finetune nn (DoubleMatrix. total odm train-label) lr epochs))))

 (defn predict [nn input]
   (let [dim (count input)


Whitespace

Whitespace

--- src/oxcart/core.clj
+++ src/oxcart/core.clj
@@ -161,6 +161,7 @@
          (finally
            (alter-var-root ~l (constantly rootv#)))))
     `(do ~@forms)))
+

 (defn load
   "(λ String) → nil


Add facilities for attach type to events defined with reify.

--- src/potok/core.cljs
+++ src/potok/core.cljs
@@ -52,6 +52,21 @@

 (defprotocol EffectEvent
   (effect [event state stream]))
+
+;; An abstraction for define the Event type and facilitate filtering
+;; of events by type (only useful when type is defined using reify).
+
+(defprotocol EventType
+  (type [_] "Returns the type of the event."))
+
+(extend-protocol EventType
+  default
+  (type [_] nil))
+
+(defn event-of?
+  "Return true if event `o` has type of `t`."
+  [t o]
+  (= (type o) t))

 ;; An abstraction used for send data to the store.


fix result counts

fix result counts

--- src/rester/core.clj
+++ src/rester/core.clj
@@ -312,7 +312,7 @@
     @p))

 (defn summarise-results [tests]
-  (let [result-keys {:error 0 :failure 0 :success 0 :skipped 0 :total 0}
+  (let [result-keys {:error 0 :failure 0 :success 0 :skipped 0 :ignored 0 :total 0}
         add-results (fn [r1 r2]
                       (into {} (for [k (keys result-keys)]
                                  [k (+ (r1 k 0) (r2 k 0))])))]
@@ -331,10 +331,10 @@
                                result-keys (:tests suite)))))
          (#(assoc (reduce add-results %) :suites %)))))

-(defn print-test-results [{:keys[suites total failure error]}]
+(defn print-test-results [{:keys[suites total failure error skipped ignored]}]
   (flush)
   (println "=============================================================")
-  (println "Test cases:" total ", failed:" failure)
+  (println "Test cases:" total ", failed:" failure ", skipped:" skipped ", ignored:" ignored)
   (doseq [suite suites]
     (println (:name suite))
     (doseq [test (:tests suite)


Add a meta tag identifying Cascade as the generator.

Fixes #11.

--- src/main/clojure/cascade/dispatcher.clj
+++ src/main/clojure/cascade/dispatcher.clj
@@ -16,9 +16,26 @@
   #^{:doc "Request dispatch to views and actions"}
   cascade.dispatcher
   (:import (javax.servlet ServletResponse))
-  (:use (cascade config dom logging path-map pipeline fail func-utils)
-        (cascade.internal utils)))
+  (:use
+  	cascade
+  	(cascade config dom logging path-map pipeline fail func-utils)
+    (cascade.internal utils)))

+(defn prepare-dom-for-render
+	"Post-processes the DOM after the view has constructed it, but before it has been rendered out
+	 as the response. This is a chance to make modifications to the DOM to support global concerns.
+	 This function is often decorated with filters to add new functionality. It is passed
+	 a seq of DOM nodes and should return the same, or a modified set of DOM nodes."
+	 [dom-nodes]
+	 ; Return unchanged
+	 dom-nodes)
+
+(decorate prepare-dom-for-render
+	(fn [delegate dom-nodes]
+		(delegate
+			(extend-dom dom-nodes [:html :head] :top
+				(template :meta { :name "generator" :content "Cascade http://github.com/hlship/cascade" })))))
+
 (defn render-view-as-xml
   "Renders the provided view function as an XML stream."
 	[env view-fn]
@@ -26,7 +43,7 @@
   (let [#^ServletResponse response (-> env :servlet-api :response)
         dom (view-fn env)]
     (with-open [writer (.getWriter response)]
-      (render-xml dom writer)))
+      (render-xml (prepare-dom-for-render dom) writer)))
   true)

 (defn render-view


Re-adding om and sablono as require'ments.

--- src/cbfg/core.cljs
+++ src/cbfg/core.cljs
@@ -8,6 +8,9 @@
             [cljs.core.async :refer [<! >! put! chan timeout]]
             [goog.dom :as gdom]
             [goog.events :as gevents]
+            [om.core :as om :include-macros true]
+            [om.dom :as dom :include-macros true]
+            [sablono.core :as html :refer [html] :include-macros true]
             cbfg.ddl
             cbfg.fence))