Added ':recursive' to help docstring.

Added ':recursive' to help docstring.

--- src/leiningen/ancient.clj
+++ src/leiningen/ancient.clj
@@ -35,9 +35,9 @@

      :aggressive          Check all available repositories (= Do not stop after first artifact match).
      :all                 Check Dependencies and Plugins.
+     :allow-all           Allow SNAPSHOT and qualified versions to be reported as new.
      :allow-qualified     Allow '*-alpha*' versions & co. to be reported as new.
      :allow-snapshots     Allow '*-SNAPSHOT' versions to be reported as new.
-     :allow-all           Allow SNAPSHOT and qualified versions to be reported as new.
      :check-clojure       Include Clojure (org.clojure/clojure) in checks.
      :dependencies        Check Dependencies. (default)
      :interactive         Run 'upgrade' in interactive mode, prompting whether to apply changes.
@@ -46,7 +46,8 @@
      :no-tests            Do not run tests after upgrading a project.
      :overwrite-backup    Do not prompt if a backup file exists when upgrading a project.
      :plugins             Check Plugins.
-     :print               Print result of ':upgrade' task instead of writing it to 'project.clj'.
+     :print               Print result of 'upgrade' task instead of writing it to 'project.clj'.
+     :recursive           Perform recursive 'check' or 'upgrade'.
   "
   [project & args]
   (let [^String t (when-let [^String t (first args)]


Update docstring

Update docstring

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -466,7 +466,7 @@
   endpoint-meta
   : Merged meta-data for the handler, including key :function (namespace qualified name of the function)

-  The handler-wrapper is a special middleware placed *before* any normal middleware for the
+  The sync-wrapper is a special middleware placed *before* any normal middleware for the
   endpoint. For synchronous Rook, it is always identity. For async Rook, it converts
   a synchronous handler into an asynchronous handler, using the core.async thread macro.


Remove reference to Bodmin College

Remove reference to Bodmin College

--- src/cornwalltechjam/layout.clj
+++ src/cornwalltechjam/layout.clj
@@ -140,8 +140,8 @@

          [:div {:class "col-md-4"}
           [:div {:class "footer-widget footer-about"}
-           [:h3 {:class "footer-widget-title"} "A litte bit about the Tech Jam"]
-           [:p "Cornwall's Tech Jams are run by volunteers working in IT and education throughout Cornwall, in association with Software Cornwall, local businesses and Bodmin College."]
+           [:h3 {:class "footer-widget-title"} "A little bit about the Tech Jam"]
+           [:p "Cornwall's Tech Jams are run by volunteers working in IT and education throughout Cornwall, in association with Software Cornwall and local businesses."]
            [:p "Except where otherwise noted, content on this site is licensed under a " [:a {:href "http://creativecommons.org/licenses/by/4.0/"} "Creative Commons Attribution 4.0 International license"] "."]
            [:p  "Powered by " [:a {:href "https://clojure.org/"} "Clojure"] " and " [:a {:href "https://github.com/magnars/stasis"} "Stasis"] ", created with " [:a {:href "https://www.gnu.org/software/emacs/"} "Emacs"] ", source code on " [:a {:href "https://github.com/CornwallTechJam"} "GitHub"] "."]


Changed internal name for stored IO formats

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

--- src/conexp/io/util.clj
+++ src/conexp/io/util.clj
@@ -64,21 +64,20 @@
         set-default-write (symbol (str "set-default-" name "-format!")),
         list-formats (symbol (str "list-" name "-formats"))]
   `(do
-     (let [known-context-input-formats# (ref {})]
+     (let [known-input-formats# (ref {})]
        (defn- ~add [name# predicate#]
 	 (dosync
-	  (alter known-context-input-formats# assoc name# predicate#)))
+	  (alter known-input-formats# assoc name# predicate#)))

        (defn- ~get []
-	 (keys @known-context-input-formats#))
+	 (keys @known-input-formats#))

        (defn- ~find
          ([file#]
-            (first
-             (for [[name# predicate#] @known-context-input-formats#
-                   :when (with-open [in-rdr# (reader file#)]
-                           (predicate# in-rdr#))]
-               name#)))
+            (first (for [[name# predicate#] @known-input-formats#
+                         :when (with-in-reader file#
+                                 (predicate# *in*))]
+                     name#)))
          ([file# format#]
             format#))


delaney.clj: standardise maps when comparing DSymbols.

--- clojure/org/gavrog/clojure/delaney.clj
+++ clojure/org/gavrog/clojure/delaney.clj
@@ -195,11 +195,23 @@
             ds))
   Object
   (equals [self other]
-          (and (satisfies? IDSymbol other)
-               (= (indices self) (indices other))
-               (= (elements self) (elements other))
-               (= (.s# self) (.s# other))
-               (= (.v# self) (.v# other)))))
+          ;;TODO this should really test isomorphism via the canonical form
+          (let [ops (fn [ds]
+                      (into {} (for [i (indices ds)]
+                                 [i (into {} (for [D (elements ds)
+                                                   :when (s ds i D)]
+                                               [D (s ds i D)]))])))
+                vs (fn [ds]
+                     (into {} (for [i (indices ds)
+                                    :when (index? ds (inc i))]
+                                [i (into {} (for [D (elements ds)
+                                                  :when (v ds i (inc i) D)]
+                                              [D (v ds i (inc i) D)]))])))]
+            (and (satisfies? IDSymbol other)
+                 (= (indices self) (indices other))
+                 (= (elements self) (elements other))
+                 (= (ops self) (ops other))
+                 (= (vs self) (vs other))))))

 (defmethod print-method DSymbol [ds ^Writer w]
   (let [images (fn [i] (map #(or (s ds i %) 0) (orbit-reps ds [i])))
@@ -291,5 +303,15 @@
                  0 1 2)
          (DSymbol. 2 2
                    {0 {1 1, 2 2} 1 {1 2, 2 1} 2 {1 2, 2 1}}
-                   {1 {1 4, 2 4}})))
-  )
+                   {1 {1 4, 2 4}}))))
+
+(deftest input-output
+  (is (= (dsymbol "<1.1:2:2,1 2,2:4,6>")
+         (DSymbol. 2 2
+                   {0 {1 2, 2 1} 1 {1 1, 2 2} 2 {1 2, 2 1}}
+                   {0 {1 2, 2 2} 1 {1 3, 2 3}})))
+  (is (= (dsymbol "<1.1:2:2,1 2,2:4,5>") nil))
+  (is (= (dsymbol "<1.1:2:2,1 2,2:0,6>")
+         (DSymbol. 2 2
+                   {0 {1 2, 2 1} 1 {1 1, 2 2} 2 {1 2, 2 1}}
+                   {1 {1 3, 2 3}}))))


Revert "CMR-5806 CMR-5809 Updates doc string."

This reverts commit 9ee2b8acc23ed53126639b3d2852ff78e97c903d.

--- common-app-lib/src/cmr/common_app/api/routes.clj
+++ common-app-lib/src/cmr/common_app/api/routes.clj
@@ -227,7 +227,7 @@
       ((ring-json/wrap-json-response handler) request))))

 (defn add-security-header-response-handler
-  "Adds a number of security related response headers."
+  ""
   [handler]
   (fn [{context :request-context :as request}]
     (if-let [request-id (cxt/context->request-id context)]


Fix multipart-params usage docstring (#281)

* fix multipart-params usage docstring

* name the multipart-params to align with usage doc

--- planck-cljs/src/planck/http.cljs
+++ planck-cljs/src/planck/http.cljs
@@ -191,7 +191,7 @@
   :form-params, a map, will become the body of the request, urlencoded
   :multipart-params, a list of tuples, used for file-upload
                      {:multipart-params [[\"name\" \"value\"]
-                                         [\"name\" \"content\" \"filename\"]"
+                                         [\"name\" [\"content\" \"filename\"]]"
   ([url] (post url {}))
   ([url opts] (request js/PLANCK_REQUEST :post url opts)))

@@ -208,9 +208,10 @@
          (atom nil)))))
   (make-writer [url opts]
     (planck.core/->Writer
-     (fn [s]
-       (post url {:multipart-params [[(or (:param-name opts) "file")
-                                      [s (or (:filename opts) "file.pnk")]]]})
+     (fn [content]
+       (let [name (or (:param-name opts) "file")
+             filename (or (:filename opts) "file.pnk")]
+         (post url {:multipart-params [[name [content filename]]]}))
        nil)
      (fn [])
      (fn []))))


Add the logging part!

Add the logging part!

--- src/app/cljs/one/sample/logging.cljs
+++ src/app/cljs/one/sample/logging.cljs
@@ -17,10 +17,10 @@
                    (fn [t d] (log/info logger (str (pr-str t) " - " (pr-str d)))))

 (comment
-  ;; log to the console
-  (log/start-display (log/console-output))
   ;; log to to the "fancy" window
-  (log/start-display (log/fancy-output "main"))
-  ;; change the logging level
-  (log/set-level logger :fine)
-  )
+  (log/start-display (log/fancy-output "main")))
+
+;; log to the console
+(log/start-display (log/console-output))
+;; change the logging level
+(log/set-level logger :fine)


Fix compositefont example

Fix compositefont example

--- src/examples/compositefont.clj
+++ src/examples/compositefont.clj
@@ -39,11 +39,11 @@
 (defn -main [& _]
   ;; render in background thread
    (zgl/create-terminal
-     {:app {
+     [{:id :app
        :layers [:text :overlay]
        :columns 16 :rows 16
        :pos [0 0]
-       :font (constantly font)}}
+       :font (constantly font)}]
      {:title "Zaffre demo"
       :screen-width (* 16 16)
       :screen-height (* 16 16)


remove un-used file in close

remove un-used file in close

--- src/fileape/parquet/writer.clj
+++ src/fileape/parquet/writer.clj
@@ -94,9 +94,8 @@
     (.write record-writer nil msg)))

-(defn close! [{:keys [^ParquetRecordWriter record-writer ^File file]}]
+(defn close! [{:keys [^ParquetRecordWriter record-writer]}]
   {:pre [record-writer]}
   (locking record-writer
-    (.close record-writer nil)
-    (.)))
+    (.close record-writer nil)))


introduced reagent atom and use it for proposals

--- src-cljs/club_of_naaarfs/core.cljs
+++ src-cljs/club_of_naaarfs/core.cljs
@@ -32,6 +32,17 @@
 																				 :email      "stullrich@tomicowski.com"}}])

+;; App State
+;; ---------
+
+(defonce app-state (atom {:proposals hardcoded-proposals
+													:search    ""}))
+
+
+(defn update-search
+	"Updates :search in app-state"
+	[app-state new-search]
+	(assoc app-state :search new-search))

 ;; Search logic
@@ -50,19 +61,44 @@
 ;; View Components
 ;;----------------

-(declare proposal-list
-				 proposal-item)
-
-(defn proposal-list
-	"An unordered list of proposals"
-	[proposal-list]
+(declare
+	proposal-page
+	proposal-search
+	proposal-list
+	proposal-item)
+
+
+(defn proposal-page
+	"Proposal page" []
+	(let [{:keys [proposals search]} @app-state]
+		[:div.contain
+		 [:div.row
+			[:div.col-md-12
+			 [:img.proposal-img.pull-left {:src "/img/proposal.jpg"}]
+			 [:h1 "Proposals"]
+			 [proposal-search search]
+			 [proposal-list proposals search]]]]))
+
+(defn proposal-search
+	"A searchbox"
+	[search]
+	[:span "search, "
+	 [:input {:type      "text"
+						:value     search
+						:on-change (fn [event] (swap!
+																		 app-state
+																		 update-search
+																		 (-> event .-target .-value)))}]]
+	)
+
+(defn proposal-list "An unordered list of proposals"
+	[proposals search]
 	[:div.container-fluid
 	 [:ul.proposal-list
-		(for [proposal proposal-list]
+		(for [proposal (->> proposals (filter #(matches-search? search %)))]
 			^{:key (:title proposal)} [proposal-item proposal])]])

-(defn proposal-item
-	"A proposal item component"
+(defn proposal-item "A proposal item component"
 	[{:keys [title description] {:keys [nickname avatar-url]} :author}]
 	[:li.proposal-item
 	 [:h4 title]
@@ -70,14 +106,15 @@
 	 [:img.img-circle.img-thumb {:src avatar-url}]
 	 [:span.nickname nickname]])

-(defn nav-link [uri title page collapsed?]
+(defn nav-link "Navigation item"
+	[uri title page collapsed?]
 	[:li {:class (when (= page (session/get :page)) "active")}
 	 [:a {:href     uri
 				:on-click #(reset! collapsed? true)}
 		title]])

-(defn navbar []
+(defn navbar "Main navigation" []
 	(let [collapsed? (atom true)]
 		(fn []
 			[:nav.navbar.navbar-inverse.navbar-fixed-top
@@ -101,7 +138,7 @@
 					[nav-link "#/rich-says" "Rich says" :rich-says collapsed?]
 					[nav-link "#/proposal" "Proposals" :proposal collapsed?]]]]])))

-(defn rich-says-page []
+(defn rich-says-page "Rich's cites page " []
 	[:div.contain
 	 [:div.row]
 	 [:div.col-md-6
@@ -110,16 +147,8 @@
 		[:h1 "Rich says:"]
 		[:blockquote>span.speech "Write code in Clojure or i kill you!!!"]]])

-(defn proposal-page []
-	[:div.contain
-	 [:div.row
-		[:div.col-md-12
-		 [:img.proposal-img.pull-left {:src "/img/proposal.jpg"}]
-		 [:h1
-			"Proposals"]
-		 [proposal-list hardcoded-proposals]]]])
-
-(defn home-page []
+
+(defn home-page "Start Page" []
 	[:div.container
 	 [:div.jumbotron
 		[:h1 "Welcome to club_of_naaarfs"]


fixing compilation

fixing compilation

--- src/celestial/puppet_standalone.clj
+++ src/celestial/puppet_standalone.clj
@@ -55,7 +55,7 @@
       (let [{:keys [module]} args]
         (run (<< "rm -rf /tmp/~(:name module)*")))))

-(lifecycle puppet-provision
+(lifecycle puppet-provision {:doc "basic puppet standalone provisioning"}
   {puppet/copy-module #{puppet/extract-module}
    puppet/extract-module #{puppet/copy-yaml}
    puppet/copy-yaml #{puppet/run-puppet}


Upgrade to Java 11

Upgrade to Java 11

--- src/clj/zhluminus/routes/stories.clj
+++ src/clj/zhluminus/routes/stories.clj
@@ -55,19 +55,14 @@

           ;updated
           (subs page
+            (.indexOf page "
"
-                (+ (.indexOf page "span property=\"schema:dateCreated\""  (+ (.indexOf page "submitted-datetime" 0) 0 ) ) 0 )
-            ) 1 )
-
-            ( - (.indexOf page ""
-               (+ (.indexOf page "span property=\"schema:dateCreated\""  (+ (.indexOf page "submitted-datetime" 0) 0 ) ) 0 )
-            ) 0 )
+            (+ (.indexOf page "
" (.indexOf page "
" (.indexOf page "div property=\"schema:text\"" (.indexOf page "node__content" 0) ))1)
+                    (.indexOf page "<div class=\"node__content\"" 0)

                     (- (.indexOf page "
" (.indexOf page "node__content" 0))1)
                     ) #"src=\"/sites" "src=\"https://zerohedge.com/sites")


fix #46 for Windows

fix #46 for Windows

--- src/leiningen/droid/deploy.clj
+++ src/leiningen/droid/deploy.clj
@@ -77,8 +77,10 @@
     (binding [*out* output, *debug* true]
       (sh adb-bin device "install" "-r" apk-path))
     (let [output (str output)
-          status-line (last (.split output "\n"))]
-      (case (adb-responses status-line)
+          response (some
+                     adb-responses
+                     (.split output (System/getProperty "line.separator")))]
+      (case response
         :success (debug output)

         :inconsistent-certificates


Make ec2/describe-image return a clojure map

--- backend/src/circle/backend/ec2.clj
+++ backend/src/circle/backend/ec2.clj
@@ -213,16 +213,15 @@
 (defn describe-image [ami]
   (with-ec2-client client
     (-> client
-        (.describeImages (-> (DescribeImagesRequest.) (.withImageIds [ami]))))))
+        (.describeImages (-> (DescribeImagesRequest.) (.withImageIds [ami])))
+        (.getImages)
+        (first)
+        (bean))))

 (defn image-state
   "Given an ami, return the state of the image, a keyword, like :pending or :available"
   [ami]
   (-> (describe-image ami)
-      (bean)
-      :images
-      (first)
-      (bean)
       :state
       (keyword)))


Small clean up for data index

Small clean up for data index

--- src/main/cljs/lean_map/core.cljs
+++ src/main/cljs/lean_map/core.cljs
@@ -96,8 +96,8 @@
       (aset nodes 0 inode)
       (aset cursors-lengths 0 (.node-arity inode))
       (if (zero? datamap)
-        (create-inode-seq arr 0 nodes cursors-lengths 0 (.data-arity inode))
-        (NodeSeq. nil arr 0 nodes cursors-lengths 0 (.data-arity inode) nil))))
+        (create-inode-seq arr 0 nodes cursors-lengths 0 0)
+        (NodeSeq. nil arr 0 nodes cursors-lengths 0 (dec (.data-arity inode)) nil))))

   (inode-assoc [inode aedit shift hash key val changed?]
     (let [bit (bitpos hash shift)]
@@ -528,7 +528,7 @@
   (-reduce [coll f start] (seq-reduce f start coll)))

 (defn- create-inode-seq [arr lvl nodes cursors data-idx data-len]
-  (if (< (inc data-idx) data-len)
+  (if (< data-idx data-len)
     (NodeSeq. nil arr lvl nodes cursors (inc data-idx) data-len nil)
     (let [nodes     (aclone nodes)
           cursors (aclone cursors)]
@@ -545,7 +545,7 @@
                   (aset nodes new-lvl node)
                   (aset cursors new-lvl (.node-arity node)))
                 (if ^boolean (.has-data? node)
-                  (NodeSeq. nil (.get-array node) new-lvl nodes cursors 0 (.data-arity node) nil)
+                  (NodeSeq. nil (.get-array node) new-lvl nodes cursors 0 (dec (.data-arity node)) nil)
                   (recur (inc lvl)))))))))))

 (extend-protocol IPrintWithWriter


Minor refactoring

Minor refactoring

--- src/devtools/core.cljs
+++ src/devtools/core.cljs
@@ -168,10 +168,6 @@
 (defn body-hook [value]
   (build-body value))

-(defn call-js-fn? [target fn & args]
-  (debug/log-info "passing call to original formatter")
-  (if (not (nil? fn)) (.apply fn target (into-array args))))
-
 (defn sanitize
   "wraps our hook in try-catch block to prevent leaking of exceptions if something goes wrong"
   [hook]
@@ -185,10 +181,15 @@
 (defn chain
   "chains our hook with original formatter"
   [name hook original-formatter]
-  (fn [value]
-    (if (and *devtools-enabled* (want-value? value))
-      (hook value)
-      (call-js-fn? original-formatter (aget original-formatter name) value))))
+  (let [call-original-formatter? (fn [value]
+                                   (if (not (nil? original-formatter))
+                                     (do ; TODO should we wrap this in try-catch instead?
+                                       (debug/log-info "passing call to original formatter")
+                                       (.call (aget original-formatter name) original-formatter value))))]
+    (fn [value]
+      (if (and *devtools-enabled* (want-value? value))
+        (hook value)
+        (call-original-formatter? value)))))

 (defn cljs-formatter [original-formatter]
   (let [wrapper (fn [name hook] (debug/hook-monitor name (chain name (sanitize hook) original-formatter)))]


Comment singleton

Comment singleton

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -87,7 +87,8 @@
   (reify om/IRender
     (render [_]
       (let [bubble-class (get-bubble-class bubble)
-            ref (lib/get-reference (:id bubble))]
+            ;; ref (lib/get-reference (:id bubble))
+            ]
         (comment (println bubble)
                  (println (:id bubble)))
         (dom/li #js {:className bubble-class}
@@ -176,6 +177,7 @@
   (let [view (lib/current-view)]
     (cond
       (= view :login) (om/build login-form {})
+      (= view :reference-agree-disagree) (om/build ref/agree-disagree-view {})
       (= view :reference-dialog) (om/build ref/dialog-view {})
       (= view :reference-usages) (om/build ref/usages-view {})
       :else (discussion-elements data))))


fix bug with user sign up (#176)

fix bug with user sign up (#176)

--- spaconclj/spacon/src/spacon/components/user.clj
+++ spaconclj/spacon/src/spacon/components/user.clj
@@ -7,13 +7,13 @@
             [spacon.http.auth :refer [check-auth]]
             [clojure.spec :as s]))

-(defn get-all-users [context]
+(defn get-all-users [request]
   (response/ok (map user/sanitize (user/find-all))))

 (defn create-user
   "Creates a new user"
-  [context]
-  (let [user (get-in context [:request :json-params])]
+  [request]
+  (let [user (:json-params request)]
     (if (s/valid? :spacon.models.user/spec user)
       (if-let [new-user (user/add-user! user)]
         (response/ok (user/sanitize new-user)))
@@ -31,4 +31,4 @@
     this))

 (defn make-user-component []
-  (->UserComponent))+  (->UserComponent))


Add docstrings

Add docstrings

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -63,7 +63,9 @@
                           [x {}])))
         output))

-(defn merge-io [a b]
+(defn merge-io
+  "Merge ::index-io maps."
+  [a b]
   (letfn [(merge-attrs [a b]
             (cond
               (and (map? a) (map? b))
@@ -78,7 +80,10 @@
 (defn merge-oir [a b]
   (merge-with #(merge-with into % %2) a b))

-(defmulti index-merger (fn [k _ _] k))
+(defmulti index-merger
+  "This is an extensible gateway so you can define different strategies for merging different
+  kinds of indexes."
+  (fn [k _ _] k))

 (defmethod index-merger ::index-io [_ ia ib]
   (merge-io ia ib))


Highlighting selected step bar.

Highlighting selected step bar.

--- src-cljs/frontend/components/build_timings.cljs
+++ src-cljs/frontend/components/build_timings.cljs
@@ -84,9 +84,21 @@

 ;;; Elements of the visualization
 (defn draw-containers! [x-scale step]
-  (let [step-length      #(- (scaled-time x-scale % "end_time")
-                             (scaled-time x-scale % "start_time"))
-        step-start-pos   #(x-scale (js/Date. (aget % "start_time")))]
+  (let [step-length         #(- (scaled-time x-scale % "end_time")
+                                (scaled-time x-scale % "start_time"))
+        step-start-pos      #(x-scale (js/Date. (aget % "start_time")))
+        highlight-selected! (fn [_] (this-as
+                                      selected
+                                      (-> step
+                                          (.selectAll "rect")
+                                          (.transition)
+                                          (.duration 200)
+                                          (.attr "fill-opacity" #(this-as element (if (= element selected) 1 0.5))))))
+        reset-selected!    #(-> step
+                                (.selectAll "rect")
+                                (.transition)
+                                (.duration 500)
+                                (.attr "fill-opacity" 1))]
     (-> step
         (.selectAll "rect")
           (.data #(aget % "actions"))
@@ -96,7 +108,9 @@
           (.attr "width"  step-length)
           (.attr "height" container-bar-height)
           (.attr "y"      container-position)
-          (.attr "x"      step-start-pos))))
+          (.attr "x"      step-start-pos)
+          (.on "mouseover" highlight-selected!)
+          (.on "mouseout" reset-selected!))))

 (defn draw-step-start-line! [x-scale step]
   (let [step-start-position #(scaled-time x-scale % "start_time")]


Spelling fix (#2129)

Spelling fix (#2129)

--- src-cljs/frontend/components/setup_project.cljs
+++ src-cljs/frontend/components/setup_project.cljs
@@ -164,7 +164,7 @@
     :text [:p "Populate the config.yml with the contents of the sample .yml (shown below)."]
     :button (copy-to-clipboard selected-config-string)}
    {:number "3."
-    :text [:p "Upate the sample .yml to reflect your project's configuration."]
+    :text [:p "Update the sample .yml to reflect your project's configuration."]
     :button ""}
    {:number "4."
     :text [:p "Push this change up to your version control service (GitHub, Bitbucket)."]


org.clojure/tools.logging 0.4.0

org.clojure/tools.logging 0.4.0

--- resources/leiningen/new/aws_lambda_serverless/project.clj
+++ resources/leiningen/new/aws_lambda_serverless/project.clj
@@ -4,7 +4,7 @@

   :dependencies [[org.clojure/clojure "1.9.0"]

-                 [org.clojure/tools.logging "0.3.1"]
+                 [org.clojure/tools.logging "0.4.0"]
                  [ch.qos.logback/logback-classic "1.2.3"]
                  [org.slf4j/slf4j-api "1.7.25"]
                  [org.slf4j/log4j-over-slf4j "1.7.25"]


Define `validate-all` in terms of `bind`/`and-then`.

--- src/active/clojure/validation.cljc
+++ src/active/clojure/validation.cljc
@@ -300,6 +300,8 @@
         :else  ;; There was no success at all, return the base failure.
         base-failure))))

+(declare succeed)
+
 (defn validate-all
   "Takes a sequence of `validations` and a `candidate` and applies all
   `validations` to `candidate` sequentially.  Collects either
@@ -309,22 +311,11 @@
   (if (empty? validations)
     (make-validation-failure
      [(make-validation-error candidate [::all ::no-validators] label)])
-    (reduce (fn [acc v]
-              (let [res (v candidate label)]
-                (cond
-                  (and (validation-success? acc)
-                       (validation-success? res))
-                  acc
-
-                  (and (validation-failure? acc)
-                       (validation-failure? res))
-                  (make-validation-failure (concat (validation-failure-errors acc)
-                                                   (validation-failure-errors res)))
-                  (validation-failure? acc) acc
-
-                  (validation-failure? res) res)))
-            (pure-validation candidate)
-            validations)))
+    ;; missing labels
+    (let [labelled-validations (mapv (fn [v] (fn [c] (v c label))) validations)
+          validated            ((apply juxt labelled-validations) candidate)]
+       (and-then (apply validation vector validated)
+                 (constantly (succeed candidate))))))

 (defn optional
   "Takes a validation function `validate` and returns a validation


async-flow fx use correct default-id in dispatch

--- src/day8/re_frame/async_flow_fx.cljs
+++ src/day8/re_frame/async_flow_fx.cljs
@@ -122,10 +122,10 @@

 (re-frame/def-fx
   :async-flow
-  (fn [{:as flow :keys [id]}]
+  (fn [{:as flow :keys [id] :or {id default-id}}]
     (re-frame/def-event-fx
-      (or id default-id)                                 ;; add debug middleware if dp-patth set ???  XXX
+      id                                ;; add debug middleware if dp-path set ???  XXX
       (make-flow-event-handler flow))
-    (re-frame/dispatch [id :steup])))
+    (re-frame/dispatch [id :setup])))


Oops, undo accidental commit of testing code

--- src/braid/core/client/bots/views/bots_page.cljs
+++ src/braid/core/client/bots/views/bots_page.cljs
@@ -119,7 +119,7 @@
         admin? (subscribe [:current-user-is-group-admin?] [group-id])
         dragging? (r/atom false)
         error (r/atom nil)
-        new-bot (r/atom {:avatar "https://s3.amazonaws.com/chat.leanpixel.com/uploads/5a693df3-5e3b-4a90-9173-c2a335aff863/dice.png"})
+        new-bot (r/atom {})
         state (r/atom :initial)
         bot-valid? (reaction (and
                                (and (string? (@new-bot :name))


streaming test helpers

streaming test helpers

--- src/er_cassandra/model/util/test.clj
+++ src/er_cassandra/model/util/test.clj
@@ -5,6 +5,7 @@
    [deferst :refer [defsystem]]
    [deferst.system :as sys]
    [slf4j-timbre.configure :as logconf]
+   [manifold.stream :as stream]
    [er-cassandra.record :as r]
    [er-cassandra.session :as s]
    [er-cassandra.model :as m]
@@ -17,7 +18,8 @@
 (def alia-test-model-session-config
   {:timbre {:level :warn}
    :config {:alia-session
-            {:keyspace "er_cassandra_test"}}})
+            {:keyspace "er_cassandra_test"
+             :truncate-on-close false}}})

 (def alia-test-model-session-system-def
   [[:logging logconf/configure-timbre [:timbre]]
@@ -64,3 +66,24 @@
   ([entity record] (upsert-instance entity record nil))
   ([entity record opts]
    @(m/upsert *model-session* entity record (ts/past-timestamp-opt opts))))
+
+(defn record-stream
+  ([table-name] (record-stream table-name {}))
+  ([table-name opts]
+   @(r/select-buffered *model-session* table-name opts)))
+
+(defn instance-stream
+  ([entity] (instance-stream entity {}))
+  ([entity opts]
+   @(m/select-buffered *model-session* entity opts)))
+
+(defn upsert-instance-stream
+  ([entity instance-stream]
+   (upsert-instance-stream entity instance-stream {}))
+  ([entity instance-stream opts]
+   @(m/upsert-buffered *model-session* entity instance-stream opts)))
+
+(defn sync-consume-stream
+  "synchronously consume a stream"
+  [stream]
+  @(stream/reduce (fn [_ _]) nil stream))


insert-record

insert-record

--- src/er_cassandra/model/util/test.clj
+++ src/er_cassandra/model/util/test.clj
@@ -50,3 +50,7 @@
 (defn fetch-record
   [table key key-value]
   @(r/select-one *model-session* table key key-value))
+
+(defn insert-record
+  [table record]
+  @(r/insert *model-session* table record))


Refactor MSE computation

Refactor MSE computation

--- src/cortex/optimise.clj
+++ src/cortex/optimise.clj
@@ -116,11 +116,12 @@
 (deftype MSELoss []
   cp/PLossFunction
     (loss [this v target]
-      (let [z (m/sub v target)]
-        (m/esum (m/pow z 2))))
+      (mean-squared-error v target))

     (loss-gradient [this v target]
-      (m/sub v target)))
+      (let [r (m/mutable v)]
+        (m/sub! r target)
+        (m/scale! r (/ 2.0 (double (m/ecount v)))))))

 (defn mse-loss
   "Returns a Mean Squared Error (MSE) loss function"


make kibit happy

make kibit happy

--- src/cljs/lambdacd/console_output_processor.cljs
+++ src/cljs/lambdacd/console_output_processor.cljs
@@ -39,8 +39,8 @@

 (defn- partition-by-newline [c]
   (let [by-k #(not= :newline %)]
-    (->> (partition-by by-k c)
-         (filter #(not= [:newline] %)))))
+    (filter #(not= [:newline] %)
+            (partition-by by-k c))))

 (defn process-ascii-escape-characters [s]


memoize graph metadata on signal definitions

--- src/cljx/jamesmacaulay/zelkova/impl/signal.cljx
+++ src/cljx/jamesmacaulay/zelkova/impl/signal.cljx
@@ -82,40 +82,6 @@
   ([value] (->Cached value nil))
   ([value event] (->Cached value event)))

-(defprotocol SignalProtocol
-  (signal-deps [s] "returns the set of \"parent\" signal which this signal depends on"))
-
-(defn signal?
-  "returns `true` if the argument satisfies `SignalProtocol`, `false` otherwise"
-  [x]
-  (satisfies? SignalProtocol x))
-
-(defrecord SignalDefinition
-  [init-fn sources relayed-event-topic msg-fn deps event-sources]
-  SignalProtocol
-  (signal-deps [_]
-    (into #{}
-          (filter signal?)
-          (or deps sources))))
-
-(defn- setup-event-relay
-  "Takes a topic, and returns an input signal which relays matching events as messages to its children"
-  [opts]
-  (if-let [relayed-topic (:relayed-event-topic opts)]
-    (assoc opts
-      :sources [:events]
-      :msg-fn (fn [prev [event]]
-                (when (= relayed-topic (topic event))
-                  (fresh (value event)))))
-    opts))
-
-(defn make-signal
-  "Takes a map of opts and returns a signal."
-  [opts]
-  (-> opts
-      (setup-event-relay)
-      (map->SignalDefinition)))
-
 (def ^{:doc "A transducer which takes in batches of signal graph messages and pipes out fresh values."}
   fresh-values
   (comp cat
@@ -123,6 +89,18 @@
         (map value)))

 ; compiling graphs:
+
+(defprotocol SignalProtocol
+  (signal-deps [s] "returns the set of \"parent\" signals on which this signal depends")
+  (parents-map [s])
+  (kids-map [s])
+  (topsort [s])
+  (-get-graph-meta [s k]))
+
+(defn signal?
+  "returns `true` if the argument satisfies `SignalProtocol`, `false` otherwise"
+  [x]
+  (satisfies? SignalProtocol x))

 (defn- node-graph-zipper
   "Takes a signal and returns a zipper which can be used to traverse the signal graph."
@@ -179,13 +157,53 @@
   [output-node]
   (-> output-node calculate-dependency-maps :parents-map))

-(defn topsort
-  "Takes a signal and returns a topologically sorted sequence of all signals in its graph."
-  [output]
-  (-> output
-      output-node->dependency-map
-      kahn/kahn-sort
-      reverse))
+(defrecord SignalDefinitionMetadata
+  [parents-map kids-map topsort])
+
+(defrecord SignalDefinition
+  [init-fn sources relayed-event-topic msg-fn deps event-sources]
+  SignalProtocol
+  (signal-deps [_]
+    (into #{}
+          (filter signal?)
+          (or deps sources)))
+  (-get-graph-meta [s k]
+    (let [meta-atom (-> s meta (get k))
+          memoized @meta-atom]
+      (if-not (nil? memoized)
+        memoized
+        (let [{:keys [parents-map kids-map topsort]} (calculate-graph-meta s)
+              m (meta s)]
+          (-> m :parents-map (reset! parents-map))
+          (-> m :kids-map (reset! kids-map))
+          (-> m :topsort (reset! topsort))
+          @meta-atom))))
+  (parents-map [s] (-get-graph-meta s :parents-map))
+  (kids-map [s] (-get-graph-meta s :kids-map))
+  (topsort [s] (-get-graph-meta s :topsort)))
+
+(defn- setup-event-relay
+  "Takes a topic, and returns an input signal which relays matching events as messages to its children"
+  [opts]
+  (if-let [relayed-topic (:relayed-event-topic opts)]
+    (assoc opts
+      :sources [:events]
+      :msg-fn (fn [prev [event]]
+                (when (= relayed-topic (topic event))
+                  (fresh (value event)))))
+    opts))
+
+(defn- setup-metadata
+  [sig]
+  (with-meta sig (->SignalDefinitionMetadata (atom nil) (atom nil) (atom nil))))
+
+(defn make-signal
+  "Takes a map of opts and returns a signal."
+  [opts]
+  (-> opts
+      (setup-event-relay)
+      (map->SignalDefinition)
+      (setup-metadata)))

 (defrecord CompiledGraph
   [output-signal sorted-signals])


CLJS: remove read-ctor support

CLJS: remove read-ctor support

--- src/main/cljs/cljs/tools/reader.cljs
+++ src/main/cljs/cljs/tools/reader.cljs
@@ -791,35 +791,6 @@
     \? read-cond
     nil))

-(defn emit-ctor [type ns record val]
-  (let [method-name (symbol (str (if (= type :extended) 'map) '-> (name record)))
-        method (ns-resolve ns method-name)]
-    (apply @method val)))
-
-(defn- read-ctor [^not-native rdr class-name opts pending-forms]
-  (let [ns (namespace class-name)
-        ns-parts (string/split class-name #"[\./]")
-        record (if ns (name class-name) (last ns-parts))
-        ns (or ns (string/join "." (butlast ns-parts)))
-        ch (read-past whitespace? rdr)] ;; differs from clojure
-    (if-let [[end-ch form] (case ch
-                             \[ [\] :short]
-                             \{ [\} :extended]
-                             nil)]
-      (let [entries (read-delimited end-ch rdr opts pending-forms)]
-        (case form
-          :short
-          (emit-ctor :short ns record entries)
-          :extended
-          (let [vals (apply hash-map entries)]
-            (loop [s (keys vals)]
-              (if s
-                (if-not (keyword? (first s))
-                  (reader-error rdr "Unreadable ctor form: key must be of type cljs.core.Keyword")
-                  (recur (next s)))))
-            (emit-ctor :extended ns record [vals]))))
-      (reader-error rdr "Invalid reader constructor form"))))
-
 (defn- read-tagged [^not-native rdr initch opts pending-forms]
   (let [tag (read* rdr true nil opts pending-forms)]
     (if-not (symbol? tag)
@@ -829,11 +800,9 @@
       (if-let [f (or (*data-readers* tag)
                      (default-data-readers tag))]
         (f (read* rdr true nil opts pending-forms))
-        (if (> (.indexOf (name tag) ".") 1)
-          (read-ctor rdr tag opts pending-forms)
-          (if-let [f *default-data-reader-fn*]
-            (f tag (read* rdr true nil opts pending-forms))
-            (reader-error rdr "No reader function for tag " (name tag))))))))
+        (if-let [f *default-data-reader-fn*]
+          (f tag (read* rdr true nil opts pending-forms))
+          (reader-error rdr "No reader function for tag " (name tag)))))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Public API


Tidy up after statement was posted

Tidy up after statement was posted

--- src/discuss/communication/main.cljs
+++ src/discuss/communication/main.cljs
@@ -6,7 +6,8 @@
             [discuss.utils.common :as lib]
             [discuss.references.integration :as rint]
             [discuss.communication.lib :as comlib]
-            [cljs.spec.alpha :as s]))
+            [cljs.spec.alpha :as s]
+            [discuss.components.search.statements :as search]))

 ;;;; Calls
 (defn process-url-handler
@@ -15,6 +16,8 @@
   [response]
   (let [res (lib/process-response response)
         url (:url res)]
+    (lib/remove-origin!)
+    (search/remove-search-results!)
     (lib/hide-add-form!)
     (lib/update-state-item! :layout :add-type (fn [_] nil))
     (rint/request-references)
@@ -76,9 +79,12 @@
        (println "Action not found:" action))))
   ([statement reference] (dispatch-add-action statement reference nil)))

-#_(s/fdef dispatch-add-action
-        :args (s/cat :statement string? :reference string?))
-
+(comment
+  (do
+    (lib/update-state-item! :layout :add-type (fn [_] :add-start-statement))
+    (dispatch-add-action "something cool" nil {:author "kangaroo", :content "you have to take the dog for a walk every day, which is tedious", :aggregate-id "huepfer.verlag", :entity-id "42", :version 100})
+    )
+  )

 (defn prepare-add
   "Save current add-method and show add form."


All GET and POST request to Jenkins should use http-client

--- src/emender_jenkins/jenkins_api.clj
+++ src/emender_jenkins/jenkins_api.clj
@@ -3,14 +3,38 @@
 (require '[clojure.xml       :as xml])
 (require '[clojure.zip       :as zip])

+(require '[clj-http.client   :as http-client])
+
 (require '[clojure.data.json :as json])
 (require '[clj-http.client   :as http-client])
+
+(defn get-command
+    [url]
+    (:body (http-client/get url {
+                    :keystore "keystore"
+                    :keystore-pass "changeit"
+                    :trust-store "keystore"
+                    :trust-store-pass "changeit"})))
+
+(defn job-name->url
+    [jenkins-url job-name]
+    (str jenkins-url "job/" (.replaceAll job-name " " "%20")))
+
+(defn post-command
+    [jenkins-url job-name command]
+    (let [url (str (job-name->url jenkins-url job-name) "/" command)]
+        (println "URL to use: " url)
+        (http-client/post url {
+                    :keystore "keystore"
+                    :keystore-pass "changeit"
+                    :trust-store "keystore"
+                    :trust-store-pass "changeit"})))

 (defn read-list-of-all-jobs
     [jenkins-url job-list-part]
     (let [all-jobs-url (str jenkins-url job-list-part)]
         (println "Using the following URL to retrieve all Jenkins jobs: " all-jobs-url)
-        (let [data (json/read-str (slurp all-jobs-url))]
+        (let [data (json/read-str (get-command all-jobs-url))]
             (if data
                 (get data "jobs")
                 nil))))
@@ -22,8 +46,8 @@
            test-jobs))

 (defn read-job-results
-    [job-name jenkins-url]
-    (let [url (str jenkins-url "job/" (.replaceAll job-name " " "%20") "/lastSuccessfulBuild/artifact/results.json/")]
+    [jenkins-url job-name]
+    (let [url (str (job-name->url jenkins-url job-name) "/lastSuccessfulBuild/artifact/results.json/")]
         (println "Using the following URL to retrieve job results: " url)
         (try
             (slurp url)
@@ -31,3 +55,15 @@
                  (.printStackTrace e)
                  nil))))

+(defn start-job
+    [jenkins-url job-name]
+    (post-command jenkins-url job-name "build"))
+
+(defn enable-job
+    [jenkins-url job-name]
+    (post-command jenkins-url job-name "enable"))
+
+(defn disable-job
+    [jenkins-url job-name]
+    (post-command jenkins-url job-name "disable"))
+


Fix printing

Fix printing

--- src/exp/sas_hierarchy_induction.clj
+++ src/exp/sas_hierarchy_induction.clj
@@ -135,7 +135,7 @@
     (effect-sets     [] @effect-sets-atom)
     (pre-ref-pairs   [] (if (= src-val dst-val) [[{} []]]
                             (for [vs (vals @successor-map-atom), v vs] [{} v])))
-    (compile-hla     [] (if (= src-val dst-val) [] (default-compile-hla-noflatten this)))
+    (compile-hla     [] (if (= src-val dst-val) [] (default-compile-hla #_-noflatten this)))
   env/Action
     (action-name [] (vv-hla-name var src-val dst-val))
     (primitive?  [] false)
@@ -404,7 +404,9 @@

 (defn pretty-print-hierarchy [hierarchy]
-  (pretty-print-action (first (:initial-plan hierarchy)) (HashSet.)))
+  (let [hs (HashSet.), ip (:initial-plan hierarchy)]
+    (println "\nInitial plan is:" (map env/action-name ip ))
+    (doseq [a ip] (pretty-print-action a hs))))


Update words.clj

Update words.clj

--- src/iyye/subcon/knowledge/words.clj
+++ src/iyye/subcon/knowledge/words.clj
@@ -60,57 +60,34 @@
 (defn load-iyye-types-from-db [name]
   (load-iyye-atoms-from-db name "types"))

-(defn save-iyye-type-to-db [type]
-  )
-
 (defn load-iyye-relations-from-db [name]
   (load-iyye-atoms-from-db name "relations"))

-(defn get-iyye-atoms [name builtins dbname]
-  (let [builtin-types #(for [word @builtins :when (= (:Name word) name)] word)
-        loaded-types (load-iyye-atoms-from-db name dbname)]
-    (if (empty? builtin-types)
-      (if (empty? loaded-types)
-        :UNKNOWN
-        loaded-types)
-      (if (empty? loaded-types)
-        builtin-types
-        (apply conj builtin-types loaded-types)))))
+(defn save-iyye-type-to-db [type]
+  )
+;(persistence/write-noun-to-db (into {} type))
+
+(defn get-iyye-atoms [name builtins]
+  (let [builtin-types (for [word (vals @builtins) :when (= (:Name (:atom word)) name)] word)]
+    (if (empty? builtin-types) :UNKNOWN builtin-types)))

 (defn get-iyye-types [name]
-  (get-iyye-atoms name noun-words "types"))
+  (get-iyye-atoms name noun-words))
+
+(defn get-iyye-relations [name]
+  (get-iyye-atoms name action-words))

 (defn set-iyye-type! [type]
   (let [uname (:Uname (:atom type))
         builtin (:Builtin (:atom type))]
-(do (dosync (alter noun-words assoc @noun-words uname type))
     (when builtin
-      (save-iyye-type-to-db type)))
-    ))
-
-; (defn get-iyye-relations [name]
-  ; (let [builtin-relations #(for [word @action-words :when (= (:Name word) name)] word)
-  ;       loaded-relations (load-iyye-relations-from-db name)]
-  ; (if (empty? builtin-relations)
-  ; (if (empty? loaded-relations)
-  ;       :UNKNOWN
-  ;      loaded-relations)
-  ; (if (empty? loaded-relations)
-  ;        builtin-relations
-  ;        (apply conj builtin-relations loaded-relations)))))
-
-(defn get-iyye-relations [name]
-  (let [builtin-relations #(for [word @action-words :when (= (:Name word) name)] word)]
-    (if (empty? builtin-relations)
-      :UNKNOWN
-      builtin-relations)))
+      (do
+        (dosync (alter noun-words assoc @noun-words uname type))
+        (save-iyye-type-to-db type)))))

 (defn check-params [action params]
   (let [act-params (:Types action)]
-    (compare act-params (map #(:Name (:atom %)) params))))
-
-  ;(dosync (alter types-words conj type))
-  ;(persistence/write-noun-to-db (into {} type))
+    (compare act-params (map #(:Name (:atom %)) params))))  ; FIXME Yumzya context aware compare

 (defn apply-relation [relation params]
   (when (check-params relation params)


The G string is a petabyte.

The G string is a petabyte.

--- src/kolmogorov_music/kolmogorov.clj
+++ src/kolmogorov_music/kolmogorov.clj
@@ -16,7 +16,7 @@
 ;;; Air on the \G String ;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(comment (repeat (* 1000 1000 1000) \G))
+(comment (repeat (* 1000 1000 1000 1000) \G))

 (defmacro description-length [expr]
   (-> expr print-str count))


Validate nil values as empty strings

Validate nil values as empty strings

--- src/mdr2/dtbook/validation.clj
+++ src/mdr2/dtbook/validation.clj
@@ -46,7 +46,8 @@
   "Validate `paths` in `loc` against a given `value`. Return true if
   all paths contain the `value`"
   [loc value paths]
-  (every? #(= (get-path loc %) value) paths))
+  (every? #(= (get-path loc %) (str value)) paths))
+;;  (every? #(or (= (get-path loc %) value) (and (nil? value) (string/blank? (get-path loc %)))) paths))

 (defn get-paths [loc paths]
   (map #(get-path loc %) paths))


Make sure to de-CLOB-er the error message for H2 legacy query executions

--- src/metabase/db/migrations.clj
+++ src/metabase/db/migrations.clj
@@ -343,7 +343,7 @@
   models/IModel
   (merge models/IModelDefaults
          {:default-fields (constantly [:executor_id :result_rows :started_at :json_query :error :running_time])
-          :types          (constantly {:json_query :json})}))
+          :types          (constantly {:json_query :json, :error :clob})}))

 (defn- LegacyQueryExecution->QueryExecution
   "Convert a LegacyQueryExecution to a format suitable for insertion as a new-format QueryExecution."


add data migration which sets the proper initial visibililty_type on fields.

--- src/metabase/db/migrations.clj
+++ src/metabase/db/migrations.clj
@@ -7,6 +7,7 @@
             (metabase.models [activity :refer [Activity]]
                              [card :refer [Card]]
                              [database :refer [Database]]
+                             [field :refer [Field]]
                              [foreign-key :refer [ForeignKey]]
                              [table :refer [Table]]
                              [setting :as setting])
@@ -107,3 +108,30 @@
         (log/debug "Removing duplicate FK entries for" k)
         (doseq [duplicate-fk (drop-last fks)]
           (db/del ForeignKey :id (:id duplicate-fk)))))))
+
+
+;; migrate data to new visibility_type column on field
+(defmigration migrate-field-visibility-type
+  (when (< 0 (:cnt (first (k/select Field (k/aggregate (count :*) :cnt) (k/where (= :visibility_type "unset"))))))
+    ;; start by marking all inactive fields as :retired
+    (k/update Field
+      (k/set-fields {:visibility_type "retired"})
+      (k/where      {:visibility_type "unset"
+                     :active          false}))
+    ;; anything that is active with field_type = :sensitive gets visibility_type :sensitive
+    (k/update Field
+      (k/set-fields {:visibility_type "sensitive"})
+      (k/where      {:visibility_type "unset"
+                     :active          true
+                     :field_type      "sensitive"}))
+    ;; if field is active but preview_display = false then it becomes :details-only
+    (k/update Field
+      (k/set-fields {:visibility_type "details-only"})
+      (k/where      {:visibility_type "unset"
+                     :active          true
+                     :preview_display false}))
+    ;; everything else should end up as a :normal field
+    (k/update Field
+      (k/set-fields {:visibility_type "normal"})
+      (k/where      {:visibility_type "unset"
+                     :active          true}))))


account for case in table sync where we are syncing a dynamic-schema table.

--- src/metabase/sync_database.clj
+++ src/metabase/sync_database.clj
@@ -85,18 +85,18 @@

     (binding [qp/*disable-qp-logging*  true
               db/*sel-disable-logging* true]
+      ;; if the Table has a RawTable backing it then do an introspection and sync
       (when-let [raw-tbl (db/sel :one raw-table/RawTable :id (:raw_table_id table))]
-        ;; introspect
         (introspect/introspect-raw-table-and-update! driver database raw-tbl)
+        (sync/update-data-models-for-table! table))

-        ;; sync
-        (if (driver/driver-supports? driver :dynamic-schema)
-          (sync-dynamic/scan-table-and-update-data-model! driver database table)
-          (sync/update-data-models-for-table! table))
+      ;; if this table comes from a dynamic schema db then run that sync process now
+      (when (driver/driver-supports? driver :dynamic-schema)
+        (sync-dynamic/scan-table-and-update-data-model! driver database table))

-        ;; analyze
-        (when full-sync?
-          (analyze/analyze-table-data-shape! driver table))))
+      ;; analyze if we are supposed to
+      (when full-sync?
+        (analyze/analyze-table-data-shape! driver table)))

     (events/publish-event :table-sync {:table_id (:id table)})
     (log/info (u/format-color 'magenta "Finished syncing table '%s' from %s database '%s'. (%s)" (:display_name table) (name driver) (:name database)


moved the function literals to the top of the block, in a vain attempt to improve readability;

--- src/mustached_hipster/core.clj
+++ src/mustached_hipster/core.clj
@@ -20,10 +20,15 @@
    ;; work around dangerous default behaviour in Clojure
    (alter-var-root #'*read-eval* (constantly false))

-   (spit "foo.txt"
-      (apply str (take 10
-         (map
-            #(s/replace % #"\?.*" "\n")
-            (filter
-               #(not= \# (first %))
-               (s/split-lines (:body (get-playlist url)))))))))
+   (let
+      [not-comment #(not= \# (first %))
+       chop-query  #(s/replace % #"\?.*" "\n") ]
+
+      (spit "foo.txt"
+         (apply str
+            (take 10
+               (map chop-query
+                  (filter not-comment
+                     (s/split-lines
+                        (:body
+                           (get-playlist url))))))))))


:tada: Accept (animated) gif as a valid image format

--- common/uxbox/common/media.cljc
+++ common/uxbox/common/media.cljc
@@ -13,7 +13,7 @@
    [cuerdas.core :as str]))

 (def valid-media-types
-  #{"image/jpeg", "image/png", "image/webp", "image/svg+xml"})
+  #{"image/jpeg", "image/png", "image/webp", "image/gif", "image/svg+xml"})

 (def str-media-types (str/join "," valid-media-types))

@@ -23,6 +23,7 @@
     :png  ".png"
     :jpeg ".jpg"
     :webp ".webp"
+    :gif ".gif"
     :svg  ".svg"))

 (defn format->mtype
@@ -31,6 +32,7 @@
     :png  "image/png"
     :jpeg "image/jpeg"
     :webp "image/webp"
+    :gif "image/gif"
     :svg  "image/svg+xml"))

 (defn mtype->format
@@ -39,6 +41,7 @@
     "image/png"     :png
     "image/jpeg"    :jpeg
     "image/webp"    :webp
+    "image/gif"     :gif
     "image/svg+xml" :svg
     nil))


allow optional not-found arg

allow optional not-found arg

--- src/org/spootnik/fleet/api.clj
+++ src/org/spootnik/fleet/api.clj
@@ -6,12 +6,18 @@

 (defn interpol
-    [input args]
-    (let [clean   #(str/replace % #"(\{\{|\}\})" "")
-          args    (assoc (into {} (map-indexed #(vector (str %1) %2) args))
-                    "*" (str/join " " args))
-          extract (fn [k] (get args (clean k) ""))]
-      (str/replace input #"\{\{[0-9*]+\}\}" extract)))
+  ([input args not-found]
+     (let [clean   #(str/replace % #"(\{\{|\}\})" "")
+           args    (assoc (into {} (map-indexed #(vector (str %1) %2) args))
+                     "*" (str/join " " args))
+           extract (fn [k] (get args
+                                (clean k)
+                                (if (fn? not-found)
+                                  (not-found)
+                                  not-found)))]
+       (str/replace input #"\{\{[0-9*]+\}\}" extract)))
+  ([input args]
+     (interpol input args "")))

 (defn prepare-command
   [args command]


Make the (start ...) and (stop ...) functions of services optional

--- src/main/workflo/macros/service.clj
+++ src/main/workflo/macros/service.clj
@@ -81,11 +81,11 @@
        ~'[service config redis]
      com.stuartsierra.component/Lifecycle
      (~'start [~'this]
-      (let [~'this' ((:start ~'service) ~'this)]
+      (let [~'this' ((or (:start ~'service) identity) ~'this)]
         (register-service-component! (:name ~'service) ~'this')
         ~'this'))
      (~'stop [~'this]
-      (let [~'this' ((:stop ~'service) ~'this)]
+      (let [~'this' ((or (:stop ~'service) identity) ~'this)]
         (unregister-service-component! (:name ~'service))
         ~'this'))
      workflo.macros.service/IService


converting datetime to instant in for dataflow timestamps

--- src/datasplash/core.clj
+++ src/datasplash/core.clj
@@ -33,7 +33,7 @@
            [org.joda.time DateTimeUtils DateTimeZone]
            [org.joda.time.format DateTimeFormat DateTimeFormatter]
            [com.google.cloud.dataflow.sdk.transforms.windowing Window FixedWindows SlidingWindows Sessions Trigger]
-           [org.joda.time Duration]))
+           [org.joda.time Duration Instant]))

 (def required-ns (atom #{}))

@@ -263,7 +263,7 @@
   (ds/map (fn [e] (ds/with-timestamp (clj-time.core/now) (* 2 e)) pcoll))
   ```"
   [timestamp result]
-  (->TimeStamped timestamp result))
+  (->TimeStamped (Instant. (timc/to-long timestamp)) result))

 (defn output-value!
   [^DoFn$ProcessContext context entity bindings]


Fix whitespace at end of line

Fix whitespace at end of line

--- src/desdemona/utils.clj
+++ src/desdemona/utils.clj
@@ -27,7 +27,7 @@
                       {:catalog catalog :task-name task-name})))
     (first matches)))

