#258: Doc string formatting

#258: Doc string formatting

--- src/datascript/core.cljc
+++ src/datascript/core.cljc
@@ -138,7 +138,8 @@
                                :tx-meta   tx-meta}) tx-data))))

 (defn db-with
-  "Same as (with db tx-data) but will only return the new database (i.e. :db-after)."
+  "Same as (with db tx-data) but will only return the new database
+  (i.e. :db-after)."
   [db tx-data]
   {:pre [(db/db? db)]}
   (:db-after (with db tx-data)))
@@ -268,7 +269,8 @@
 ;;  (clojure.edn/read-string {:readers datascript/data-readers} "...")
 ;;

-(def ^{:doc "data-readers available for parsing datascript values with clojure.edn/read-string.
+(def ^{:doc "data-readers available for parsing datascript values with
+            clojure.edn/read-string.
             Usage: (clojure.edn/read-string {:readers datascript/data-readers} \"...\")"}
   data-readers {'datascript/Datom db/datom-from-reader
                 'datascript/DB    db/db-from-reader})


Better locations and selected items look

--- src/eion/styles/core.clj
+++ src/eion/styles/core.clj
@@ -83,7 +83,12 @@
       :padding "0 0.75em"
       :min-width "8em"
       :text-align "center"
-    }
+      :transition "0.2s"
+    }
+      [:&:hover {
+        :color theme-blue
+      }]
+
       [:.location-highlight {
         :background-color "transparent"
         :height "2px"
@@ -199,7 +204,9 @@
     }]

     [:&.selected {
-      :background-color theme-white
+      :border-color theme-blue
+      :background-color theme-blue
+      :color theme-full-white
     }]

     [:.directory-item-type {


Running -main now causes jetty to block, fixing a bug where lein would prematurely call shutdown-agents for cleanup.

--- src/foreclojure/core.clj
+++ src/foreclojure/core.clj
@@ -10,6 +10,8 @@
                          [gzip :only [wrap-gzip]]))
   (:require [compojure [route :as route] [handler :as handler]]
             [sandbar.stateful-session :as session]))
+
+(def *block-server* false)

 (defroutes main-routes
   (GET "/" [] (welcome-page))
@@ -39,7 +41,8 @@

 (defn run []
   (prepare-mongo)
-  (run-jetty (var app) {:join? false :port 8080}))
+  (run-jetty (var app) {:join? *block-server* :port 8080}))

 (defn -main [& args]
-  (run))
+  (binding [*block-server* true]
+    (run)))


change order of pop and rest

change order of pop and rest

--- src/neuseg/dpln.clj
+++ src/neuseg/dpln.clj
@@ -19,7 +19,7 @@
   (doto (CDBN$Builder.)
     (.numberOfInputs (first layers))
     (.numberOfOutPuts (last layers))
-    (.hiddenLayerSizes (int-array (pop (rest layers))))
+    (.hiddenLayerSizes (int-array (rest (pop layers))))
     (.useRegularization false)
     (.withRng (MersenneTwister. 123))
     (.withL2 0.1)


added jruby exec back in

added jruby exec back in

--- src/leiningen/jruby.clj
+++ src/leiningen/jruby.clj
@@ -43,5 +43,6 @@
     "rake" (apply rake (cons project (rest keys)))
     "bundle" (apply bundle (cons project (rest keys)))
     "irb" (apply jruby-exec (concat [project "-S"] keys))
+    "exec" (apply jruby-exec (cons project (rest keys)))
     "-S" (apply jruby-exec (cons project keys))
     "-e" (apply jruby-exec (cons project keys))))


fix routes for gh

fix routes for gh

--- src/site/routes.clj
+++ src/site/routes.clj
@@ -1,8 +1,9 @@
 (ns site.routes
   (:require [clojure.string :as str]))

+(println "SITE_URL" (System/getenv "SITE_URL"))
 (defn url [& parts]
-  (let [root (or "/" (System/getenv "SITE_URL"))
+  (let [root (or (System/getenv "SITE_URL") "/")
         last (last parts)
         path (if (map? last) (butlast parts) parts)
         params (if (map? last) last {})


integrating fuzzy call into spelling suggestion ranking

--- src/specly/core.clj
+++ src/specly/core.clj
@@ -44,6 +44,19 @@
        (map (juxt identity #(similar-key ky %)))
        (filter second)))

+
+(defprotocol FuzzySpec
+  (fuzzy-conform-score [_ x]))
+
+(defn spec-from-registry [spec-key]
+  (get (s/registry) spec-key))
+
+(defn fuzzy-spec? [spec-key]
+  (when-let [s (and spec-key (spec-from-registry spec-key))]
+       (satisfies? FuzzySpec s)))
+
+
+
 ;; score a spelling suggestion
 ;;  + 1 the value is a collection and conforms
 ;;  + 1 the value is complex and fuzzy conforms <-- TODO
@@ -55,11 +68,17 @@

 ;; to do this right this should be done with probabilities
 (defn score-suggestion [k->s map-x ky [suggested-key score]]
-  (let [key-val (get map-x ky)
-        valid  (s/valid? (k->s suggested-key) key-val)]
-    [suggested-key (cond-> (/ score 10)
-                     (and valid (coll? key-val)) dec
-                     valid dec)]))
+  (let [key-val  (get map-x ky)
+        key-spec (k->s suggested-key)
+        valid    (s/valid? key-spec key-val)]
+    [suggested-key
+     (cond-> (/ score 10)
+       ;; TODO: I don't think this is neccessary at all
+       (and valid (coll? key-val)) dec
+       valid dec
+       (and (not valid) (map? key-val) (fuzzy-spec? key-spec))
+       (- (or (fuzzy-conform-score (spec-from-registry key-spec) key-val)
+              0)))]))

 (defn spelling-suggestion [{:keys [k->s known-keys]} map-x ky]
   (->> (spelling-suggestions known-keys ky)
@@ -79,7 +98,7 @@

   (score-suggestion
    {:build-config :fig-opt/build-config}
-   {:build-confi {:id "asdf" :source-paths ["as"]}}
+   {:build-confi {:id "asdf" :source-paths 1 #_["as"]}}
    :build-confi [:build-config 1] )

   ;; if there are no suggestions we can look at keys that this complex value conforms to
@@ -129,79 +148,40 @@
 ;; the role of required and unrequired keys)
 ;; -----

-(defprotocol FuzzySpec
-  (fuzzy-conform-score [_ x]))
-
-(defn spec-from-registry [spec-key]
-  (get (s/registry) spec-key))
-
-(defn fuzzy-spec? [spec-key]
-  (when-let [s (spec-from-registry spec-key)]
-       (satisfies? FuzzySpec s)))
-
 #_(merge-with + {} {:asdf 1} {:fda 1} {:fda 1})

-
-(defn avg [args]
-  (float
-   (/ (apply + args)
-      (count args))))
-
-#_(defn fuzzy-conform-score-helper [{:keys [known-keys  k->s] :as spec-key-data} map-x]
-    (when (map? map-x)
-      (let [key-to-score
-            (fn [[k v]]
-              (cond
-              (not (coll? v))
-              (if (s/valid? (k->s k) v)
-                {:good-value 1}
-                {:bad-value 1})
-
-              ;; perhaps don't detract form score if bad value
-              (sequential? v)
-              (if (s/valid? (k->s k) v)
-                {:good-value 1}
-                {:bad-value 1})
-
-              ;; if a sequence of maps? set a binding and recur??? good idea???
-              ;;   could put score result as meta data on conform result
-
-              ;; recur if fuzzy
-              (and (map? v)
-                   (fuzzy-spec? (k->s k)))
-              (fuzzy-conform-score (spec-from-registry (k->s k)) v)
-              :else {}))
-            good-keys (filter known-keys (keys map-x))
-            good-key-val-score
-            (->> (select-keys map-x good-keys)
-                 (map key-to-score)
-               (apply merge-with +))
-            unk-keys          (filter (complement known-keys) (keys map-x))
-            adjusted-keys     (filter second
-                                      (map #(vector
-                                             %
-                                             (spelling-suggestion spec-key-data map-x %))
-                                           unk-keys))
-            bad-key-val-score (->> (map (fn [[oldk newk]] [newk (get map-x oldk)]) adjusted-keys)
-                                   (map key-to-score)
-                                   (apply merge-with +))]
-        (reduce (partial merge-with +)
-                [{:good-keys (+ (count good-keys) (count adjusted-keys))
-                  :bad-keys  (- (count unk-keys)  (count adjusted-keys))}
-                 good-key-val-score
-                 bad-key-val-score]))))
+;; ingnore nil average
+(defn- avg [args]
+  (when-let [args (not-empty (keep identity args))]
+    (/ (apply + args)
+       (count args))))

 ;; TODO clean this up
+;; integrate into :replace-key functionality
+;; and spelling scoring
+;; think about this and the shared functionality
+
+;; this should be memoized on a per call basis if specs are changing globally
 (defn fuzzy-conform-score-helper [{:keys [known-keys  k->s] :as spec-key-data} map-x]
   (when (map? map-x)
     (let [key-to-score
           (fn [[k v]]
-            (if (and (map? v)
-                     (fuzzy-spec? (k->s k)))
-              (or (fuzzy-conform-score (spec-from-registry (k->s k)) v) 1)
+            (cond
+              (map? v)
+              ;; could also check non fuzzy maps pretty easily right here if
+              ;; they are described as (s/keys )
+              (cond
+                (s/valid? (k->s k) v) 1
+                (fuzzy-spec? (k->s k))
+                (fuzzy-conform-score (spec-from-registry (k->s k)) v))
+
+              (and (sequential? v)
+                   (s/valid? (k->s k) v))
+              1
+
               ;; if a sequence of maps? set a binding and recur??? good idea???
               ;;   could put score result as meta data on conform result
-              nil))
+              :else nil))
           good-keys (filter known-keys (keys map-x))
           unk-keys  (filter (complement known-keys) (keys map-x))
           adjusted-keys
@@ -211,30 +191,18 @@
           good-key-val-scores
           (->> (select-keys map-x good-keys)
                (keep key-to-score))
-          bad-key-val-scores (->> (map (fn [[oldk newk]] [newk (get map-x oldk)]) adjusted-keys)
-                                  (keep key-to-score))
-          unk-key-scores (repeat (- (count unk-keys)  (count adjusted-keys)) 0)]
-      (avg (map avg (keep not-empty [(concat (repeat (+ (count good-keys)
-                                                        (count adjusted-keys))
-                                                     1)
-                                             unk-key-scores)
-                                     (concat good-key-val-scores bad-key-val-scores)])))
-      #_(avg (concat (repeat (+ (count good-keys)
-                              (count adjusted-keys))
-                           1)
-                   good-key-val-scores bad-key-val-scores unk-key-scores))
-      #_(avg (concat good-key-val-scores bad-key-val-scores unk-key-scores))
-      #_(reduce (partial merge-with +)
-              [{:good-keys (+ (count good-keys) (count adjusted-keys))
-               :bad-keys  (- (count unk-keys)  (count adjusted-keys))}
-               good-key-val-score
-               bad-key-val-score]))))
-
-(avg [1 1 (avg [1 1 1 0]) 0 0])
-
-(avg [(avg [1 1 0 0]) (avg [1 1 1 0])])
-(avg [])
-(avg [1 1 1 1 1 0 0 0])
+          adjusted-key-val-scores (->> (map (fn [[oldk newk]] [newk (get map-x oldk)]) adjusted-keys)
+                                       (keep key-to-score))
+          good-key-count (+ (count good-keys)
+                            (count adjusted-keys))
+          good-key-score (when-not (zero? (count map-x))
+                           (/ good-key-count
+                              (count map-x)))]
+      #_(prn (into (vec good-key-val-scores) adjusted-key-val-scores))
+      (avg [good-key-score
+            (avg (into (vec good-key-val-scores) adjusted-key-val-scores))]))))
+
+
 (comment

   (fuzzy-conform-score-helper (parse-keys-args
@@ -244,16 +212,19 @@
                                :req-un [:fig-opt/build-config])
                               {;:http-server-root 1
                                :server-por 1
-                               :asdf 1
-                               :badly 3
+                               ;:asdf 1
+                               ;:badly 3
                                :build-confi {:id "asdf"
                                              :source-paths [""]
                                              :assert 1
-                                             :madly 2
+                                             ;:madly 2

                                               }}
                               )
+
   )
+
+

 ;; strict-keys

@@ -359,9 +330,6 @@
                                        :fig-opt/server-ip]
                               :req-un [:fig-opt/builds]))

-(satisfies? FuzzySpec
-           (get (s/registry) :project-top/figwheel))
-
 (comment

   (s/explain-str :project-top/figwheel {:hey 1


fix namespaces

fix namespaces

--- src/yablog/conf.clj
+++ src/yablog/conf.clj
@@ -1,6 +1,6 @@
 (ns yablog.conf
-  (require [clojure.java.io :as io]
-           [clojure.edn :as edn] ))
+  (:require [clojure.java.io :as io]
+            [clojure.edn :as edn] ))

 (defn read-file [conffile]
   (with-open [infile (java.io.PushbackReader. (io/reader conffile))]


case of subject must be nominative

case of subject must be nominative

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -2228,7 +2228,11 @@
                                           :reflexive false
                                           }}}
                           {:synsem {:sem {:obj :unspec}}})
-
+
+                 ;; subject of verbs must have nominative case
+                 (if-then {:synsem {:cat :verb}}
+                          {:synsem {:subcat {:1 {:case :nom}}}})
+
                  ;; Cleanup functions can go here. Number them for ease of reading.
                  ;; 1. this filters out any verbs without an inflection: infinitive verbs should have inflection ':top',
                  ;; rather than not having any inflection.


add (lookup) and (analyze) with optional param 'model'

--- src/babel/italiano/workbook.clj
+++ src/babel/italiano/workbook.clj
@@ -67,8 +67,18 @@
 ;; i.e. if input is 'parle', return
 ;; list of lexemes; for each, [:synsem :agr :person] will be
 ;; 1st, 2nd, or 3rd, and for all, number will be singular.
-(defn lookup [lexeme]
-  ((:lookup medium) lexeme))
+(defn lookup
+  ([string]
+   ((:lookup medium) string))
+  ([string model]
+   ((:lookup model) string)))
+
+;; TODO: deprecate lookup; use analyze instead.
+(defn analyze
+  ([surface-form]
+   (morph/analyze surface-form (:lexicon medium)))
+  ([surface-form model]
+   (morph/analyze surface-form (:lexicon model))))

 (defn over
   ([arg1]


WIP on metadata value import

WIP on metadata value import

--- src/clj/cglossa/data_import.clj
+++ src/clj/cglossa/data_import.clj
@@ -20,9 +20,7 @@
    :loader       {:orientdb
                   {:dbURL   "remote:localhost/Glossa",
                    :dbType  "graph",
-                   :classes [{:name "Corpus", :extends "V"}
-                             {:name "MetadataCategory", :extends "V"}
-                             {:name "HasMetadataCategory", :extends "E"}],
+                   :classes [{:name "Corpus", :extends "V"}],
                    :indexes [{:class "Corpus", :fields ["code:string"], :type "UNIQUE"}]}}})

 (def ^:private metadata-categories-config-template
@@ -47,7 +45,39 @@
                    :classes [{:name "Corpus", :extends "V"}
                              {:name "MetadataCategory", :extends "V"}
                              {:name "HasMetadataCategory", :extends "E"}],
-                   :indexes [{:class "Corpus", :fields ["code:string"], :type "UNIQUE"}]}}})
+                   :indexes [{:class "Corpus", :fields ["code:string"], :type "UNIQUE"}
+                             {:class "MetadataCategory", :fields ["code:string"], :type "UNIQUE"}
+                             {:class "MetadataCategory", :fields ["corpus_cat:string"], :type "UNIQUE"}]}}})
+
+(def ^:private tids-config-template
+  {:config       {:log "debug"},
+   :begin        [{:console
+                   {:commands
+                    ["CONNECT remote:localhost/Glossa admin admin;"
+                     "TRUNCATE CLASS MetadataValue;"
+                     "TRUNCATE CLASS HasMetadataValue;"]}}],
+   :source       {:file {:path :WILL-BE-REPLACED}},
+   :extractor    {:row {}},
+   :transformers [{:csv {:separator "\t"}}
+                  {:vertex {:class "MetadataValue"}}
+                  {:edge
+                   {:class                "HasMetadataValue",
+                    :lookup               "MetadataCategory.corpus_cat",
+                    :joinValue            :WILL-BE-REPLACED
+                    :unresolvedLinkAction "ERROR"}}],
+   :loader       {:orientdb
+                  {:dbURL   "remote:localhost/Glossa",
+                   :dbType  "graph",
+                   :classes [{:name "MetadataCategory", :extends "V"}
+                             {:name "MetadataValue", :extends "V"}
+                             {:name "HasMetadataValue", :extends "E"}],
+                   :indexes [{:class "MetadataCategory", :fields ["corpus_cat:string"], :type "UNIQUE"}]}}})
+
+(defn- read-csv [file]
+  (csv/read-csv file :separator \tab :quote \^))
+
+(defn- write-csv [file data]
+  (csv/write-csv file data :separator \tab))

 (defn- run-etl [config-path]
   (let [etl-path (:oetl environ/env)]
@@ -72,12 +102,12 @@
       ;; the category combined, which will be used to create edges from
       ;; the category to its values when we import the latter.
       (let [[orig-headers & orig-rows] (read-csv orig-tsv-file)
-            headers (vec (cons "corpus_cat" orig-headers))
-            rows    (vec (map #(vec (cons (str corpus "_" (first %)) %)) orig-rows))]
+            headers (cons "corpus_cat" orig-headers)
+            rows    (map #(cons (str corpus "_" (first %)) %) orig-rows)]
         (assert (= ["corpus_cat" "code" "name"] headers)
                 (str "Format error: Expected first line to contain column headers "
                      "and the two columns to be 'code' and 'name'."))
-        (csv/write-csv tsv-file (vec (cons headers rows)) :separator \tab)))))
+        (write-csv tsv-file (cons headers rows))))))

 (defn- modify-metadata-categories-config! [corpus config-path tsv-path]
   (spit config-path (-> metadata-categories-config-template
@@ -86,7 +116,13 @@
                         (cheshire/generate-string {:pretty true}))))

-(defn import-corpora []
+(defn- modify-tid-config! [corpus config-path tsv-path]
+  (spit config-path (-> tids-config-template
+                        (assoc-in [:source :file :path] tsv-path)
+                        (assoc-in [:transformers 2 :edge :joinValue] (str corpus "_tid"))
+                        (cheshire/generate-string {:pretty true}))))
+
+(defn import-corpora! []
   (let [tsv-path    (.getPath (io/resource "data/corpora.tsv"))
         config-path (fs/temp-file "corpus_config")]
     (modify-corpora-config! config-path tsv-path)
@@ -97,10 +133,20 @@
                      "and the two columns to be 'code' and 'name'."))
         (run-etl config-path)))))