-(defn update-task
+(defn update-task
   "Finds the catalog entry with :onyx/name task-name
   and applies f to it, returning the full catalog with the
   transformed catalog entry"


use constant move distance, display team turn, add action count

--- src/dodgeball/core.cljs
+++ src/dodgeball/core.cljs
@@ -9,26 +9,29 @@
 (defonce app-state (atom
                     {:cells
                         {:blue-team
-                         [{:coords {:x 0, :y 0} :distance 6}
-                          {:coords {:x 2, :y 0} :distance 6}
-                          {:coords {:x 4, :y 0} :distance 6}
-                          {:coords {:x 6, :y 0} :distance 6}
-                          {:coords {:x 8, :y 0} :distance 6}]
+                         [{:coords {:x 0, :y 0}}
+                          {:coords {:x 2, :y 0}}
+                          {:coords {:x 4, :y 0}}
+                          {:coords {:x 6, :y 0}}
+                          {:coords {:x 8, :y 0}}]
                         :red-team
-                         [{:coords {:x 0, :y 8} :distance 6}
-                          {:coords {:x 2, :y 8} :distance 6}
-                          {:coords {:x 4, :y 8} :distance 6}
-                          {:coords {:x 6, :y 8} :distance 6}
-                          {:coords {:x 8, :y 8} :distance 6}]
+                         [{:coords {:x 0, :y 8}}
+                          {:coords {:x 2, :y 8}}
+                          {:coords {:x 4, :y 8}}
+                          {:coords {:x 6, :y 8}}
+                          {:coords {:x 8, :y 8}}]
                         :balls
                          [{:coords {:x 0, :y 4}}
                           {:coords {:x 2, :y 4}}
                           {:coords {:x 4, :y 4}}
                           {:coords {:x 6, :y 4}}
-                          {:coords {:x 8, :y 4}}]}}))
+                          {:coords {:x 8, :y 4}}]}
+                     :turn :blue-team
+                     :actions 0}))

 (def board-size (range 0 9))
 (def bench-size 4)