-(defn import-metadata-categories [corpus]
+(defn import-metadata-categories! [corpus]
   (let [tsv-path    (.getPath (fs/temp-file "metadata-cats"))
         config-path (.getPath (fs/temp-file "metadata_cat_config"))]
     (modify-metadata-categories-tsv! corpus tsv-path)
     (modify-metadata-categories-config! corpus config-path tsv-path)
     (run-etl config-path)))

+(defn import-metadata-values! [corpus]
+  (let [tid-tsv-path      (.getPath (fs/temp-file "tids"))
+        other-tsv-path    (.getPath (fs/temp-file "metadata_vals"))
+        tid-config-path   (.getPath (fs/temp-file "tid_config"))
+        other-config-path (.getPath (fs/temp-file "metadata_val_config"))]
+    (println tid-config-path)
+    #_(create-tid-tsv! corpus tid-tsv-path)
+    (modify-tid-config! corpus tid-config-path tid-tsv-path)
+    #_(modify-metadata-values-tsv! corpus tsv-path)
+    #_(run-etl config-path)))


doc formatting.

doc formatting.

--- src/clj/forma/source/static.clj
+++ src/clj/forma/source/static.clj
@@ -14,11 +14,12 @@

 (defn index-textfile
   "Prepend a row index to a text file `old-file-name`, located at `base-path`,
-  and save in the same directory with new name `new-file-name`. The `num-drop`
-  parameter specifies the number of lines to drop from the beginning of the
-  text file.  Note that indexing begins with the first textline not dropped,
-  and starts at 0. This function was originally written to clean an ASCII
-  raster file for input into the sampling functions."
+  and save in the same directory with new name `new-file-name`. The
+  `num-drop` parameter specifies the number of lines to drop from the
+  beginning of the text file.  Note that indexing begins with the
+  first textline not dropped, and starts at 0. This function was
+  originally written to clean an ASCII raster file for input into the
+  sampling functions."
   [base-path old-file-name new-file-name num-drop]
   (let [old-file (str base-path old-file-name)
         new-file (str base-path new-file-name)]
@@ -53,11 +54,12 @@
   (map-indexed vector row))

 (defn ascii-source [path]
-  "create a source out of a pre-cleaned ASCII grid, which is associated with a
-  map of characteristic values, such as resolution and extent.  The cleaned
-  grid is located at `path` and has the row index values prepended on the rows,
-  with the ASCII prelude (which is automatically added by Arc) already stripped
-  and cataloged in the map of characteristic values."
+  "create a source out of a pre-cleaned ASCII grid, which is
+  associated with a map of characteristic values, such as resolution
+  and extent.  The cleaned grid is located at `path` and has the row
+  index values prepended on the rows, with the ASCII prelude (which is
+  automatically added by Arc) already stripped and cataloged in the
+  map of characteristic values."
   (let [source (hfs-textline path)]
     (<- [?row ?col ?val]
         (source ?line)
@@ -70,11 +72,11 @@
 ;; grid.

 (defn travel
-  "travel along a grid with cellsize `step` in the direction
-  given by `dir` from an initial position `start` to a position
-  `pos` which is intended to be, for most applications, row or
-  column within the grid.  Note that this takes you to the
-  centroid of the row or column position that you specify."
+  "travel along a grid with cellsize `step` in the direction given by
+  `dir` from an initial position `start` to a position `pos` which is
+  intended to be, for most applications, row or column within the
+  grid.  Note that this takes you to the centroid of the row or column
+  position that you specify."
   [step dir start pos]
   (-> start (dir (* pos step)) (dir (/ step 2))))

@@ -97,11 +99,11 @@
        (apply m/latlon->modis m-res)))

 (defn downsample
-  "This query is for a point grid at higher resolution than the reference
-  grid, which is the MODIS grid in this case. (This is a constraining
-  assumption, since MODIS is hard-coded into this function.  The aggregator
-  function should be called as follows: c/sum, c/max, where c is the prefix
-  refering to cascalog.ops."
+  "This query is for a point grid at higher resolution than the
+  reference grid, which is the MODIS grid in this case. (This is a
+  constraining assumption, since MODIS is hard-coded into this
+  function.  The aggregator function should be called as follows:
+  c/sum, c/max, where c is the prefix refering to cascalog.ops."
   [dataset m-res ascii-info grid-source agg]
   (<- [?dataset ?m-res ?t-res ?mod-h ?mod-v ?sample ?line ?outval]
       (grid-source ?row ?col ?val)
@@ -124,14 +126,16 @@
 ;; direction, between modis and wgs84. Replace with a calculation.

 (defn sample-modis
-  "This function is based on the reference MODIS grid (currently at 1000m res).  The
-  objective of the function is to tag each MODIS pixel with a value from an input
-  ASCII grid.  The process diverges based on whether the ASCII grid is at coarser or
-  finer resolution than the MODIS grid.  If higher, then each ASCII point is assigned
-  a unique MODIS identifier, and the duplicate values are aggregated based on an input
-  aggregator (sum, max, etc.).  If lower, each MODIS pixel is tagged with the ASCII
-  grid cell that it falls within.  Note that the ASCII grid must be in WGS84, with row
-  indices prepended and the ASCII header lopped off."
+  "This function is based on the reference MODIS grid (currently at
+  1000m res).  The objective of the function is to tag each MODIS
+  pixel with a value from an input ASCII grid.  The process diverges
+  based on whether the ASCII grid is at coarser or finer resolution
+  than the MODIS grid.  If higher, then each ASCII point is assigned a
+  unique MODIS identifier, and the duplicate values are aggregated
+  based on an input aggregator (sum, max, etc.).  If lower, each MODIS
+  pixel is tagged with the ASCII grid cell that it falls within.  Note
+  that the ASCII grid must be in WGS84, with row indices prepended and
+  the ASCII header lopped off."
   ([m-res dataset pixel-tap ascii-path & [agg]]
      (let [ascii-info ((keyword dataset) static-datasets)
            grid-source (ascii-source ascii-path)]


remove pprint

remove pprint

--- src/clj/traveler/api/routes.clj
+++ src/clj/traveler/api/routes.clj
@@ -1,6 +1,5 @@
 (ns traveler.api.routes
   (:require [cheshire.core :refer [generate-string]]
-            [clojure.pprint :refer [pprint]]
             [liberator.core :refer [resource]]
             [traveler.api.api :refer [handle-created]]
             [traveler.api.users :refer [add-user]]))


Add qtip for social sharing buttons

Add qtip for social sharing buttons

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

--- src/cljs/cljs_nusmods/main.cljs
+++ src/cljs/cljs_nusmods/main.cljs
@@ -3,7 +3,8 @@
   (:use [jayq.core :only [$ $deferred $when ajax attr document-ready done
                           fade-out hide is one parent prevent resolve show
                           unbind]])
-  (:require [cljs-nusmods.module-array-repr     :as module-array-repr]
+  (:require clojure.string
+            [cljs-nusmods.module-array-repr     :as module-array-repr]
             [cljs-nusmods.aux-module-array-repr :as aux-module-array-repr]
             [cljs-nusmods.lesson-array-repr     :as lesson-array-repr]
             [cljs-nusmods.select2               :as select2]
@@ -451,6 +452,18 @@
             (make-request-to-get-short-url currentUrl $urlShortenerInput
                                            localStorage localStorageKey)))))

+(defn- qtip-for-sharing-button
+  "Add qtip for social sharing buttons"
+  [$button content]
+  (.qtip $button (js-obj "content"  content
+                         "position" (js-obj "my" "bottom center"
+                                            "at" "top center")
+                         "style"    (js-obj "classes"
+                                            (clojure.string/join
+                                              " "
+                                              ["qtip-bootstrap" "qtip-rounded"
+                                               "qtip-shadow"])))))
+
 (defn- short-url-setup
   "Setup url shortening"
   []
@@ -492,7 +505,9 @@
     (.click $urlShortenerInput get-url-evt-handler)
     (.mouseenter $copy-to-clipboard get-url-evt-handler)
     ; Change text of qtip when user clicks the copy-to-clipboard <button>
-    (.on zcbClient "copy" (fn [] (.set qtipApi "content.text" "Copied!")))))
+    (.on zcbClient "copy" (fn [] (.set qtipApi "content.text" "Copied!")))
+    (qtip-for-sharing-button ($ :#share-by-email) "Share via Email")
+    (qtip-for-sharing-button ($ :#share-on-twitter) "Share via Twitter")))

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


Minor comments

Minor comments

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -88,7 +88,9 @@
       (map
         (fn [idx t]
           ^{:key t} [render-task #(on-remove idx) #(on-check idx) t])
-        (range) (:tasks @card-ref))]
+        (range)
+        (:tasks @card-ref)
+      )]
      ]))

 (defn render-add-task
@@ -147,7 +149,7 @@
 (defn render-app
   []
   ; TODO - Do not make such a big tree of functions
-  ; - The DOM needs to be that deep
+  ; - The DOM needs to be that deep, but not functions
   ; - But you can create the card at the top
   ; - And then you can assemble them (group-by or filter)
   (let [filter (r/cursor app-state [:filter])


Start switching to a map model

Start switching to a map model

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -32,36 +32,35 @@
   [title cards]
   (if (empty? title)
     cards
-    (filter #(utils/str-contains (:title %) title) cards)))
+    (filter #(utils/str-contains (-> % second :title) title) cards)))

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

-; TODO - Separate concerns:
-; - cards values and their id, and the order in which they appear
-; - tasks values and their id
-; - if you want to expand all cards, you need the state to be public
+; TODO - Separate concerns!
+; Model at the end:
+; - A map id to card
+; - Collections for each status: each holding the list of IDs they have
+; - Use a reaction to provide for the filtered list of cards (filtered by text)

-(def card-list (r/atom []))
+(def card-list
+  (r/atom {}))

 (defn add-task-to!
   "Add a new task in the card"
   [card-id task]
-  (defn add-if! [card]
-    (if (= card-id (:card-id card))
-      (update-in card [:tasks] conj (api/create-task! task false))
-      card))
-  (swap! card-list #(mapv add-if! %)))
+  (swap! card-list
+    #(update-in % [card-id :tasks] conj (api/create-task! task false))
+  ))

 (defn remove-task-from!
   "Remove a task from a card"
   [card-id task-id]
-  (defn remove-if! [card]
-    (if (= card-id (:card-id card))
-      (update-in card [:tasks]
-        (fn [tasks]
-          (filterv #(not= (:task-id %) task-id) tasks)))
-      card))
-  (swap! card-list #(mapv remove-if! %)))
+  (defn rem-task [cards]
+    (update-in cards [card-id :tasks]
+       (fn [tasks]
+         (filterv #(not= (:task-id %) task-id) tasks))
+    ))
+  (swap! card-list rem-task))

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

@@ -124,7 +123,7 @@
   [status cards]
   [:div.list
    [:h1 (status->str status)]
-   (for [c (filter-by-status status cards)]
+   (for [c (filter-by-status status (map second cards))]
      ^{:key (:card-id c)} [render-card c])
   ])

@@ -152,7 +151,9 @@

 (def fetch-and-render-app
   "Render the app - adding a fetching of data when the DOM is mounted"
-  (let [append-all (fn [cards] (swap! card-list #(into % cards)))]
+  (let [add-card #(assoc %1 (:card-id %2) %2)
+        add-cards #(reduce add-card %1 %2)
+        append-all (fn [cards] (swap! card-list #(add-cards % cards)))]
     (with-meta render-app
      {:component-did-mount #(fake/fake-fetch! append-all) })
   ))


Use map-indexed

Use map-indexed

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -86,10 +86,10 @@
   [tasks on-remove on-check]
   [:div.checklist
    [:ul
-    (map
+    (map-indexed
       (fn [idx t]
         ^{:key t} [render-task t #(on-remove idx) #(on-check idx)])
-      (range) tasks
+      tasks
     )]
   ])

@@ -108,6 +108,7 @@
    }])

 (defn render-card
+  "[NOT Pure] Render a card"
   [card-ref]
   (let [show-details (::show-details @card-ref)
         toggle-details #(swap! card-ref update-in [::show-details] not)


adds support for tx/cb

adds support for tx/cb

--- src/cljs/dato/lib/web_peer.cljs
+++ src/cljs/dato/lib/web_peer.cljs
@@ -70,6 +70,11 @@
                           ;; TODO: handle metadata on tx
                           (let [actual-report (db-utils/handle-transaction db-conn server-reply)]
                             (handle-report-diff db-conn (:txes item) (:optimistic-report item) actual-report)
+                            (when-let [cb (get-in item [:tx-meta :tx/cb])]
+                              (try
+                                (cb actual-report)
+                                (catch js/Error e
+                                  (utils/merror "Error in tx callback" e))))
                             ;; TODO: proper error handling
                             (assert (= item (queue/pop! q)) "send-queue lock must be broken, we lost some data!")))
                         (catch js/Error e


Enable anti aliasing for GUI repl

Enable anti aliasing for GUI repl

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

--- src/conexp/contrib/gui/repl.clj
+++ src/conexp/contrib/gui/repl.clj
@@ -12,7 +12,7 @@
                     PrintWriter CharArrayWriter PrintStream]
            [javax.swing KeyStroke AbstractAction JTextArea JScrollPane JFrame
                         JComponent]
-           [java.awt Font Color])
+           [java.awt Font Color Graphics Graphics2D RenderingHints])
   (:use [conexp.base :only (defvar-)]
         conexp.contrib.gui.util)
   (:require [conexp.contrib.gui.repl-utils :as repl-utils])
@@ -196,7 +196,14 @@
 (defn- ^JTextArea into-text-area
   "Puts repl-container (a PlainDocument) into a JTextArea adding some hotkeys."
   [repl-container repl-thread]
-  (let [^JTextArea repl-window (JTextArea. ^javax.swing.text.Document repl-container)]
+  (let [^JTextArea
+        repl-window (proxy [JTextArea] [^javax.swing.text.Document repl-container]
+                      (paintComponent [^Graphics g]
+                        (let [^Graphics2D g g]
+                          (.setRenderingHint g
+                                             RenderingHints/KEY_ANTIALIASING
+                                             RenderingHints/VALUE_ANTIALIAS_ON)
+                          (proxy-super paintComponent g))))]
     (doto repl-window
       (add-input-event "control C" "interrupt")
       (add-action-event "interrupt" #(repl-interrupt repl-thread))
@@ -214,7 +221,7 @@
   (let [[repl-container, ^Thread repl-thread, ^Thread output-thread] (make-clojure-repl frame),
         rpl (into-text-area repl-container repl-thread)]
     (doto rpl
-      (.setFont (Font. "Monospaced" Font/PLAIN 16))
+      (.setFont (Font. "Monospaced" Font/BOLD 16))
       (.setCaretColor Color/BLACK))
     (.start output-thread)
     (JScrollPane. rpl)))


New plugin config

New plugin config

--- modules/project.clj
+++ modules/project.clj
@@ -2,7 +2,7 @@
   :description "Parent for all modules"
   ;; :parent [org.immutant/immutant-parent "1.0.3-SNAPSHOT"
   ;; :relative-path "../pom.xml"]
-  :profiles {:inherited {:dependencies [[org.clojure/clojure "1.5.1"]
+  :modules  {:inherited {:dependencies [[org.clojure/clojure "1.5.1"]
                                         [org.jboss.as/jboss-as-server "7.2.x.slim.incremental.12"]
                                         [midje "1.6.0" :scope "test"]
                                         [org.immutant/immutant-clojure-test-support "1.0.3-SNAPSHOT" :scope "test"]


added missing subroutine labels

added missing subroutine labels

--- src/node/game/cards.cljs
+++ src/node/game/cards.cljs
@@ -274,6 +274,9 @@

    "PAD Campaign"
    {:events {:corp-turn-begins {:msg "gain 1 [Credits]" :effect (effect (gain :credit 1))}}}
+
+   "Pup"
+   {:abilities [{:msg "do 1 net damage" :label "Do 1 net damage" :effect (effect (damage :net 1))}]}

    "Order of Sol"
    {:effect #(add-watch % :order-of-sol
@@ -416,16 +419,17 @@

    ;; ICE
    "Bastion"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Chimera"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Curtain Wall"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Data Mine"
-   {:abilities [{:msg "do 1 net damage" :effect (effect (trash card) (damage :net 1))}]}
+   {:abilities [{:msg "do 1 net damage" :label "Do 1 net damage"
+                 :effect (effect (trash card) (damage :net 1))}]}

    "Datapike"
    {:abilities [{:label "The runner must pay 2 [Credits] if able"
@@ -434,7 +438,7 @@
                 {:label "End the run" :msg "end the run" :effect (effect (end-run))}]}

    "Eli 1.0"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Enigma"
    {:abilities [{:label "The runner lose 1 [Click] if able"
@@ -449,23 +453,23 @@
                 {:label "End the run" :msg "end the run" :effect (effect (end-run))}]}

    "Galahad"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Grim"
    {:effect (effect (gain :bad-publicity 1) (system-msg "takes 1 bad publicity"))}

    "Guard"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Hadrians Wall"
    {:advanceable :always
     :abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Himitsu-Bako"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Hive"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Heimdall 1.0"
    {:abilities [{:label "Do 1 brain damage" :msg "do 1 brain damage"
@@ -476,7 +480,7 @@
    {:abilities [{:label "Do 1 brain damage" :msg "do 1 brain damage"
                  :effect (effect (damage :brain 1))}
                 {:label "Do 1 brain damage and end the run" :msg "do 1 brain damage and end the run"
-                 :effect (effect (damage :brain 1))}
+                 :effect (effect (damage :brain 1) (end-run))}
                 {:label "End the run" :msg "end the run" :effect (effect (end-run))}]}

    "Hourglass"
@@ -489,37 +493,39 @@
     :abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "IQ"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Janus 1.0"
-   {:abilities [{:msg "do 1 brain damage" :effect (effect (damage :brain 1))}]}
+   {:abilities [{:msg "do 1 brain damage" :label "Do 1 brain damage"
+                 :effect (effect (damage :brain 1))}]}

    "Komainu"
-   {:abilities [{:msg "do 1 net damage" :effect (effect (damage :net 1))}]}
+   {:abilities [{:msg "do 1 net damage" :label "Do 1 net damage"
+                 :effect (effect (damage :net 1))}]}

    "Lotus Field"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Mother Goddess"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Neural Katana"
-   {:abilities [{:msg "do 3 net damage" :effect (effect (damage :net 3))}]}
+   {:abilities [{:msg "do 3 net damage" :label "Do 3 net damage" :effect (effect (damage :net 3))}]}

    "NEXT Bronze"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "NEXT Silver"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Paper Wall"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Quandary"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Rainbow"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Rototurret"
    {:abilities [{:label "Trash 1 program" :msg "trash 1 program"}
@@ -543,17 +549,17 @@
                  :msg "trash 1 program unless the Runner pays 3 [Credits]"}]}

    "Swordsman"
-   {:abilities [{:msg "do 1 net damage" :effect (effect (damage :net 1))}]}
+   {:abilities [{:msg "do 1 net damage" :label "Do 1 net damage" :effect (effect (damage :net 1))}]}

    "Tyrant"
    {:advanceable :while-rezzed
     :abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "TMI"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Tollbooth"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Viktor 1.0"
    {:abilities [{:label "Do 1 brain damage" :msg "do 1 brain damage"
@@ -561,7 +567,7 @@
                 {:label "End the run" :msg "end the run" :effect (effect (end-run))}]}

    "Wall of Static"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Wall of Thorns"
    {:abilities [{:label "Do 2 net damage" :msg "do 2 net damage" :effect (effect (damage :net 2))}
@@ -577,13 +583,13 @@
     :abilities [{:msg "do 1 net damage" :label "Do 1 net damage" :effect (effect (damage :net 1))}]}

    "Wotan"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Wraparound"
-   {:abilities [{:msg "end the run" :effect (effect (end-run))}]}
+   {:abilities [{:msg "end the run" :label "End the run" :effect (effect (end-run))}]}

    "Yagura"
-   {:abilities [{:msg "do 1 net damage" :effect (effect (damage :net 1))}]}
+   {:abilities [{:msg "do 1 net damage" :label "Do 1 net damage" :effect (effect (damage :net 1))}]}

    ;; partial implementation
    "AstroScript Pilot Program"


Tweak to quickie fix.

Tweak to quickie fix.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -447,7 +447,7 @@
       (when note? (paragraph note "note-paragraph"))
       (when note? (spacer 24 "note-paragraph bottom-note-paragraph" "note-paragraph"))
       (when note? (spacer 16))
-      [:p "Click here to join your team:"]
+      (paragraph "Click here to join your team:")
       [:a
         {:class "token-link"
          :href (:token-link invite)}


Further improve trigger handler docstrings.

--- src/overtone/sc/trig.clj
+++ src/overtone/sc/trig.clj
@@ -28,7 +28,9 @@
   "Registers a standard on-event handler with key which will call
    handler when matching triggers are recieved. Triggers are created
    with the send-trig ugen. Handler should be a fn which takes one
-   argument - the latest trigger value.
+   argument - the latest trigger value. Triggers registered with the
+   same key as another trigger or standard handler will remove and
+   replace the old handler.

    Consider using trig-id to create a unique trigger id

@@ -47,7 +49,10 @@

     ;; create a new instance of synth foo with trigger id as a
     ;; param
-    (foo uid)"
+    (foo uid)
+
+    ;;Trigger handler can be removed with:
+    (remove-event-handler ::debug)"
   ([trig-id handler key]
      (add-handler on-event [:overtone :trigger trig-id] handler key))
   ([node trig-id handler key]
@@ -57,10 +62,14 @@
   "Registers a standard on-latest-event handler with key which will call
    handler when matching triggers are recieved. Triggers are created
    with the send-trig ugen. Handler should be a fn which takes one
-   argument - the latest trigger value.
+   argument - the latest trigger value. Triggers registered with the
+   same key as another trigger or standard handler will remove and
+   replace the old handler.

    Consider using trig-id to create a unique trigger id. See on-trigger
-   docstring for usage example."
+   docstring for usage example.
+
+   Trigger handler can be removed with remove-event-handler."
   ([trig-id handler key]
      (add-handler on-latest-event [:overtone :trigger trig-id] handler key))
   ([node trig-id handler key]
@@ -70,10 +79,14 @@
   "Registers a standard on-sync-event handler with key which will call
    handler when matching triggers are recieved. Triggers are created
    with the send-trig ugen. Handler should be a fn which takes one
-   argument - the latest trigger value.
+   argument - the latest trigger value. Triggers registered with the
+   same key as another trigger or standard handler will remove and
+   replace the old handler.

    Consider using trig-id to create a unique trigger id. See on-trigger
-   docstring for usage example."
+   docstring for usage example.
+
+   Trigger handler can be removed with remove-event-handler."
   ([trig-id handler key]
      (add-handler on-sync-event [:overtone :trigger trig-id] handler key))
   ([node trig-id handler key]


add support for marking a ugen as having an internal name. This is to allow cgens with the same name to subsume the role of a specific ugen whilst allowing it to reference the original via the prefixed name.

--- src/overtone/sc/ugen.clj
+++ src/overtone/sc/ugen.clj
@@ -136,16 +136,16 @@
   * (env-gen:kr ...)

   UGens will also have a base-name without a rate suffix that uses the default
-  rate of :auto, which will use the rate of the fastest argument ugen, or else
-  the default rate according to the ugen rate precedence order:
-
-  [:ir :dr :ar :kr]
-
-  or a :default-rate attribute can override the default precedence order."
+  rate. If the ugen spec contains the key :internal-name with a true value,
+  the base-name will contain the prefix internal: This is to allow cgens with
+  the same name to subsume the role of a specific ugen whilst allowing it to
+  reference the original via the prefixed name."
   [spec]
   (let [rates (:rates spec)
         rate-vec (vec rates)
         base-name (overtone-ugen-name (:name spec))
+        internal-name? (:internal-name spec)
+        base-name (if internal-name? (str "internal:" base-name) base-name)
         base-rate (:default-rate spec)
         name-rates (zipmap (map #(str base-name %) rate-vec)
                            rate-vec)]


allow to set 0 replicas in FE

allow to set 0 replicas in FE

--- src/cljs/swarmpit/component/service/form_settings.cljs
+++ src/cljs/swarmpit/component/service/form_settings.cljs
@@ -124,7 +124,7 @@
        :key      "replicas"
        :required true
        :type     "number"
-       :min      1
+       :min      0
        :value    value
        :onChange (fn [_ v]
                    (state/update-value [:replicas] (js/parseInt v) cursor))})))


Remove old graph code and update filenames

--- src/clojure/com/flashlightdb/ceilingbounce/runtime.clj
+++ src/clojure/com/flashlightdb/ceilingbounce/runtime.clj
@@ -25,9 +25,7 @@
               Activity
               Notification]
              java.io.File
-             neko.App
-             android.graphics.Bitmap
-             android.graphics.Canvas))
+             neko.App))

 (def battery-dead-notification
   {:ticker-text "Battery dead"
@@ -63,10 +61,8 @@
 (declare runtime-test)

 (def runtime-layout
-  [:linear-layout {:orientation :vertical
-                   :layout-width :fill
-                   :layout-height :wrap
-                   :def `layout-handle}
+  [:linear-layout (merge common/linear-layout-opts
+                         {:def `runtime-layout-handle})
    [:edit-text {:id ::filename
                 :hint "Name output file"
                 :layout-width :fill}]
@@ -95,32 +91,6 @@
               :on-click #'reset-peak}]]
    ])

-(defn chart-runtime [runtime-data]
-  (comment let [minutes (map #(/ (first %) 600.0) runtime-data) ; FIXME with new lib
-        raw-outputs (map second runtime-data)
-        max-output (max (apply max raw-outputs) 1) ; let's not div0
-        max-minute (apply max minutes)
-        outputs (map #(* 100.0 (/ % max-output)) raw-outputs)
-        chart-data (partition 2 (interleave minutes outputs))
-        chart (charts/xy-plot :width 1400 :height 1050
-                        :xmin 0
-                        :ymin 0
-                        :xmax (Math/ceil (* max-minute 1.1))
-                        :ymax (Math/ceil (* max-output 1.1)))]
-
-    (charts/add-points chart
-                       chart-data
-                       :size 2)))
-
-
-(defn write-png [path chart]
-  (with-open [out-file (io/output-stream path)]
-    (.compress (.getChartBitmap chart)
-               android.graphics.Bitmap$CompressFormat/PNG)
-    90
-    out-file))
-
-
 (defn runtime-test [_evt]
   (.mkdirs (File. common/storage-dir))
   (let [start-time (. System nanoTime)
@@ -131,8 +101,7 @@
                   "test"
                   dirname) ; TODO - this, more elegantly
         path (str common/storage-dir dirname "/")
-        csv-path (str path start-time ".csv")
-        png-path (str path start-time ".png")
+        csv-path (str path dirname start-time ".csv")
         output (atom [])
         writer-chan (chan 30)
         battery-dead (atom false)
@@ -191,9 +160,6 @@

     (defn stop-runtime-test [_evt]
       (.unregisterListener sm sensor-listener)
-      (future
-        (comment let [chart nil] ; FIXME
-          (write-png png-path chart)))
       (ui/config (find-view activity
                             (common/main-tag "runtime-test"))
               :text "Start runtime test"


un-nest system.components requires

un-nest system.components requires

--- src/leiningen/new/chestnut/src/clj/chestnut/server.clj
+++ src/leiningen/new/chestnut/src/clj/chestnut/server.clj
@@ -8,10 +8,9 @@
             [environ.core :refer [env]]
             [com.stuartsierra.component :as component]
             [reloaded.repl]
-            (system.components
-             [endpoint :refer [new-endpoint]]
-             [handler :refer [new-handler]]
-             [middleware :refer [new-middleware]]){{{server-clj-requires}}})
+            [system.components.endpoint :refer [new-endpoint]]
+            [system.components.handler :refer [new-handler]]
+            [system.components.middleware :refer [new-middleware]]{{{server-clj-requires}}})
   (:gen-class))

 (defroutes routes


fixed logging; updated variable earmuffs to reflect clojure 1.3 requirements

--- src/engine/server/socket_io.clj
+++ src/engine/server/socket_io.clj
@@ -4,7 +4,9 @@
         lamina.core
         net.cgrand.moustache
         [clojure.pprint :only [cl-format]]
-        [clojure.tools.logging :as log])
+        clj-logging-config.log4j)
+  (:require [clojure.tools.logging :as log]
+            [clojure.java.io :as io])
   (:import [java.lang Long]
            [java.util Timer TimerTask]
            [clojure.lang Keyword PersistentArrayMap]
@@ -18,8 +20,9 @@

 (defrecord WebsocketChannel [channel endpoint sequencer])

-(def *close-timeout* 25)
-(def *heartbeat-interval* 20)
+(def close-timeout 25)
+(def heartbeat-interval 20)
+(def socket-out (io/file "socket.log"))

 (def reserved-event-types #{"connect" "disconnect" "message" "ack"})

@@ -131,27 +134,27 @@
   (websocket-send socket :noop))

-(def *heartbeat-channel* (permanent-channel))
-(receive-all *heartbeat-channel* (fn [_])) ; all heartbeat messages are volatile
+(def heartbeat-channel (permanent-channel))
+(receive-all heartbeat-channel (fn [_])) ; all heartbeat messages are volatile

 (defn heartbeat []
   (log/debug "Bubump")
-  (enqueue *heartbeat-channel* (websocket-message :heartbeat)))
-
-(when (and (.hasRoot (def *heartbeat*))
-           (= Timer (class *heartbeat*)))
-  (.cancel *heartbeat*)) ; sometimes, defonce just doesn't work as-is..
-(def *heartbeat* (new Timer "Engine heartbeat" true))
+  (enqueue heartbeat-channel (websocket-message :heartbeat)))
+
+(when (and (.hasRoot (def heartbeat))
+           (= Timer (class heartbeat)))
+  (.cancel heartbeat)) ; sometimes, defonce just doesn't work as-is..
+(def heartbeat (new Timer "Engine heartbeat" true))

 (let [timer-task (proxy [TimerTask] [] ; in such moments, I love clojure for making java bearable
                    (run [] (heartbeat)))]
-  (doto *heartbeat* (.scheduleAtFixedRate timer-task (long 0) (long (* 1000 20)))))
+  (doto heartbeat (.scheduleAtFixedRate timer-task (long 0) (long (* 1000 20)))))

 (defn handshake [request]
   (if-let [sid (and (:session request)
                     (-> request :cookies (get "engine") :value))]
     {:status 200 :content-type "text/plain"
-     :body (cl-format nil "~a:~d:~d:~{~a~^,~}" sid *heartbeat-interval* *close-timeout* ["websocket"])}
+     :body (cl-format nil "~a:~d:~d:~{~a~^,~}" sid heartbeat-interval close-timeout ["websocket"])}
     {:status 401}))

 (defn deathwatch [channel timeout]
@@ -170,38 +173,42 @@

 (defn message-handler [socket dispatcher]
   (fn [message]
-    (when-let [[type id data-ack endpoint data] (translate-message message)]
-      (case type
-        :disconnect (close (:channel socket))
-        :connect (send-error socket "Additional endpoints not supported" "Just don't try again, bitch!")
-        :heartbeat (log/debug "Client sent heartbeat")
-        :message (do
-                   (log/debug (str "Client sent message " data))
-                   (handle-ack socket id (dispatcher "message" data) data-ack))
-        :json-message (do
-                        (log/debug (str "Client sent JSON message " data))
-                        (handle-ack socket id (apply dispatcher "message" (decode-json data)) data-ack))
-        :event (do
-                 (log/debug (str "Client sent event message " data))
-                 (let [{:keys [name args]} (decode-json data)]
-                   (if (reserved-event-types name)
-                     (send-error socket (format "Event name %s is reserved" name))
-                     (handle-ack socket id (apply dispatcher name args) data-ack))))
-        :ack  (let [[id data] (translate-ack data)]
-                (log/debug (format "Client acknowledged %d\nData: %s" id data))
-                (apply dispatcher "ack" id (decode-json data)))
-        :error (let [[reason advice] (translate-error data)]
-                 (log/error (format "Client signalled an error %s\nAdvice: %s" reason advice)))
-        :noop (log/debug "Client sent noop (whatever)")
-        (log/error (format "Ignoring unknown type %s for message %s" type message))))))
+    (with-logging-config [:root {:level :debug :out socket-out}]
+      (try
+        (when-let [[type id data-ack endpoint data] (translate-message message)]
+          (case type
+            :disconnect (close (:channel socket))
+            :connect (send-error socket "Additional endpoints not supported" "Just don't try again, bitch!")
+            :heartbeat (log/debug "Client sent heartbeat")
+            :message (do
+                       (log/debug (str "Client sent message " data))
+                       (handle-ack socket id (dispatcher "message" data) data-ack))
+            :json-message (do
+                            (log/debug (str "Client sent JSON message " data))
+                            (handle-ack socket id (apply dispatcher "message" (decode-json data)) data-ack))
+            :event (do
+                     (log/debug (str "Client sent event message " data))
+                     (let [{:keys [name args]} (decode-json data)]
+                       (if (reserved-event-types name)
+                         (send-error socket (format "Event name %s is reserved" name))
+                         (handle-ack socket id (apply dispatcher name args) data-ack))))
+            :ack  (let [[id data] (translate-ack data)]
+                    (log/debug (format "Client acknowledged %d\nData: %s" id data))
+                    (apply dispatcher "ack" id (decode-json data)))
+            :error (let [[reason advice] (translate-error data)]
+                     (log/error (format "Client signalled an error %s\nAdvice: %s" reason advice)))
+            :noop (log/debug "Client sent noop (whatever)")
+            (log/error (format "Ignoring unknown type %s for message %s" type message))))
+        (catch Exception e
+          (log/error "Fatal error handling socket.io request:" e))))))

 (defn socket [dispatcher]
   (fn [channel request]
     (let [socket (WebsocketChannel. channel "" (websocket-sequencer))
           handler (partial dispatcher socket)]
       (send-connect socket) ; this is obligatory!
-      (siphon *heartbeat-channel* channel)
-      (deathwatch channel *close-timeout*)
+      (siphon heartbeat-channel channel)
+      (deathwatch channel close-timeout)
       (receive-all (fork channel) (message-handler socket handler))
       (on-closed channel #(handler "disconnect"))
       (handler "connect"))))


get-signature implemented

get-signature implemented

--- src/NoteHub/api.clj
+++ src/NoteHub/api.clj
@@ -1,10 +1,24 @@
-(ns NoteHub.api)
+(ns NoteHub.api
+  (:require [NoteHub.storage :as persistance]))

 (def api-version "1.0")

-(defn get-signature [& args])
+(defn- create-response
+  ([success] { :success success })
+  ([success message]
+   (assoc (create-response success) :message message)))
+
+(let [md5Instance (java.security.MessageDigest/getInstance "MD5")]
+  (defn get-signature
+    "Returns the MD5 hash for the concatenation of all passed parameters"
+    [& args]
+    (let [input (apply str args)]
+      (do (.reset md5Instance)
+          (.update md5Instance (.getBytes input))
+          (.toString (new java.math.BigInteger 1 (.digest md5Instance)) 16)))))
+
+(defn get-note [noteID])
 (defn post-note [& args])
-(defn get-note [& args])
 (defn update-note [& args])
 (defn register-publisher [& args])
 (defn revoke-publisher [& args])


Formatting.

Formatting.

--- src/leiningen/ancient/check.clj
+++ src/leiningen/ancient/check.clj
@@ -1,7 +1,9 @@
 (ns ^{ :doc "Check for outdated dependencies."
        :author "Yannick Scherer" }
   leiningen.ancient.check
-  (:require [leiningen.ancient.utils.projects :refer [collect-artifacts artifact-path collect-repositories]]
+  (:require [leiningen.ancient.utils.projects :refer [collect-artifacts
+                                                      artifact-path
+                                                      collect-repositories]]
             [leiningen.ancient.utils.cli :refer [parse-cli]]
             [ancient-clj.verbose :refer :all]
             [ancient-clj.core :as anc]))


WIP: Implement backtracking spec trace

WIP: Implement backtracking spec trace

--- src/spectrace/trace.cljc
+++ src/spectrace/trace.cljc
@@ -2,33 +2,89 @@
   (:require [clojure.spec :as s]
             [spectrace.specs :as specs]))

-(defmulti step (fn [conformed path] (:s conformed)))
-(defmethod step :default [_ _] nil)
+(s/def ::s symbol?)
+(s/def ::spec (s/keys :req-un [::s]))
+(s/def ::path (s/coll-of keyword?))
+(s/def ::val any?)
+(s/def ::in (s/coll-of (s/or :keyword keyword? :int integer?)))

-(defmethod step `s/keys [_ [segment & path]]
-  [segment path])
+(s/def ::state
+  (s/keys :req-un [::spec ::path ::val ::in]))

-(defmethod step `s/cat [{:keys [args]} [segment & path]]
-  [(:pred (some #(and (= (:key %) segment) %) args))
-   path])
+(s/def ::succ (s/fspec :args (s/cat :arg ::state) :ret any?))
+(s/def ::fail (s/fspec :args (s/cat) :ret any?))

-(defmethod step `s/alt [{:keys [args]} [segment & path]]
-  [(:pred (some #(and (= (:key %) segment) %) args))
-   path])
+(s/fdef step*
+  :args (s/cat :state ::state
+               :succ  ::succ
+               :fail  ::fail)
+  :ret ::state)

-(defmethod step `s/* [{:keys [args]} path]
-  [(:pred-form args) path])
+(defmulti step* (fn [state succ fail] (get-in state [:spec :s])))
+(defmethod step* :default [state _ _]
+  (let [spec (:spec state)]
+    (throw (ex-info (str "spec macro " spec
+                         " must have its own method implementation for spectrace.trace/step*")
+                    {:spec spec}))))

-(defn trace [{:keys [path] :as problem} spec value]
-  (loop [path path, form (s/form spec), ret []]
-    ;(prn :path path)
-    ;(prn :form form)
-    (if (empty? path)
-      ret
-      (let [[form' path'] (step (s/conform ::specs/spec form) path)]
-        (recur path'
-               (if (keyword? form') (s/form form') form')
-               (conj ret {:form form}))))))
+(defmethod step* `s/cat [state succ fail]
+  (let [{[segment & path] :path :keys [spec val in]} state]
+    (if-let [spec' (get (:args spec) segment)]
+      (succ {:spec spec' :path path :in (rest in)
+             :val (nth val (first in))}
+            fail)
+      (fail))))
+
+(defmethod step* `s/& [state succ fail]
+  (letfn [(rec [specs]
+            (if (empty? specs)
+              (fail)
+              (succ (assoc state :spec (first specs))
+                    #(rec (rest specs)))))]
+    (let [args (get-in state [:spec :args])
+          specs (cons (:re args) (:preds args))]
+      (rec specs))))
+
+(defmethod step* `s/alt [state succ fail]
+  (let [{[segment & path] :path :keys [spec val in]} state]
+    (if-let [spec' (some #(and (= (:key %) segment) (:pred %))
+                         (:args spec))]
+      (succ {:spec spec' :path path :in (rest in)
+             :val (nth val (first in))}
+            fail)
+      (fail))))
+
+(defmethod step* `s/* [{:keys [spec] :as state} succ fail]
+  (step (assoc state :spec (get-in spec [:args :pred-form])) succ fail))
+
+(defmethod step* `s/+ [{:keys [spec] :as state} succ fail]
+  (step (assoc state :spec (get-in spec [:args :pred-form])) succ fail))
+
+(defn- step [{:keys [spec] :as state} succ fail]
+  (let [spec (cond-> spec
+               (keyword? spec) s/form)
+        spec' (s/conform ::specs/spec spec)]
+    (assert (not= spec' ::s/invalid)
+            (str "spec macro " (first spec)
+                 " must have its own spec definition"))
+    (step* (assoc state :spec spec) succ fail)))
+
+(defn- trace* [{:keys [path] :as state} fail ret]
+  (if (empty? path)
+    ret
+    (step state
+          (fn [state' fail]
+            (let [state' (-> state'
+                             (update :path vec)
+                             (update :in vec))]
+              #(trace* state' fail (conj ret state'))))
+          (fn [] fail))))
+
+(defn trace [{:keys [path in pred val] :as problem} spec value]
+  (let [state {:spec spec :path path :val value :in in}]
+    (-> (trampoline trace* state (constantly nil) [state])
+        vec
+        (conj {:spec pred :path [] :val val :in []}))))

 (defn traces
   ([ed] (traces ed nil))


Only accept numbers as ID.

Only accept numbers as ID.

Displays a 404 instead of a NumberFormatException.

Relates to #145.

--- src/statuses/routing.clj
+++ src/statuses/routing.clj
@@ -147,11 +147,11 @@

 (defroutes app-routes
-  (DELETE (str base "/:id")              [id :as r]     (delete-entry id r))
+  (DELETE [(str base "/:id"), :id #"[0-9]+"]         [id :as r]     (delete-entry id r))
   (POST base                             []             new-update)
   (GET  base                             []             handle-list-view)
-  (GET  (str base "/:id/replyform")      [id :as r]     (replyform id r))
-  (GET  (str base "/:id")                [id :as r]     (page id r))
+  (GET  [(str base "/:id/replyform"), :id #"[0-9]+"] [id :as r]     (replyform id r))
+  (GET  [(str base "/:id"), :id #"[0-9]+"]           [id :as r]     (page id r))
   (GET  "/statuses/conversations/:id"    [id :as r]     (conversation id r))
   (GET  "/statuses/info"                 []             info)
   (GET  "/statuses/too-long/:length"     [length :as r] (too-long length r))


Make public some of the helper functions

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -463,8 +463,10 @@
          (.setAttributeType (utils/enum key-type))))
      defs)))

-(defn- local-2nd-indexes
-  "[{:name _ :range-keydef _ :projection _} ...] indexes -> [LocalSecondaryIndex ...]"
+(defn local-2nd-indexes
+  "Implementation detail.
+
+  [{:name _ :range-keydef _ :projection _} ...] indexes -> [LocalSecondaryIndex ...]"
   [hash-keydef indexes]
   (when indexes
     (mapv
@@ -486,8 +488,10 @@
               pr))))
       indexes)))

-(defn- global-2nd-indexes
-  "[{:name _ :hash-keydef _ :range-keydef _ :projection _ :throughput _} ...]
+(defn global-2nd-indexes
+  "Implementation detail.
+
+  [{:name _ :hash-keydef _ :range-keydef _ :projection _ :throughput _} ...]
   indexes -> [GlobalSecondaryIndex ...]"
   [indexes]
   (when indexes
@@ -556,8 +560,10 @@
   (when-not (describe-table client-opts table-name)
     (create-table client-opts table-name hash-keydef opts)))

-(defn- throughput-steps
-  "Dec by any amount, inc by <= 2x current amount, Ref. http://goo.gl/Bj9TC.
+(defn throughput-steps
+  "Implementation detail.
+
+  Dec by any amount, inc by <= 2x current amount, Ref. http://goo.gl/Bj9TC.
   x - start, x' - current, x* - goal."
   [[r w] [r* w*]]
   (let [step (fn [x* x'] (if (< x* x') x* (min x* (* 2 x'))))]
@@ -693,6 +699,7 @@
      (fn [[action val]] (AttributeValueUpdate. (when val (clj-val->db-val val))
                                               (utils/enum action)))
      update-map)))
+
 (defn update-item-request
   [table prim-kvs update-map & [{:keys [return expected return-cc?]
                                  :or   {return :none}}]]
@@ -738,8 +745,10 @@

 ;;;; API - batch ops

-(defn- attr-multi-vs
-  "[{<attr> <v-or-vs*> ...} ...]* -> [{<attr> <v> ...} ...] (* => optional vec)"
+(defn attr-multi-vs
+  "Implementation detail.
+
+  [{<attr> <v-or-vs*> ...} ...]* -> [{<attr> <v> ...} ...] (* => optional vec)"
   [attr-multi-vs-map]
   (let [;; ensure-coll (fn [x] (if (coll?* x) x [x]))
         ensure-sequential (fn [x] (if (sequential? x) x [x]))]
@@ -759,8 +768,10 @@
   (attr-multi-vs {:a "a1" :b ["b1" "b2" "b3"] :c #{"c1" "c2"}}) ; ''
   )

-(defn- batch-request-items
-  "{<table> <request> ...} -> {<table> KeysAndAttributes> ...}"
+(defn batch-request-items
+  "Implementation detail.
+
+  {<table> <request> ...} -> {<table> KeysAndAttributes> ...}"
   [requests]
   (utils/name-map
    (fn [{:keys [prim-kvs attrs consistent?]}]
@@ -827,7 +838,8 @@
   (batch-get-item   client-opts {:faraday.tests.main {:prim-kvs {:id (range 20)}}})
   (scan client-opts :faraday.tests.main))

-(defn- write-request [action item]
+(defn write-request [action item]
+  "Implementation detail"
   (case action
     :put    (doto (WriteRequest.) (.setPutRequest    (doto (PutRequest.)    (.setItem item))))
     :delete (doto (WriteRequest.) (.setDeleteRequest (doto (DeleteRequest.) (.setKey  item))))))


Rename `multi-kvs` -> `attr-multi-vs`

Rename `multi-kvs` -> `attr-multi-vs`

--- src/taoensso/faraday.clj
+++ src/taoensso/faraday.clj
@@ -446,22 +446,22 @@

 ;;;; API - batch ops

-(defn- multi-kvs
-  "[{<k1> <v1s*> ...} ...]* -> [{k1 v1 ...} ...] (* => optional vec)"
-  [kvs]
+(defn- attr-multi-vs
+  "[{<attr> <v-or-vs*> ...} ...]* -> [{<attr> <v> ...} ...] (* => optional vec)"
+  [attr-multi-vs-map]
   (let [ensure-coll (fn [x] (if (coll?* x) x [x]))]
-    (reduce (fn [r kvs]
-              (let [ks (keys kvs)
-                    vs (mapv ensure-coll (vals kvs))]
+    (reduce (fn [r attr-multi-vs]
+              (let [attrs (keys attr-multi-vs)
+                    vs    (mapv ensure-coll (vals attr-multi-vs))]
                 (when (> (count (filter next vs)) 1)
                   (-> (Exception. "Can range over only a single attr's values")
                       (throw)))
-                (into r (mapv (comp clj-item->db-item (partial zipmap ks))
+                (into r (mapv (comp clj-item->db-item (partial zipmap attrs))
                               (apply utils/cartesian-product vs)))))
-            [] (ensure-coll kvs))))
-
-(comment (multi-kvs {:a "a1" :b ["b1" "b2" "b3"] :c ["c1" "c2"]})
-         (multi-kvs {:a "a1" :b ["b1" "b2" "b3"] :c ["c1"]}))
+            [] (ensure-coll attr-multi-vs-map))))
+
+(comment (attr-multi-vs {:a "a1" :b ["b1" "b2" "b3"] :c ["c1" "c2"]})
+         (attr-multi-vs {:a "a1" :b ["b1" "b2" "b3"] :c ["c1"]}))

 (defn- batch-request-items
   "{<table> <request> ...} -> {<table> KeysAndAttributes> ...}"
@@ -471,7 +471,7 @@
      (doto-maybe (KeysAndAttributes.) g
        attrs       (.setAttributesToGet (mapv name g))
        consistent? (.setConsistentRead  g)
-       :always     (.setKeys (multi-kvs prim-kvs))))
+       :always     (.setKeys (attr-multi-vs prim-kvs))))
    requests))

 (comment (batch-request-items {:my-table {:prim-kvs [{:my-hash  ["a" "b"]
@@ -521,7 +521,7 @@
           (fn [table-request]
             (reduce into []
              (for [action (keys table-request)
-                   :let [items (multi-kvs (table-request action))]]
+                   :let [items (attr-multi-vs (table-request action))]]
                (mapv (partial write-request action) items))))
           requests))))))


require non nil allocation

require non nil allocation

--- src/vsphere/provider.clj
+++ src/vsphere/provider.clj
@@ -25,7 +25,7 @@

 (defconstrainedrecord VirtualMachine [allocation machine]
   ""
-  []
+  [(not (nil? allocation))]
   Vm
   (create [this] (clone allocation machine))

@@ -52,5 +52,6 @@
       ))

 (defmethod vconstruct :vsphere [spec]
-   (let [[allocation machine] (translate spec)] (->VirtualMachine allocation machine)))
+   (let [[allocation machine] (translate spec)]
+     (->VirtualMachine allocation machine)))


Refactor new completion functionality.

Refactor new completion functionality.

--- src/cli4clj/cli.clj
+++ src/cli4clj/cli.clj
@@ -71,14 +71,17 @@
         arg-completers (reduce
                          (fn [v k]
                            (let [fn-args (get-in cmds [k :fn-args])
-                                 completion-hint (get-in cmds [k :completion-hint])]
+                                 completion-hint (get-in cmds [k :completion-hint])
+                                 hint-completion-vec [(str "Arguments: " fn-args "\n")]]
                              (if (or (not (nil? fn-args))
                                      (not (nil? completion-hint)))
                                (conj v
                                      (ArgumentCompleter.
                                        [(StringsCompleter. (conj (vec (map name (cmd-aliases k))) (name k)))
-                                        (StringsCompleter. [(str "Arguments: " fn-args "\n")
-                                                            (str "Hint: " completion-hint)])])))))
+                                        (StringsCompleter. (if (not (nil? completion-hint))
+                                                             (conj hint-completion-vec
+                                                               (str "Hint: " completion-hint))
+                                                             hint-completion-vec))])))))
                          []
                          (keys cmd-aliases))
         _ (doseq [arg-compl arg-completers]


Remove unused require

Remove unused require

--- src/clojars/scp.clj
+++ src/clojars/scp.clj
@@ -4,7 +4,6 @@
            com.martiansoftware.nailgun.NGContext)
   (:require [clojure.set :as set]
             [clojure.java.io :as io]
-            [clojure.java.shell]
             [clojars.config :refer [config]]
             [clojars.maven :as maven]
             [clojars.db :as db]


[fix] align min input container height with tab menu

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/ui/screens/desktop/main/chat/styles.cljs
+++ src/status_im/ui/screens/desktop/main/chat/styles.cljs
@@ -1,7 +1,10 @@
 (ns status-im.ui.screens.desktop.main.chat.styles
   (:require [status-im.ui.components.colors :as colors]))

-(def min-input-container-height 68)
+;; TODO: see how this could be refactored to be
+;; automatically alignde with tabs-height in
+;; status-im.ui.screens.main-tabs.styles
+(def min-input-container-height 67)
 (def max-input-container-height 180)
 (def chat-vertical-padding 16)
 (def min-input-area-height 20)


Fix benchmark install path.

Fix benchmark install path.

--- test/cavm/benchmark/core.clj
+++ test/cavm/benchmark/core.clj
@@ -46,7 +46,7 @@

   (try
     (if (= args ["install"])
-      (install (io/file (System/getProperty "user.home") "xena-install"))
+      (install (io/file (System/getProperty "user.home") "xena-benchmark"))
       (let [xena (h2/create-xenadb dbfile)
             {:keys [id probes]} (first benchmark-data/probemaps)
             {cnv-id :id} (first benchmark-data/cnv)]


Six tests for the function get-exception-message

--- test/clouseau/test_utils.clj
+++ test/clouseau/test_utils.clj
@@ -94,4 +94,61 @@
     (testing "if the clouseau.utils/get-exception-message definition exists."
         (is (callable? 'clouseau.utils/get-exception-message))))

+;
+; Tests for behaviour of all functions
+;

+(deftest test-get-exception-message-1
+    "Check the function clouseau.utils/get-exception-message."
+    (testing "the function clouseau.utils/get-exception-message."
+        (try
+            (throw (new java.lang.Exception "Message text"))
+            (is nil "Exception not thrown as expected!")
+            (catch Exception e
+                (is (= "Message text" (get-exception-message e)))))))
+
+(deftest test-get-exception-message-2
+    "Check the function clouseau.utils/get-exception-message."
+    (testing "the function clouseau.utils/get-exception-message."
+        (try
+            (/ 1 0)
+            (is nil "Exception not thrown as expected!")
+            (catch Exception e
+                (is (= "Divide by zero" (get-exception-message e)))))))
+
+(deftest test-get-exception-message-3
+    "Check the function clouseau.utils/get-exception-message."
+    (testing "the function clouseau.utils/get-exception-message."
+        (try
+            (Integer/parseInt "unparseable")
+            (is nil "Exception not thrown as expected!")
+            (catch Exception e
+                (is (.startsWith (get-exception-message e) "For input string:"))))))
+
+(deftest test-get-exception-message-4
+    "Check the function clouseau.utils/get-exception-message."
+    (testing "the function clouseau.utils/get-exception-message."
+        (try
+            (throw (new java.lang.Exception ""))
+            (is nil "Exception not thrown as expected!")
+            (catch Exception e
+                (is (= "" (get-exception-message e)))))))
+
+(deftest test-get-exception-message-5
+    "Check the function clouseau.utils/get-exception-message."
+    (testing "the function clouseau.utils/get-exception-message."
+        (try
+            (throw (new java.lang.Exception))
+            (is nil "Exception not thrown as expected!")
+            (catch Exception e
+                (is (nil? (get-exception-message e)))))))
+
+(deftest test-get-exception-message-6
+    "Check the function clouseau.utils/get-exception-message."
+    (testing "the function clouseau.utils/get-exception-message."
+        (try
+            (println (nth [] 10)) ; realize the sequence and getter
+            (is nil "Exception not thrown as expected!")
+            (catch Exception e
+                (is (nil? (get-exception-message e)))))))
+


Add tests

Add tests

--- test/tick/alpha/api_test.clj
+++ test/tick/alpha/api_test.clj
@@ -13,7 +13,9 @@

 (deftest constructor-test
   (is (= java.time.Year (type (t/year 2017))))
-  (is (= java.time.Month (type (t/month 12)))))
+  (is (= 2017 (.getValue (t/year 2017))))
+  (is (= java.time.Month (type (t/month 12))))
+  (is (= t/december (t/month 12))))

 ;; Point-in-time tests


Adapt test helpers to previous changes.

Adapt test helpers to previous changes.

--- test/uxbox/tests/helpers.clj
+++ test/uxbox/tests/helpers.clj
@@ -22,13 +22,13 @@
 (defn database-reset
   [next]
   (-> (mount/only #{#'uxbox.config/config
+                    #'uxbox.config/secret
                     #'uxbox.db/datasource
                     #'uxbox.migrations/migrations
                     #'uxbox.media/static-storage
                     #'uxbox.media/media-storage
                     #'uxbox.media/images-storage
-                    #'uxbox.media/thumbnails-storage
-                    #'uxbox.services.auth/secret})
+                    #'uxbox.media/thumbnails-storage})
       (mount/swap {#'uxbox.config/config +config+})
       (mount/start))
   (with-open [conn (db/connection)]


Use !.

Use !.

--- spec/incise/parsers/parse_spec.clj
+++ spec/incise/parsers/parse_spec.clj
@@ -22,12 +22,12 @@
     (record-parse! @path @a-parse)
     (should= {@path @a-parse} @parses)))

-(describe "dissoc-parses"
+(describe "dissoc-parses!"
   (with path "my/cool/path.md")
   (with parses-stub (atom {@path (map->Parse {})}))
   (around [it] (with-clean-parses (it)))
   (it "removes the specified paths from the parses atom"
-    (dissoc-parses [@path])
+    (dissoc-parses! [@path])
     (should= {} @parses)))

 (defmacro should-always-publish []


Add tests for #102

Add tests for #102

--- test/cats/core_spec.cljc
+++ test/cats/core_spec.cljc
@@ -118,19 +118,29 @@
              (m/sequence [(maybe/just 2) (maybe/just 3)])))

     (t/is (= (maybe/nothing)
-             (m/sequence [(maybe/just 2) (maybe/nothing)])))))
-
+             (m/sequence [(maybe/just 2) (maybe/nothing)]))))
+
+  (t/testing "It works with an empty collection"
+    (t/is (= (maybe/just ())
+             (ctx/with-context maybe/context
+               (m/sequence ()))))))

 (t/deftest mapseq-tests
   (t/testing "It works with Maybe values"
-    (t/is (= (m/mapseq maybe/just [1 2 3 4 5])
-             (maybe/just [1 2 3 4 5])))
+    (t/is (= (maybe/just [1 2 3 4 5])
+             (m/mapseq maybe/just [1 2 3 4 5])))
     (t/is (= (maybe/nothing)
              (m/mapseq (fn [v]
                          (if (odd? v)
                            (maybe/just v)
                            (maybe/nothing)))
-                       [1 2 3 4 5])))))
+                       [1 2 3 4 5]))))
+
+  (t/testing "It works with an empty collection"
+    (t/is (= (maybe/just ())
+             (ctx/with-context maybe/context
+               (m/mapseq maybe/just []))))))
+
 (t/deftest lift-m-tests
   (let [monad+ (m/lift-m 2 +)]
     (t/testing "It can lift a function to the vector monad"


Marking a few things won't fix

Marking a few things won't fix

--- test/cljs/core_test.cljs
+++ test/cljs/core_test.cljs
@@ -679,7 +679,7 @@
     (assert (= (seq a) (seq (to-array [1 2 3]))))
     (assert (= 42 (aset a 0 42)))
     (assert (not= (seq a) (seq (to-array [1 2 3]))))
-    ;; FAILURE - array equals, no fix?
+    ;; WON'T FIX - array equals.
     ;; (assert (not= a (aclone a)))
 )

@@ -1471,7 +1471,7 @@
   ;;   (assert (= 500 (count m)))
   ;;   (assert (= 123 (m "foo123"))))

-  ;; FAILURE - needs .sort on JSArray and a way to convert comparators to funcs, unsure if it's worth fixing.
+  ;; WON'T FIX - needs .sort on JSArray and a way to convert comparators to funcs, unsure if it's worth fixing.
   ;; ;; comparator
   ;; (assert (= [1 1 2 2 3 5] (seq (.sort (to-array [2 3 1 5 2 1]) (comparator <)))))
   ;; (assert (= [5 3 2 2 1 1] (seq (.sort (to-array [2 3 1 5 2 1]) (comparator >)))))
@@ -1739,7 +1739,7 @@
   (assert (= (UUID. "550e8400-e29b-41d4-a716-446655440000")
              (UUID. "550e8400-e29b-41d4-a716-446655440000")))

-  ;; FAILURE - identical? is using DeepEqual, needs general fix.
+  ;; WON'T FIX - identical? is using DeepEqual, needs general fix.
   ;; (assert (not (identical? (UUID. "550e8400-e29b-41d4-a716-446655440000")
   ;;                          (UUID. "550e8400-e29b-41d4-a716-446655440000"))))

@@ -1875,7 +1875,7 @@
              (try (throw (ex-info "asdf" {:foo 1}))
                   (catch ExceptionInfo e
                     (ex-data e)))))
-  ;; FAILURE - ex-info is a Go error, but doesn't inherit js/Error.
+  ;; WON'T FIX - ex-info is a Go error, but doesn't inherit js/Error.
   ;; (assert (instance? js/Error (ex-info "asdf" {:foo 1})))
   ;; (assert (not (instance? cljs.core.ExceptionInfo (js/Error.))))

@@ -2275,7 +2275,7 @@

   ;; ;; basic iteration

-  ;; FAILURE - doesn't work as it uses a js-obj with the .-value and .-done keys internally.
+  ;; WON'T FIX - doesn't work as it uses a js-obj with the .-value and .-done keys internally.
   ;; (def iter (iterator [1 2 3]))

   ;; (assert (= (.-value (.next iter)) 1))


Format change

Format change

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -94,8 +94,12 @@
      (when heading? (heading :h1 :inhalt []))
      (let [entries (order (keys items))
            entries (cond
-                     recommendation-at-end? (concat [:editorial] entries [(if single-recommendation? :recommendation :recommendations)])
-                     editorial? (concat [:editorial (if single-recommendation? :recommendation :recommendations)] entries)
+                     recommendation-at-end? (concat [:editorial] entries [(if single-recommendation?
+                                                                            :recommendation
+                                                                            :recommendations)])
+                     editorial? (concat [:editorial (if single-recommendation?
+                                                      :recommendation
+                                                      :recommendations)] entries)
                      :else entries)]
        (keep #(toc-entry (get items %) (conj path %) to-depth) entries))]))


Define a document entity

Define a document entity

--- src/doctopus/db.clj
+++ src/doctopus/db.clj
@@ -76,6 +76,15 @@
   (belongs-to heads)
   (belongs-to tentacles))

+(defentity documents
+  (table :documents)
+  (prepare ->snake-keys)
+  (prepare add-updated)
+  (transform ->kebab-keys)
+  (belongs-to tentacles)
+  (entity-fields :name :uri :tentacle_name :body))
+
+
 (defn get-tentacle
   [name]
   (first (select tentacles


add a docstr <3

add a docstr <3

--- src/metabase/models/hydrate.clj
+++ src/metabase/models/hydrate.clj
@@ -1,8 +1,8 @@
 (ns metabase.models.hydrate
+  "Functions for deserializing and hydrating fields in objects fetched from the DB."
   (:require [clojure.data.json :as json]
             [clojure.walk :as walk]
             [metabase.db :refer [sel]]
-            [metabase.db.internal :refer [entity->korma]]
             [metabase.util :as u]))


Use tm/temp and also added an untested Conditional case

--- src/clj/minijava/munch.clj
+++ src/clj/minijava/munch.clj
@@ -1,5 +1,6 @@
 (ns minijava.munch
-  (:use (minijava exp ir gas)))
+  (:use (minijava exp ir gas))
+  (:require [minijava.temp :as tm]))

 ;;helper method to do instanceof
@@ -85,12 +86,12 @@
   (defmethod munchMap [:minijava.ir/Mem :minijava.exp/expression]
   [x adr]
   	;;Mem(addr) -> Movl [adr] Temp
-  	(let [d (Temp (minijava.ir.temp.Temp.))
+  	(let [d (tm/temp)
   	  		s (munch adr)]
   				 (emit (movl s d))
   				 d)) ;;Since Mem is an expression, it returns a temp.

-(defmethod munchMap [:minijava.ir/Temp minijava.ir.temp.Temp]
+(defmethod munchMap [:minijava.ir/Temp :minijava.temp/Temp]
   [exp temp]
   exp) ;;Leave temps alone

@@ -98,7 +99,7 @@
 (defmethod munchMap [:minijava.ir/Const java.lang.Integer]
   [x value]
   	;;Const(i) -> Movl $i Temp
-  	(let [d (Temp (minijava.ir.temp.Temp.))]
+  	(let [d (tm/temp)]
   				 (emit (movl (CONST value) d))
   				 d)) ;;Since Mem is an expression, it returns a temp.

@@ -120,14 +121,14 @@
 ;;Addition
 (defmethod munchMap [:minijava.ir/BinaryOp :+ :minijava.ir/Const  :minijava.exp/expression]
  [exp op rand1 rand2]
-  (let [d (Temp (minijava.ir.temp.Temp.)) ]
+  (let [d (tm/temp) ]
   		 	(emit (movl  (CONST (:val rand1)) d))
         (emit (addl (munch rand2) d))
                     d))

 (defmethod munchMap [:minijava.ir/BinaryOp :+ :minijava.exp/expression :minijava.ir/Const ]
   [exp op rand1 rand2]
-  (let [d (Temp (minijava.ir.temp.Temp.)) ]
+  (let [d (tm/temp) ]
   		 	(emit (movl  (CONST (:val rand2)) d))
         (emit (addl (munch rand1) d))
                     d))
@@ -137,7 +138,7 @@
   [x op exp1 exp2]
   	(let [e1 (munch exp1)
   			  e2 (munch exp2)
-  			  d (Temp (minijava.ir.temp.Temp.))]
+  			  d (tm/temp)]
   			 	(emit (movl  e1 d))
   			 	(emit (addl  e2 d))
   			  d))
@@ -145,14 +146,14 @@
  ;;Subtraction
 (defmethod munchMap [:minijava.ir/BinaryOp :- :minijava.ir/Const  :minijava.exp/expression] ;;first exp - second exp
  [exp op rand1 rand2]
-  (let [d (Temp (minijava.ir.temp.Temp.)) ]
+  (let [d (tm/temp) ]
   		 	(emit (movl  (CONST (:val rand1)) d))
         (emit (subl  (munch rand2) d  ))
                     d))

 (defmethod munchMap [:minijava.ir/BinaryOp :- :minijava.exp/expression :minijava.ir/Const ] ;;first exp - second exp
   [exp op rand1 rand2]
-  (let [d (Temp (minijava.ir.temp.Temp.)) ]
+  (let [d (tm/temp) ]
   		 	(emit (movl  (munch rand1) d))
         (emit (subl (CONST (:val rand2)) d));;note: the ordering here matters, and is different than above, because subtraction is not commutative
                     d))
@@ -161,7 +162,7 @@
   [x op exp1 exp2]
   	(let [e1 (munch exp1)
   			  e2 (munch exp2)
-  			  d (Temp (minijava.ir.temp.Temp.))]
+  			  d (tm/temp)]
   			 	(emit (movl  e2 d))
   			 	(emit (subl  e1 d))
   			  d))
@@ -170,14 +171,14 @@
  ;;Multiplication
 (defmethod munchMap [:minijava.ir/BinaryOp :* :minijava.ir/Const  :minijava.exp/expression]
  [exp op rand1 rand2]
-  (let [d (Temp (minijava.ir.temp.Temp.)) ]
+  (let [d (tm/temp) ]
   		 	(emit (movl  (CONST (:val rand1)) d))
         (emit (imull  (munch rand2) d  ))
                     d))

 (defmethod munchMap [:minijava.ir/BinaryOp :* :minijava.exp/expression :minijava.ir/Const ]
   [exp op rand1 rand2]
-  (let [d (Temp (minijava.ir.temp.Temp.)) ]
+  (let [d (tm/temp) ]
   		 	(emit (movl  (munch rand1) d))
         (emit (imull (CONST (:val rand2)) d))
                     d))
@@ -186,9 +187,18 @@
   [x op exp1 exp2]
   	(let [e1 (munch exp1)
   			  e2 (munch exp2)
-  			  d (Temp (minijava.ir.temp.Temp.))]
+  			  d (tm/temp)]
   			 	(emit (movl  e2 d))
   			 	(emit (imull  e1 d))
   			  d))

-
+;; Conditional
+
+(defmethod munchMap [:minijava.ir/Conditional := :minijava.exp/expression
+                     :minijava.exp/expression :minijava.ir/Name :minijava.ir/Name]
+  [op rand1 rand2 then else]
+  (let [t1 (munch rand1)
+        t2 (munch rand2)]
+    (emit (cmpl t1 t2))
+    (emit (jcc op then))
+    (emit (jmp else))))


fix sw content-type

fix sw content-type

--- src/clojure/nossal/app.clj
+++ src/clojure/nossal/app.clj
@@ -30,7 +30,9 @@

 (defn service-worker [mod]
-  (response/resource-response (str "sw.js" mod) {:root "public/js"}))
+  (response/content-type
+    (response/resource-response (str "sw.js" mod) {:root "public/js"})
+    "text/javascript"))

 (defroutes app-routes


Fix information model ordering.

Fix information model ordering.

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -1130,7 +1130,6 @@
     :onyx.bookkeeper/client-throttle
     :onyx.bookkeeper/write-buffer-size
     :onyx.bookkeeper/client-timeout
-    :onyx.bookkeeper/disk-usage-threshold
     :onyx.peer/state-filter-impl
     :onyx.rocksdb.filter/base-dir
     :onyx.rocksdb.filter/bloom-filter-bits
@@ -1141,9 +1140,14 @@
     :onyx.rocksdb.filter/num-ids-per-bucket
     :onyx.rocksdb.filter/rotation-check-interval-ms]
    :env-config
-   [:zookeeper/server? :zookeeper.server/port :onyx/id :zookeeper/address
+   [:onyx/id
+    :zookeeper/server?
+    :zookeeper.server/port
+    :zookeeper/address
     :onyx.bookkeeper/server?
     :onyx.bookkeeper/delete-server-data?
     :onyx.bookkeeper/local-quorum?
     :onyx.bookkeeper/local-quorum-ports :onyx.bookkeeper/port
-    :onyx.bookkeeper/base-journal-dir :onyx.bookkeeper/base-ledger-dir]})
+    :onyx.bookkeeper/base-journal-dir
+    :onyx.bookkeeper/base-ledger-dir
+    :onyx.bookkeeper/disk-usage-threshold]})


Remove acker doc information keys to prevent rendering.

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -128,26 +128,22 @@
                             :tags [:task]
                             :optional? true
                             :added "0.9.0"}
-                 :acker/percentage {:doc ""
-                                    :type :double
+                 :acker/percentage {:type :double
                                     :tags []
                                     :optional? true
                                     :deprecated-version "0.10.0"
                                     :deprecation-doc ":acker/percentage was deprecated in  0.10.0 when ackers were removed."}
-                 :acker/exempt-input-tasks? {:doc ""
-                                             :type :any
+                 :acker/exempt-input-tasks? {:type :any
                                              :tags []
                                              :optional? true
                                              :deprecated-version "0.10.0"
                                              :deprecation-doc ":acker/exempt-input-tasks? was deprecated in 0.10.0 when ackers were removed."}
-                 :acker/exempt-output-tasks? {:doc ""
-                                              :type :any
+                 :acker/exempt-output-tasks? {:type :any
                                               :tags []
                                               :optional? true
                                               :deprecated-version "0.10.0"
                                               :deprecation-doc ":acker/exempt-output-tasks? was deprecated in 0.10.0 when ackers were removed."}
-                 :acker/exempt-tasks {:doc ""
-                                      :type :any
+                 :acker/exempt-tasks {:type :any
                                       :tags []
                                       :optional? true
                                       :deprecated-version "0.10.0"


ignore filler-actions

ignore filler-actions

--- frontend/components/build.cljs
+++ frontend/components/build.cljs
@@ -69,7 +69,7 @@
             {:keys [containers current-container-id]} container-data
             controls-ch (om/get-shared owner [:comms :controls])
             hide-pills? (or (>= 1 (count containers))
-                            (empty? (mapcat :actions containers)))]
+                            (empty? (remove :filler-action (mapcat :actions containers))))]
         (html
          [:div.containers.pagination.pagination-centered (when hide-pills? {:style {:display "none"}})
           [:ul.container-list


start new threads with an initial uuid

start new threads with an initial uuid

--- src/chat/client/views.cljs
+++ src/chat/client/views.cljs
@@ -72,7 +72,8 @@
     om/IRender
     (render [_]
       (dom/div #js {:className "thread"}
-        (om/build new-message-view {:placeholder "Start a new conversation..."})))))
+        (om/build new-message-view {:placeholder "Start a new conversation..."
+                                   :thread-id (uuid/make-random-squuid)})))))

 (defn tag-view [tag owner]
   (reify


find shares

find shares

--- src/clj/ceres/analyzer.clj
+++ src/clj/ceres/analyzer.clj
@@ -124,7 +124,6 @@
           (take 25)
           (map (fn [[k v]] [(:screen_name (mc/find-map-by-id @db "users" k))
                            v])))]))
-

 (defn create-d3-graph
   "Converts zipper into d3 readable format"
@@ -219,7 +218,7 @@
         graph (->> (mc/find-maps @db "publications" {:user {$in source-uids}})
              (pmap (comp summary reaction-tree :_id))
              (sort-by :size >)
-             (take 3)
+             (take 4)
              last
              :source
              full-reaction-tree
@@ -233,7 +232,7 @@
                            {:name k
                             :group (dispatch-types (get types k))})
                          %))]
-    (with-open [w (clojure.java.io/writer "resources/graph-3b.edn")]
+    (with-open [w (clojure.java.io/writer "resources/graph-4.edn")]
       (binding [*print-length* false
                 *out* w]
         (pr cleaned-graph))))
@@ -260,8 +259,16 @@
      (mc/count @db "reactions"))

-  (mc/find-maps @db "origins" {:source nil
-                               :ts {$gt (t/date-time 2014 8 1)
-                                    $lt (t/date-time 2014 9 1)}})
+  ;; asdasd
+
+  (mc/count @db "origins" {:source nil
+                               :ts time-interval })
+
+  (->> (mc/count @db "tweets" {:created_at time-interval
+                               :user.screen_name {$nin news-accounts}
+                               :retweeted_status.id_str nil
+                               :in_reply_to_status_id_str nil})
+       aprint
+       time)

 )


show Draco strength immediately if rezzed outside of an encounter

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -197,7 +197,8 @@

    "Dracō"
    {:prompt "How many power counters?" :choices :credit :msg (msg "add " target " power counters")
-    :effect (effect (set-prop card :counter target))
+    :effect (effect (set-prop card :counter target)
+                    (update-ice-strength card))
     :strength-bonus (req (or (:counter card) 0))
     :abilities [{:label "Trace 2 - Give the Runner 1 tag and end the run"
                  :trace {:base 2 :msg "give the Runner 1 tag and end the run"


Add way to stop old tweets retrieval

Add way to stop old tweets retrieval

--- src/clj/skytwit/server.clj
+++ src/clj/skytwit/server.clj
@@ -108,12 +108,16 @@

 (defn put-old-tweets-on-channel
   [creds screen-name chan]
-  (let [max-id (-> (get-user-profile creds screen-name) :last-tweet-id inc)]
+  (let [max-id (-> (get-user-profile creds screen-name) :last-tweet-id inc)
+        end? (atom false)]
     (go-loop [last-id max-id]
-             (let [next-batch (get-tweets-before-tweet-id creds screen-name last-id)]
-               (when (seq next-batch)
-                 (>! chan next-batch)
-                 (recur (:id (last next-batch))))))))
+             (when-not @end?
+               (let [next-batch (get-tweets-before-tweet-id
+                                  creds screen-name last-id)]
+                 (when (seq next-batch)
+                   (>! chan next-batch)
+                   (recur (:id (last next-batch)))))))
+    (fn [] (reset! end? true))))

 (defn put-new-tweets-on-channel
   [creds screen-name chan]


Section notice looks better in bold

Section notice looks better in bold

--- src/cljs/memento/core.cljs
+++ src/cljs/memento/core.cljs
@@ -257,7 +257,7 @@
             " "
             "You have some thoughts you wanted to be reminded of."]
            [:p
-            "Click this section when you are ready to read them."]]))
+            [:b "Click this section when you are ready to read them."]]]))

       )))


insert comment on place to record downloaded state

--- src/cljs/smgui/search.cljs
+++ src/cljs/smgui/search.cljs
@@ -50,7 +50,9 @@
                                   (assoc :extra extra))]
                  (if (trackable-states status) (track/search (name status)))
                  (recur new-info))
-               (close! out)))
+               (do
+                 ; TODO: record if it's not successful
+                 (close! out))))
     out))

 (def cache-storage (engine/local-storage-cache))


Delimiter arrangement

Delimiter arrangement

--- src/cljs/zetawar/data.cljs
+++ src/cljs/zetawar/data.cljs
@@ -316,8 +316,7 @@
             {:personnel 10
              :armored   10}
             :zoc
-            [:personnel :armored]}
-      }}})
+            [:personnel :armored]}}}})

 ;; TODO: remove redundant id keys (?)
 (def maps


Remove buildable-at

Remove buildable-at

--- src/cljs/zetawar/game.cljs
+++ src/cljs/zetawar/game.cljs
@@ -1291,7 +1291,6 @@
                      :unit-type/capturing-armor (or capturing-armor armor)
                      :unit-type/repair (:repair unit-def)
                      :unit-type/state-map [:unit-state-map/game-id-idx unit-state-map-idx]
-                     :unit-type/buildable-at (map #(to-buildable-at %) (:buildable-at unit-def))
                      :unit-type/image (:image unit-def)
                      :unit-type/zoc-armor-types (map #(to-armor-type %) (:zoc unit-def))}]
                    (into (attack-strengths-tx db game-id unit-type-eid (:attack-strengths unit-def)))


Langohr 3.1.0

Langohr 3.1.0

--- src/rabbitmq-broker/project.clj
+++ src/rabbitmq-broker/project.clj
@@ -2,7 +2,7 @@
   :description "Pivotal CF RabbitMQ service broker"
   :dependencies [[org.clojure/clojure     "1.6.0"]
                  ;; RabbitMQ client (including HTTP API)
-                 [com.novemberain/langohr "3.0.0" :exclusions [clj-http]]
+                 [com.novemberain/langohr "3.1.0" :exclusions [clj-http]]
                  ;; HTTP client which uses HTTPCore 4.2.x, compatible
                  ;; with Spring 3 and CF Java client.
                  [clj-http                "1.0.1"]


Improve wrap-static-index middleware.

Improve wrap-static-index middleware.

Use destructuring to improve clarity and remove a line.

--- src/incise/core.clj
+++ src/incise/core.clj
@@ -12,11 +12,10 @@
   (not-found (html5 [:h1 "404"])))

 (defn wrap-static-index [handler]
-  (fn [request]
-    (let [uri (:uri request)]
-      (handler (if (= (last uri) \/)
-                 (assoc request :uri (str uri "index.html"))
-                 request)))))
+  (fn [{:keys [uri] :as request}]
+    (handler (if (= (last uri) \/)
+               (assoc request :uri (str uri "index.html"))
+               request))))

 (def app (-> routes
              (wrap-static-index)


Add prerequiste req to once ns.

Add prerequiste req to once ns.

--- src/incise/once.clj
+++ src/incise/once.clj
@@ -9,7 +9,7 @@
                     [core :refer [precompile]])))

 (defn once
-  "Incise just once."
+  "Incise just once. This requires that config is already loaded."
   []
   (let [out-dir (conf/get :out-dir)
         stefon-pre-opts {:mode :production


Remove :stalled event in audio player

Remove :stalled event in audio player

It confuses the play/pause state and we are not really using it.

--- src/sinusoides/views/think.cljs
+++ src/sinusoides/views/think.cljs
@@ -86,8 +86,7 @@
               (events/listen audio "pause" #(update-status :paused))
               (events/listen audio "ended" #(update-status :ended))
               (events/listen audio "error" #(update-status :error))
-              (events/listen audio "abort" #(update-status :aborted))
-              (events/listen audio "stalled" #(update-status :stalled))])
+              (events/listen audio "abort" #(update-status :aborted))])

            (go-loop []
              (match [(<! ch)]
@@ -120,8 +119,7 @@
                is-playing
                #(let [st (:status @state)]
                   (or (= st :play)
-                      (= st :playing)
-                      (= st :stalled)))
+                      (= st :playing)))

                is-started
                #(pos? (:current-time @state))