+(def move-range 6)

 (defn border-top [y]
   (cond
@@ -46,6 +49,7 @@
           (kind (:cells (om/root-cursor app-state))))))

 (defn highlight-tile [e]
+  ;(om/transact! (om/root-cursor app-state) [:cells (]
  (set! (.. e -target -style -background) "gray"))

 (defn tile-view [cursor owner]
@@ -56,40 +60,73 @@
         (if-let [ball (unit? :balls coords)]
           (dom/div #js {:className "ball"}))
         (if-let [red-player (unit? :red-team coords)]
-          (dom/div #js {:onClick #(highlight-tile %) :className "red-team"}))
+          (dom/div
+           #js {:onClick #(highlight-tile %)
+           :className "red-team"}))
         (if-let [blue-player (unit? :blue-team coords)]
-          (dom/div #js {:className "blue-team"}))))))
+          (dom/div
+           #js {:onClick #(highlight-tile %)
+           :className "blue-team"}))))))
+
+(defn distance [a b]
+  (Math/abs (- b a)))
+
+(defn in-range? [target selected]
+  (<=
+   (reduce
+    +
+    (map distance (vals target) (vals selected)))
+   move-range))

+(defn turn-view [data owner]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/h2 nil (str "Turn: " data)))))
+
+(defn action-view [data owner]
+  (reify
+    om/IRender
+    (render [_]
+      (dom/h2 nil (str "Actions: " data)))))

 (defn board-view [app owner]
   (reify
     om/IInitState
     (init-state [_]
-      {:move (chan)})
+      {:move (chan)
+       :selected-unit nil})

     om/IWillMount
     (will-mount [_]
      (let [move (om/get-state owner :move)]
        (go (loop []
-          (let [selected (:coords (<! move))
-                target (:coords (<! move))]
-            (if (unit? :red-team target)
+          (let [selected (:coords (<! move))]
+            (om/set-state! owner :selected-unit (first (filter #(= selected (:coords %)) ((:turn app) (:cells @app-state)))))
+            (let [target (:coords (<! move))]
+              (println (om/get-state owner :selected-unit))
+            (if (or
+                 (unit? (:turn app) target)
+                 (not (in-range? target selected)))
               (println "CAN'T MOVE THERE")
-              (om/transact! app [:cells :red-team]
-                (fn [units]
+              (om/transact!
+               app
+               [:cells (:turn app)]
+               (fn [units]
                   (map
-                   #(if (and
-                         (= selected (:coords %))
-                         (<= (reduce + (map (fn [a b] (Math/abs (- b a))) (vals target) (vals selected))) (:distance %)))
-                      (conj % {:coords target})
+                   #(if (= (om/get-state owner :selected-unit) %)
+                      {:coords target}
                       %)
-                   units)))))
+                   units))))
+              (om/transact! app :actions (fn [a] (inc a)))))
           (recur)))))

     om/IRenderState
     (render-state [this {:keys [move]}]
       (dom/div #js {:className "container"}
+        (om/build turn-view (:turn app))
+        (om/build action-view (:actions app))
         (bench)
         (apply dom/table nil
           (vec (for [y board-size]


Remove unused queue code.

Remove unused queue code.

--- src/circle/backend/build/queue.clj
+++ src/circle/backend/build/queue.clj
@@ -1,25 +0,0 @@
-(ns circle.backend.build.queue
-  (:use [clojure.core.incubator :only (-?>)])
-  (:require [circle.queue-mongo :as queue])
-  (:require [clj-time.core :as time])
-  (:use [circle.util.args :only (require-args)])
-  (:require [circle.model.build]))
-
-(def build-queue :builds)
-
-(defn enqueue-build
-  "Adds a build to the queue"
-  [{:keys [vcs_url vcs_revision]
-    :as args}]
-  (require-args vcs_url vcs_revision)
-  (let [build (circle.model.build/insert! {:vcs_url vcs_url
-                                           :vcs_revision vcs_revision
-                                           :queued-at (-> (time/now) (.toDate))})]
-    (let [resp (queue/enqueue build-queue build)]
-      resp)))
-
-(defn run-next-queued-build
-  []
-  (let [resp (queue/dequeue build-queue)]
-    (println resp)
-    (-?> resp (first) :body (read-string))))


Refactoring

Refactoring

--- src/clj/algorithms_clj/huffman.clj
+++ src/clj/algorithms_clj/huffman.clj
@@ -58,22 +58,17 @@
       ))
   (get-bits-impl huffman-tree []))

-(defn tree->encoder
-  "Create a decoder with memoization"
-  [huffman-tree]
-  (memoize #(get-bits huffman-tree %)))
-
 (defn encode-with
   "Encode a stream of values with the decoder provided as first parameter"
-  [encoder values]
-  (transduce (mapcat encoder) conj [] values))
+  [huffman-tree values]
+  (let [encoder (memoize #(get-bits huffman-tree %))]
+    (transduce (mapcat encoder) conj [] values)))

 (defn encode
   "Encode a stream, using the stream frequences to build the huffman tree"
   [values]
   (-> (frequencies values)
       (make-tree)
-      (tree->encoder)
       (encode-with values)))

@@ -111,7 +106,7 @@

 (defn tests []
   ;; TODO - Symetric testings with test.checks
-  (prn (encode-with (tree->encoder t) [:a :b]))
+  (prn (encode-with t [:a :b]))
   (prn (encode [:a :b]))
   (prn (decode t [0 1 0 0 1 1]))
   )


Use the ionian function in the intro too.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -63,7 +63,7 @@
         next))))

 (defn intro# [timing]
-    (even-melody# timing (take 32 (cycle [9 7])))
+    (even-melody# timing (take 32 (cycle (map ionian [5 4]))))
     (rhythm-n-bass# timing (take 8 (cycle progression))))

 (defn first-bit# [timing]
@@ -103,4 +103,4 @@

 (defn play# [] (-> (bpm 120) (from 2) intro# first-bit# (speed-up 3/2) variation# final-chord#))

-;(play#)
+; (play#)


added prepared debug statements for switching wordcloud generation

--- src/distillery/core.clj
+++ src/distillery/core.clj
@@ -89,5 +89,7 @@
 ;;     (generate-website! job)
 ;;     (run-complete! job-descr)
 ;;
+;; (def job (assoc-in job [:configuration :skip-wordclouds] true))
+;; (def job (assoc-in job [:configuration :skip-wordclouds] false))
 ;; (def job (assoc-in job [:configuration :parallel-proc] true))
 ;; (def job (assoc-in job [:configuration :parallel-proc] false))


Change output to CSV format

Change output to CSV format

--- src/hydrofoil/core.clj
+++ src/hydrofoil/core.clj
@@ -15,6 +15,15 @@
     (doseq [item list]
     (println (json/write-str item))))

+(defn print-csv-item [item]
+  (do (doseq [element item]
+        (print (key element) "," (val element) ", "))
+      (println "")))
+
+(defn print-content-csv [list]
+  (doseq [item list]
+    (print-csv-item item)))
+

 (defn hill-climber [max-tries run-constants]
   (loop [parent (rand-individual)
@@ -28,13 +37,14 @@

       (if (>= num-tries max-tries)

-        (do (print-content performance-data)
+        (do (print-content-csv performance-data)
+            (println "")
             parent)

         (if (> child-score parent-score)

           (if (= (mod num-tries 250) 0)
-            (do (print-content performance-data)
+            (do (print-content-csv performance-data)
                 (println "")
                 (recur child (inc num-tries) '() ))
             (recur child (inc num-tries) (conj performance-data (conj parent {:lift parent-score :cl cl}))))


Document the :asset-path key in an asset map

--- src/io/aviso/twixt.clj
+++ src/io/aviso/twixt.clj
@@ -66,6 +66,7 @@
   An asset map has the minimum following keys:

   - `:content` - the content of the asset in a form that is compatible with clojure.java.io
+  - `:asset-path` - the path of the asset under the root folder `/META-INF/assets/`
   - `:resource-path` - the full path of the underlying resource
   - `:content-type` - the MIME type of the content, as determined from the path's extension
   - `:size` - size of the asset in bytes


set content-type header

set content-type header

--- src/jarkeeper/core.clj
+++ src/jarkeeper/core.clj
@@ -85,8 +85,8 @@
   (log/info "serving status image" filepath)
   (-> filepath
     (resp/resource-response)
-    (resp/header "cache-control"
-            "no-cache")))
+    (resp/header "cache-control" "no-cache")
+    (resp/header "content-type" "image/x-png")))

 (defroutes app-routes
   (GET "/" [] (index-view/index))


restore last processed line to restore its trailing delims

--- src/parinfer/format/infer.cljc
+++ src/parinfer/format/infer.cljc
@@ -344,10 +344,11 @@

 (defn fill-rest-with-cache
   "fill the rest of the lines with info from cache."
-  [prev-state state start-i]
+  [prev-state state last-i]
   (let [state (-> state
-                  (update :postline-states into (safe-subvec (:postline-states prev-state) start-i))
-                  (update :lines into (safe-subvec (:lines prev-state) start-i))
+                  (update :lines pop) ;; to restore the version of the line _with_ its trailing delims
+                  (update :lines into (safe-subvec (:lines prev-state) last-i))
+                  (update :postline-states into (safe-subvec (:postline-states prev-state) (inc last-i)))
                   (merge (last (:postline-states prev-state))))
         state (-> state
                   (assoc :line-no (dec (count (:lines state))))
@@ -363,7 +364,7 @@
         more? (< (inc old-i) (count (:lines prev-state)))
         can-skip? (= new-cache cache)]
     (if (and can-skip? more?)
-      (reduced (fill-rest-with-cache prev-state state (inc old-i)))
+      (reduced (fill-rest-with-cache prev-state state old-i))
       state)))

 (defn process-unchanged-lines


Scan for facts more carefully

Scan for facts more carefully

I was starting to catch editor swap files and whatnot, so I added a
check for legit .rb files.

--- src/extracter/files.clj
+++ src/extracter/files.clj
@@ -6,17 +6,25 @@
   [^java.util.regex.Pattern re ^String s]
   (boolean (re-find re s)))

+(defn file?
+  [^java.io.File f]
+  (.isFile f))
+
+(defn ruby-file?
+  [^java.io.File f]
+  (when (file? f)
+    (let [name (.getName f)
+          suffix (last (re-find #"\.(\w+)$" name))]
+      (= suffix "rb"))))
+
 (defn fact?
   "Returns true if the given file appears to contain at least one fact docstring."
   [^java.io.File f]
-  (with-open [fin (io/reader f)]
-    (->> fin
-         line-seq
-         (some (partial contains? #"# Fact: ")))))
-
-(defn file?
-  [^java.io.File f]
-  (.isFile f))
+  (when (ruby-file? f)
+    (with-open [fin (io/reader f)]
+      (->> fin
+           line-seq
+           (some (partial contains? #"# Fact: "))))))

 (defn facts-in-dir
   "Returns a lazy sequence of java.io.File instances for every fact source file in a directory path.
@@ -25,5 +33,4 @@
   (->> path
        io/file
        file-seq
-       (filter file?)
        (filter fact?)))


Fixed error message when repl starts.

Fixed error message when repl starts.

--- access-control-app/src/cmr/access_control/system.clj
+++ access-control-app/src/cmr/access_control/system.clj
@@ -128,7 +128,6 @@
   (let [started-system (start system)]
     (try
       (access-control-index/create-index-or-update-mappings (:search-index started-system))
-      (bootstrap/bootstrap started-system)
       (catch Exception e
         (common-sys/stop started-system component-order)
         (throw e)))


formatting

formatting

--- src/frontend/todos.cljs
+++ src/frontend/todos.cljs
@@ -70,9 +70,9 @@
          :on-toggle-all (dispatch :toggle-all)

          [:on-start-editing id] (dispatch [:start-editing id])
+         [:on-update-todo id val] (dispatch [:update-todo id val])
          [:on-stop-editing id] (dispatch [:stop-editing id])
          [:on-cancel-editing id] (dispatch [:cancel-editing id])
-         [:on-update-todo id val] (dispatch [:update-todo id val])

          [:on-remove id] (dispatch [:remove id])

@@ -94,7 +94,7 @@
              model
              (-> model
                  (assoc :field "")
-                 (update :next-id inc)
+                 (update :next-id inc #_(min (inc %) 3))    ; commented is the code which will make tests fail
                  (update :todos concat [(-init-todo (:next-id model) title)]))))

          [:toggle id]
@@ -108,6 +108,9 @@
          (-> model
              (-update-todos #(assoc % :editing? (= (:id %) id)))
              (-update-todo id #(assoc % :original-title (:title %))))
+
+         [:update-todo id val]
+         (-update-todo model id assoc :title val)

          [:stop-editing id]
          (let [title (-> (-find-todo model id)
@@ -122,9 +125,6 @@
          (-update-todo model id #(assoc % :editing? false
                                           :title (:original-title %)
                                           :original-title ""))
-
-         [:update-todo id val]
-         (-update-todo model id assoc :title val)

          [:remove id]
          (-remove-todo model id)
@@ -282,4 +282,5 @@
        :view       view
        :control    control
        :reconcile  reconcile}
+      ; apply middleware
       (routing/wrap history)))


Don't send stderr to the socket repl.

Don't send stderr to the socket repl.

--- src/leiningen/repl.clj
+++ src/leiningen/repl.clj
@@ -32,16 +32,8 @@
                         (doto (Thread.
                                #(binding [*in* (-> ins# InputStreamReader.
                                                    LineNumberingPushbackReader.)
-                                          *out* (OutputStreamWriter. outs#)
-                                          *err* (PrintWriter. outs# true)]
-                                  (try
-                                    (clojure.main/repl ~@repl-options)
-                                    (catch SocketException e#
-                                      (.printStackTrace e#))
-                                    (finally (doto s#
-                                               .shutdownInput
-                                               .shutdownOutput
-                                               .close)))))
+                                          *out* (OutputStreamWriter. outs#)]
+                                  (clojure.main/repl ~@repl-options)))
                           .start)))]
            (doto (Thread. #(when-not (.isClosed server#)
                              (try


Removed outdated endpoint

Removed outdated endpoint

--- src/freecoin/routes.clj
+++ src/freecoin/routes.clj
@@ -39,7 +39,6 @@
                  ["/sign-in" {:get :sign-in}]
                  ["/sign-in" {:post :sign-in-form}]
                  ["/sign-up" {:post :sign-up-form}]
-                 ["/sso-callback" {:get :sso-callback}]
                  ["/sign-out" {:get :sign-out}]
                  ["/forget-secret" {:get :forget-secret}]
                  ["/email-confirmation" {:get :email-confirmation}]


Bug fix to rename-columns so it can also take an arbitrary function.

Updated doc string for rename-columns.

--- src/grafter/tabular.clj
+++ src/grafter/tabular.clj
@@ -180,7 +180,14 @@
           (vals hash)))

 (defn rename-columns
-  "Renames the columns"
+  "Renames the columns in the dataset.  Takes either a map or a
+  function.  If a map is passed it will rename the specified keys to
+  the corresponding values.
+
+  If a function is supplied it will apply the function to all of the
+  column-names in the supplied dataset.  The return values of this
+  function will then become the new column names in the dataset
+  returned by rename-columns."
   [dataset col-map-or-fn]
   {:pre [(or (map? col-map-or-fn)
              (ifn? col-map-or-fn))]}
@@ -188,21 +195,19 @@
   (if (map? col-map-or-fn)
     (inc/rename-cols col-map-or-fn dataset)
     (let [old-key->new-key (partial map-keys col-map-or-fn)
-          new-data (map (fn [row]
-                          (map-keys col-map-or-fn row))
-                        (inc/to-list dataset))
           new-columns (map col-map-or-fn
                            (column-names dataset))]
+
       (make-dataset new-columns
-                    new-data))))
+                    (inc/to-list dataset)))))

 (defn drop-rows
-  "Drops the first n rows from the CSV."
+  "Drops the first n rows from the dataset."
   [dataset n]
   (map-rows dataset (partial drop n)))

 (defn take-rows
-  "Drops the first n rows from the CSV."
+  "Drops the first n rows from the dataset."
   [dataset n]
   (map-rows dataset (partial take n)))


image upload from clojure done need to reimplement image to array of 0-1

--- src/harnocode/core.cljs
+++ src/harnocode/core.cljs
@@ -1,6 +1,7 @@
 (ns ^:figwheel-always harnocode.core
   (:require [goog.dom :as dom]
             [goog.events :as events]
+            [goog.object :as obj]
             [clojure.string :as string]
             [figwheel.client :as fw]))

@@ -70,27 +71,25 @@
            :load-warninged-code true
            })

-;document.getElementById('pixels').innerHTML = '';
-;                                               var image = new Image();
-;image.src = reader.result;
-;image.onload = function() {
-;                           canvas.width = image.width;
-;                                          canvas.height = image.height;
-;                           context.drawImage(image, 0, 0);
-;                           var pixels = blackAndWhite(context, canvas);
-;                                                     var s = '';
-;                                                              for (var i = 0; i < pixels.length; i++) {
-;                                                                       var row = pixels[i];
-;                                                                       for (var j = 0; j < row.length; j++) {
-;                                                                                var symbol = row[j];
-;                                                                                s += (symbol == 1 ? symbol: "  ");
-;                           }
-;s += '<br/>';
-;
-;document.getElementById('pixels').innerHTML = s;
+(defn get-pixels [context canvas]
+  (let [w (.-width canvas)
+        h (.-height canvas)
+        img-data (.getImageData context 0 0 w h)
+        pixels (.-data img-data)
+        result (atom [])]
+    (obj/forEach pixels
+                 (fn [val]
+                   (swap! result conj val)))
+    @result))

 (defn black-and-white [context canvas]
-  [])
+  (let [pixels (get-pixels context canvas)
+        greyscale (fn[r g b alpha](
+                             (let [grey (+ (* r 0.3) (* g 0.59) (* b 0.11))]
+                               (if (> grey (/ 255 2)) 255 0))))]
+    ;; TODO
+    (reduce greyscale [] pixels)))
+

 (defn on-image-load [event]
   (let [image (.-target event)


cl and lift functions add :cl and :lift values to an individual's hashmap. Change lift function to handle hashmap outputs from cl

--- src/hydrofoil/model.clj
+++ src/hydrofoil/model.clj
@@ -252,9 +252,9 @@
 (defn coefficient-of-lift
   [individual run-constants]
   (let [max-camber (individual :max-camber)]
-    (if (== max-camber 0)
+    (conj individual {:cl (if (== max-camber 0)
       (symetric-coefficient-of-lift individual run-constants)
-      (cambered-coefficient-of-lift individual run-constants))))
+      (cambered-coefficient-of-lift individual run-constants))})))

@@ -263,10 +263,11 @@
   [individual run-constants]
   (let [dencity (run-constants :dencity)
         velocity (run-constants :velocity)
-        angle-of-attack (run-constants :angle-of-attack)]
-    (* (coefficient-of-lift individual run-constants)
+        angle-of-attack (run-constants :angle-of-attack)
+        cl (:cl (coefficient-of-lift individual run-constants))]
+    (conj individual {:lift (* cl
        (/ (* dencity (Math/pow velocity 2)) 2)
-       (area individual))))
+       (area individual))})))
 ;;; **---------------- LIFT EQUATION ----------------**

 ;;(integral-abstracted (hash-map :corrected-max-camber 0 :corrected-position-camber 0 :corrected-thickness 0.45) upper-surface-y-function left-rule 100)


adding a prod build for testing

adding a prod build for testing

--- example/project.clj
+++ example/project.clj
@@ -37,7 +37,14 @@
                          :compiler { :output-to "resources/public/js/compiled/example_admin.js"
                                      :output-dir "resources/public/js/compiled/admin"
                                      :source-map true
-                                     :optimizations :none}}]}
+                                     :optimizations :none
+                                    }}
+                       { :id "example-admin-prod"
+                         :source-paths ["other_src" ]
+                         :compiler { :output-to "resources/public/js/prod/example_admin.js"
+                                     :output-dir "resources/public/js/prod/admin"
+                                     :optimizations :whitespace
+                                    }}]}

   :figwheel {
              :http-server-root "public" ;; default and assumes "resources"


increase max-total-depth from 4 to 10.

increase max-total-depth from 4 to 10.

--- src/babel/english/demo.cljc
+++ src/babel/english/demo.cljc
@@ -11,7 +11,7 @@

 ;; during generation, will not decend deeper than this when creating a tree:
 ;; should also be possible to override per-language.
-(def ^:const max-total-depth 4)
+(def ^:const max-total-depth 10)

 (defn demo [ & [n spec]]
   (let [demo-specs


Cast unit to float in tiled map constructors

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -369,7 +369,7 @@
   (OrthogonalTiledMapRenderer. ^TiledMap (if (string? path)
                                            (tiled-map* path)
                                            path)
-                               ^double unit))
+                               (float unit)))

 (defmacro orthogonal-tiled-map
   "Returns an [OrthogonalTiledMapRenderer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/tiled/renderers/OrthogonalTiledMapRenderer.html)
@@ -389,9 +389,9 @@
 (defn isometric-tiled-map*
   [path unit]
   (IsometricTiledMapRenderer. ^TiledMap (if (string? path)
-                                           (tiled-map* path)
-                                           path)
-                              ^double unit))
+                                          (tiled-map* path)
+                                          path)
+                              (float unit)))

 (defmacro isometric-tiled-map
   "Returns an [IsometricTiledMapRenderer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/tiled/renderers/IsometricTiledMapRenderer.html)
@@ -413,7 +413,7 @@
   (IsometricStaggeredTiledMapRenderer. ^TiledMap (if (string? path)
                                                    (tiled-map* path)
                                                    path)
-                                       ^double unit))
+                                       (float unit)))

 (defmacro isometric-staggered-tiled-map
   "Returns an [IsometricStaggeredTiledMapRenderer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/tiled/renderers/IsometricStaggeredTiledMapRenderer.html)
@@ -437,7 +437,7 @@
   (HexagonalTiledMapRenderer. ^TiledMap (if (string? path)
                                           (tiled-map* path)
                                           path)
-                              ^double unit))
+                              (float unit)))

 (defmacro hexagonal-tiled-map
   "Returns a [HexagonalTiledMapRenderer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/tiled/renderers/HexagonalTiledMapRenderer.html)


Make cmd* and cmd** accept ClientPool for one-off commands

--- src/labs/redis/core.clj
+++ src/labs/redis/core.clj
@@ -95,22 +95,47 @@
    (instance? byte-array-class v) v
    :default (.toString ^Object v)))

-
-(defn cmd*
-  "Low-level fn for sending commands to redis. Returns a LinkedReplyFuture
-  Example (cmd* db \"SET\" [\"mykey\" \"myval\"])"
-  ([^Client R cmd ks1 ks2] (cmd* R cmd (concat ks1 ks2)))
-  ([^Client R cmd ks]
+(defprotocol AsyncCommand
+  (cmd*
+    [client cmd ks] [client cmd ks1 ks2]
+    "Low-level fn for sending commands to redis. Returns a LinkedReplyFuture
+  Example (cmd* db \"SET\" [\"mykey\" \"myval\"])"))
+
+(extend-protocol AsyncCommand
+  labs.redis.Client
+  (cmd*
+    ([R cmd ks1 ks2] (cmd* R cmd (concat ks1 ks2)))
+    ([R cmd ks]
      (let [cv (flatten (map cmd-arg-convert ks))
            args (into-array java.lang.Object (cons cmd cv))]
        (.pipeline R args))))

-(defn cmd**
-  ([^Client R cmd ks1 ks2] (cmd* R cmd (concat ks1 ks2)))
-  ([^Client R cmd ks]
-     (let [cv (flatten (map cmd-arg-convert ks))
-           args (into-array java.lang.Object (cons cmd cv))]
-       (.send R args))))
+  labs.redis.ClientPool
+  (cmd*
+    ([R cmd ks1 ks2] (cmd* R cmd (concat ks1 ks2)))
+    ([R cmd ks]
+       (with-pool client R
+         (cmd* client cmd ks)))))
+
+
+(defprotocol SyncCommand
+  (cmd**
+    [client cmd ks] [client cmd ks1 ks2]
+    "Similar to cmd* but synchronous"))
+
+(extend-protocol SyncCommand
+  labs.redis.Client
+  (cmd**
+    ([R cmd ks1 ks2] (cmd* R cmd (concat ks1 ks2)))
+    ([R cmd ks]
+       (let [cv (flatten (map cmd-arg-convert ks))
+             args (into-array java.lang.Object (cons cmd cv))]
+         (.send R args))))
+
+  labs.redis.ClientPool
+  (cmd**
+    ([R cmd ks1 ks2] (cmd* R cmd (concat ks1 ks2)))
+    ([R cmd ks] (with-pool client R (cmd** client cmd ks)))))

 ;; high level redis commands


convert bot from db format when getting by id

--- src/braid/server/db/bot.clj
+++ src/braid/server/db/bot.clj
@@ -45,4 +45,4 @@

 (defn bot-by-id
   [conn bot-id]
-  (d/pull (d/db conn) bot-pull-pattern [:bot/id bot-id]))
+  (db->bot (d/pull (d/db conn) bot-pull-pattern [:bot/id bot-id])))


Check if elasticsearch is enabled by calling fn

--- src/braid/server/search.clj
+++ src/braid/server/search.clj
@@ -69,7 +69,7 @@
                                tags
                                group-id)))
         text-search (when-not (string/blank? text)
-                      (if elastic/elasticsearch-enabled?
+                      (if (elastic/elasticsearch-enabled?)
                         (elastic/search-for {:text text
                                              :group-id group-id
                                              :user-id user-id})


new ui: giving the pipeline a bit more space

--- src/lambdacd/new_ui.clj
+++ src/lambdacd/new_ui.clj
@@ -97,8 +97,8 @@

 (defn body [history content]
   (let [header [:h1 {:class "segment" } "LambdaCD"]
-        history-column [:div {:class "ui five wide column"} history]
-        content-column [:div {:class "ui eleven wide column"} content]
+        history-column [:div {:class "ui three wide column"} history]
+        content-column [:div {:class "ui thirteen wide column"} content]
         columns [:div {:class "ui segment stackable grid"} history-column content-column]
         body (hc/html (list header columns))]
     (str page-start page-end body page-end)))


Fix wrong query on scheduled_jobs ns.

Fix wrong query on scheduled_jobs ns.

--- src/uxbox/scheduled_jobs/garbage.clj
+++ src/uxbox/scheduled_jobs/garbage.clj
@@ -23,6 +23,6 @@
   (with-open [conn (db/connection)]
     (sc/atomic conn
       (let [sql (str "DELETE FROM projects "
-                     " WHERE deleted=true AND "
+                     " WHERE deleted_at is not null AND "
                      "       (now()-deleted_at)::interval > '10 day'::interval;")]
         (sc/execute conn sql)))))


improve "clean" command: Don't delete lib/ and classes/, just empty them. Also delete -standalone jar and pom-generated.xml

--- src/leiningen/clean.clj
+++ src/leiningen/clean.clj
@@ -3,9 +3,20 @@
   (:use [clojure.contrib.java-utils :only [file delete-file
                                            delete-file-recursively]]))

+(defn empty-directory
+  "Recursively delete all the files in f, but not f itself.
+Raise an exception if any deletion fails unless silently is true."
+  [f & [silently]]
+  (let [f (file f)]
+    (when (.isDirectory f)
+      (doseq [child (.listFiles f)]
+        (delete-file-recursively child silently)))))
+
 (defn clean [project & args]
+  (println "Cleaning up")
   (delete-file (str (:root project) "/" (:name project) ".jar") true)
+  (delete-file (str (:root project) "/" (:name project) "-standalone.jar") true)
+  (delete-file (str (:root project) "/pom-generated.xml") true)
   (doseq [d [(:compile-path project)
              (str (:root project) "/lib")]]
-    (println "Cleaning " d)
-    (delete-file-recursively (file d) true)))
+    (empty-directory (file d) true)))


fix whitespace

fix whitespace

--- src-cljs/frontend/components/stories.cljs
+++ src-cljs/frontend/components/stories.cljs
@@ -90,10 +90,10 @@
                               (do
                                 (om/set-state! owner [:loading?] true)
                                 (go (let [resp (<! (ajax/managed-form-post "/about/contact"
-                                                                                :params {:email email
-                                                                                :message {:FirstName first-name
-                                                                                :Email email
-                                                                                :Company company}}))]
+                                                                            :params {:email email
+                                                                                :message {:FirstName first-name
+                                                                                :Email email
+                                                                                :Company company}}))]
                                       (if-not (= :success (:status resp))
                                         (om/update-state! owner (fn [s]
                                                                   (merge s {:loading? false


Fix typo in docstring

Fix typo in docstring

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -227,7 +227,7 @@
             (make-element argv comp p first-child)))))))

 (defn- expand-tags
-  "Used to supported the extended Hiccup syntax for nested elements. In addition to the keyword
+  "Used to support the extended Hiccup syntax for nested elements. In addition to the keyword
   specifying tag, optional id, and optional class(es), the '>' character indicates a nested element.

   e.g.


Add hatch functions

Add hatch functions

--- src/clj/traveler/schema.clj
+++ src/clj/traveler/schema.clj
@@ -1,4 +1,5 @@
-(ns traveler.schema)
+(ns traveler.schema
+  (:require hatch))

 (def traveler-schema
   "Main traveler datomic schema"
@@ -12,3 +13,7 @@
                    [:policies-assent-date :string]
                    [:istest :boolean]
                    [:can-masquerade :boolean]]}]])
+
+(def partitions (hatch/schematode->partitions traveler-schema))
+
+(def valid-attrs (hatch/schematode->attrs traveler-schema))


Simplify code

Simplify code

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -210,15 +210,12 @@
         others (remove #{player} players)
         outcomes (map (fn [[m _]] [m (play-move game m)]) moves)]
     (first
-      (apply max-key second
-        (map
-          (fn [[m outcome]]
-            (let [score (get-in outcome [:scores player])
-                  losses (map #(worst-immediate-loss outcome % player) others)]
-              [m (- score (apply max losses))]
-              ))
-          outcomes)
-        ))
+      (apply max-key
+        (fn [[m outcome]]
+          (let [score (get-in outcome [:scores player])
+                losses (map #(worst-immediate-loss outcome % player) others)]
+            (- score (apply max losses))))
+        outcomes))
     ))