had a bit of a play

had a bit of a play

--- src/dynamodb_expression/core.clj
+++ src/dynamodb_expression/core.clj
@@ -1,59 +1,38 @@
-(ns dynamodb-expression.core)
+(ns dynamodb-expression.core
+  (:require [clojure.string :as st]))

-(defn sanitize-placeholder [ph] (clojure.string/replace ph #"[^0-9a-zA-Z_]" "_"))
+(defn update-expr []
+  {:ops []})

-(defn gen-placeholder [prefix name]
-  (str prefix (sanitize-placeholder name) "_" (gensym)))
+(defn add [expr field val]
+  (let [field     (name field)
+        sym       (sanitize-placeholder (str (gensym (str field "_"))))
+        expr-name (str "#" sym)
+        expr-val  (str ":" sym)]
+    (update-in expr [:ops] conj {:op        :add
+                                 :field     field
+                                 :arg       val
+                                 :sym       sym
+                                 :expr-name expr-name
+                                 :expr-val  expr-val
+                                 :expr-part (str expr-name " " expr-val)})))

-(defn generate-name-placeholder [name] (gen-placeholder "#" name))
+(defn- build-expression [ops]
+  (->> ops
+       (group-by :op)
+       (reduce (fn [ex [op ops]]
+                 (->> ops
+                      (map :expr-part)
+                      (st/join ", ")
+                      (str ex (st/upper-case (name op)) " ")))
+               nil)))

-(defn generate-value-placeholder [value] (gen-placeholder ":" value))
+(defn- attr-map [name-or-value key ops]
+  (->> ops
+       (map (juxt name-or-value key))
+       (into {})))

-(defmulti resolve-expr-value #(class %))
-
-(defmethod resolve-expr-value clojure.lang.Symbol [x] (deref (resolve x)))
-
-(defmethod resolve-expr-value :default [x] x)
-
-(defn handle-form [[name & parts]]
-  (cond
-    (= 'add name) (reduce
-                   (fn [acc [path upd]]
-                     (let [gpath (generate-name-placeholder path)
-                           gupdate (generate-value-placeholder upd)]
-                       (-> acc
-                           (update :expression #(vec (conj % [gpath gupdate])))
-                           (update :attr-names #(assoc % gpath path))
-                           (update :attr-values #(assoc % gupdate (resolve-expr-value upd))))))
-                   {:type :add}
-                   parts)))
-
-(defmulti render-update-expression (fn [args] (first args)))
-
-(defmethod render-update-expression :default [[t _]] (throw (ex-info "Can't handle type" {:type t})))
-
-(defmethod render-update-expression :add [[_ pairs]]
-  (->> pairs
-       (map #(clojure.string/join " " %))
-       (clojure.string/join ", ")))
-
-(defn type-kwd->type-expr [kwd] (-> kwd name clojure.string/upper-case))
-
-(defn reduce-partial-exprs [partial-type partials]
-  (->
-   (reduce (fn [{:keys [update-expression expression-attribute-names expression-attribute-values]
-                 :as acc}
-                {:keys [type expression attr-names attr-values]}]
-             {:update-expression (vec (conj update-expression (render-update-expression [partial-type expression])))
-              :expression-attribute-names (merge expression-attribute-names attr-names)
-              :expression-attribute-values (merge expression-attribute-values attr-values)})
-           {}
-           partials)
-   (update :update-expression #(str (type-kwd->type-expr partial-type) " " (first %)))))
-
-(defn expr [& forms]
-  (->>
-   forms
-   (map handle-form)
-   (group-by :type)
-   (map (fn [[t partials]] (reduce-partial-exprs t partials)))))
+(defn expr [{:keys [ops] :as expr}]
+  {:update-expression (build-expression ops)
+   :expression-attribute-names (attr-map :expr-name :field ops)
+   :expression-attribute-values (attr-map :expr-val :arg ops)})


dynamic column widths & general refactoring

--- qmon.clj
+++ qmon.clj
@@ -6,101 +6,109 @@
            [java.io StringBufferInputStream]
            [javax.swing JFrame])
   (:use [clojure.java.shell :only [sh]])
-  (:use [clojure.xml :only [parse]])
-  (:use [clojure.pprint]))
+  (:use [clojure.string :only [join]])
+  (:use [clojure.xml :only [parse]]))

-(def fmtstr "%-8s %-16s %-8s %-8s %-5s %-5s %-1s %-8s %-9s %s")
+(def headkeys [:jobid :owner :rtime :utime :procs :nodes :state :queue :part :name])
+(def headvals ["Job ID" "Owner" "Requested" "Used" "Procs" "Nodes" "S" "Queue" "Partition" "Job Name"])

-(declare tags tree xml xprocs xres xtime)
+(declare split tree xprocs xres xtime)

-(defn contents [job]  (map #(:content %) job))
-(defn d        [n]    (apply str (repeat n "-")))
-(defn jobraw   [job]  (zipmap (tags job) (contents job)))
-(defn jobs     []     (map :content (filter #(= (:tag %) :Job) (tree))))
-(defn re       [user] (re-pattern (str user "@.*")))
-(defn tags     [job]  (map #(:tag %) job))
-(defn xattr    [j,k]  (first (k j)))
-(defn xjobid   [j]    (xattr j :Job_Id))
-(defn xml      []     (:out (sh "qstat" "-x")))
-(defn xname    [j]    (xattr j :Job_Name))
-(defn xnodes   [j]    (if (= "-" (xprocs j)) (xres j :nodect) "-"))
-(defn xowner   [j]    (xattr j :Job_Owner))
-(defn xqueue   [j]    (xattr j :queue))
-(defn xprocs   [j]    (let [procs (xres j :procs) ] (if (nil? procs) "-" procs)))
-(defn xres     [j,k]  (first (:content (first (filter #(= (:tag %) k) (:Resource_List j))))))
-(defn xrtime   [j]    (xtime j :Resource_List))
-(defn xstate   [j]    (xattr j :job_state))
-(defn xtime    [j,k]  (first (:content (first (filter #(= (:tag %) :walltime) (k j))))))
-(defn xutime   [j]    (let [t (xtime j :resources_used)] (if (nil? t) "-" t)))
+(defn colwidths [jobs]
+  (let [headwidth (map #(count ((zipmap headkeys headvals) %)) headkeys)
+        datawidth (map #(reduce max (map count (map % jobs))) headkeys)]
+    (map max headwidth datawidth)))
+
+(defn jobinfo [job]
+  (let [fns (map #(ns-resolve *ns* (symbol (str "x" (name %)))) headkeys)
+        raw (fn [job] (zipmap (map #(:tag %) job) (map #(:content %) job)))]
+    (zipmap headkeys (map #(% (raw job)) fns))))
+
+(defn myname []
+  (if (first *command-line-args*)
+    (first *command-line-args*)
+    (get (System/getenv) "USER")))
+
+(defn myjobs [user]
+  (let [alljobs (map :content (filter #(= (:tag %) :Job) (tree)))
+        re (fn [user] (re-pattern (str user "@.*")))
+        x (filter #(re-matches (re user) (:owner %)) (map #(jobinfo %) alljobs))]
+    (map #(assoc %
+            :jobid (re-find (re-matcher #"^\d+" (:jobid %)))
+            :owner (re-find (re-matcher #"^[^@]+" (:owner %))))
+         x)))
+
+(defn prhead [msg fmt sep]
+  (str (format "\n%s\n\n" msg) (apply format fmt headvals) "\n" sep "\n"))
+
+(defn prjobs [fmt sep jobs msg]
+  (let [fmtjob (fn [j fmt] (apply format fmt (map #(% j) headkeys)))]
+    (if (empty? jobs)
+      nil
+      (str (prhead msg fmt sep) (reduce #(str %1 %2) (map #(str (fmtjob % fmt) "\n") jobs))))))
+
+(defn show [user]
+  (let [jobs      (myjobs   user)
+        sections  (split    jobs)
+        colwidths (colwidths jobs)
+        fmt       (join " " (map #(str "%-" % "s") colwidths))
+        dashes    (fn [n] (apply str (repeat n "-")))
+        sep       (join " " (map #(dashes %) colwidths))]
+    (str (format "\n%s\n" (.toString (java.util.Date.)))
+         (prjobs fmt sep (:Q sections) "QUEUED"   )
+         (prjobs fmt sep (:R sections) "RUNNING"  )
+         (prjobs fmt sep (:C sections) "COMPLETED"))))
+
+(defn split [jobs]
+  (let [f (fn [s j] (filter #(= s (:state %)) j))]
+    (apply merge (map #(hash-map % (f (name %) jobs)) [:Q :R :C]))))

 (defn tree []
-  (try (:content (parse (java.io.StringBufferInputStream. (xml))))
+  (try (:content (parse (java.io.StringBufferInputStream. (:out (sh "qstat" "-x")))))
        (catch Exception e)))
+
+(defn xattr [j,k]
+  (first (k j)))
+
+(defn xjobid [j]
+  (xattr j :Job_Id))
+
+(defn xname [j]
+  (xattr j :Job_Name))
+
+(defn xnodes [j]
+  (if (= "-" (xprocs j)) (xres j :nodect) "-"))
+
+(defn xowner [j]
+  (xattr j :Job_Owner))

 (defn xpart [j]
   (let [p (first (:content (first (filter #(= (:tag %) :partition) (:Resource_List j)))))]
     (if (nil? p) "-" p)))

-(defn jobinfo [job]
-  (let [j (jobraw job)]
-    {:jobid (xjobid j)
-     :name  (xname  j)
-     :nodes (xnodes j)
-     :owner (xowner j)
-     :part  (xpart  j)
-     :procs (xprocs j)
-     :queue (xqueue j)
-     :rtime (xrtime j)
-     :state (xstate j)
-     :utime (xutime j)}))
+(defn xprocs [j]
+  (let [procs (xres j :procs) ] (if (nil? procs) "-" procs)))

-(defn user []
-  (if (first *command-line-args*)
-    (first *command-line-args*)
-    (get (System/getenv) "USER")))
+(defn xqueue [j]
+  (xattr j :queue))

-(defn mine [u]
-  (filter #(re-matches (re u) (:owner %)) (map #(jobinfo %) (jobs))))
+(defn xres [j,k]
+  (first (:content (first (filter #(= (:tag %) k) (:Resource_List j))))))

-(defn split [u]
-  (let [m (mine u)]
-    {:Q (filter #(= "Q" (:state %)) m)
-     :R (filter #(= "R" (:state %)) m)
-     :C (filter #(= "C" (:state %)) m)}))
+(defn xrtime [j]
+  (xtime j :Resource_List))

-(defn prjob [j]
-  (format fmtstr
-          (re-find (re-matcher #"^\d+" (:jobid j)))
-          (re-find (re-matcher #"^[^@]+" (:owner j)))
-          (:rtime j)
-          (:utime j)
-          (:procs j)
-          (:nodes j)
-          (:state j)
-          (:queue j)
-          (:part j)
-          (:name  j)))
+(defn xstate [j]
+  (xattr j :job_state))

-(defn prhead [msg]
-  (str (format "\n%s\n\n" msg)
-       (format fmtstr "Job ID" "Owner" "Req'd" "Used" "Procs" "Nodes" "S" "Queue" "Partition" "Job Name\n")
-       (format fmtstr (d 8) (d 16) (d 8) (d 8) (d 5) (d 5) (d 1) (d 8) (d 9) (d 32))
-       "\n"))
+(defn xtime [j,k]
+  (first (:content (first (filter #(= (:tag %) :walltime) (k j))))))

-(defn prjobs [key,msg,s]
-  (let [jobs (key s)]
-    (if (empty? jobs)
-      nil
-      (str (prhead msg) (reduce #(str %1 %2) (map #(str (prjob %) "\n") (key s)))))))
+(defn xutime [j]
+  (let [t (xtime j :resources_used)] (if (nil? t) "-" t)))

-(defn show [u]
-  (let [s (split u)]
-    (str (format "\n%s\n" (.toString (java.util.Date.)))
-         (prjobs :Q "QUEUED" s)
-         (prjobs :R "RUNNING" s)
-         (prjobs :C "COMPLETED" s))))
-
-(let [fr (JFrame. (str "qmon " (user)))
+(let [user (myname)
+      fr (JFrame. (str "qmon " user))
       ta (TextArea. "\nLoading..." )]
   (do
     (.setFont ta (Font. "Monospaced" (Font/PLAIN) 12))
@@ -113,5 +121,5 @@
     (doto ta
       (.setEditable false))
     (while true
-      (.setText ta (show (user)))
+      (.setText ta (show user))
       (Thread/sleep 5000))))


Improve comment

Improve comment

--- src/re_frame/interceptor.cljc
+++ src/re_frame/interceptor.cljc
@@ -153,7 +153,8 @@

      {:coeffects {:event event
                   :db    <original contents of app-db>}
-      :effects   {:db    <new value for app-db>}
+      :effects   {:db    <new value for app-db>
+                  :dispatch  [:something]}      ;; example of other effects
       :queue     <a collection of further interceptors>
       :stack     <a collection of interceptors already walked>}


Fix bug where editor cursor could not be moved by clicking

--- src/reabledit/components.cljs
+++ src/reabledit/components.cljs
@@ -138,7 +138,8 @@
                                                   column
                                                   column-key
                                                   row-id)
-      :on-click #(move-to-cell!)
+      :on-click #(if-not edited?
+                   (move-to-cell!))
       :on-double-click #(enable-edit!)}
      (if edited?
        [(or (:editor column) default-editor)


convert drunkard's to canvas

convert drunkard's to canvas

--- src/voke/world/visualize.cljs
+++ src/voke/world/visualize.cljs
@@ -12,14 +12,13 @@

 ;; Constants

-; TODO revisit *all* of these atoms
-; consolidate them and reconcile them with this "visualization state" atom
-
-(def cell-size 10)
 (def grid-width 100)
 (def grid-height 100)
 (def canvas-height 800)
 (def canvas-width 800)
+
+; TODO revisit *all* of these atoms
+; consolidate them and reconcile them with this "visualization state" atom

 (defonce selected-tab (r/atom :drunkard))
 (defonce ms-per-tick (r/atom 16))
@@ -80,11 +79,13 @@
       (.getContext "2d")))

 (defn draw-grid
-  [grid cell-size]
+  [grid]
   (let [ctx (get-ctx)
         width (count (first grid))
-        height (count grid)]
-    (.clearRect ctx 0 0 (* width cell-size) (* height cell-size))
+        height (count grid)
+        cell-width (/ canvas-width width)
+        cell-height (/ canvas-height height)]
+    (.clearRect ctx 0 0 canvas-width canvas-height)

     (set! (.-fillStyle ctx) "#CCC")

@@ -99,7 +100,7 @@

           (doto ctx
             (.beginPath)
-            (.rect (* x cell-size) (* y cell-size) cell-size cell-size)
+            (.rect (* x cell-width) (* y cell-height) cell-width cell-height)
             (.fill)))

         (recur (if (= (dec x) width) 0 (inc x))
@@ -114,23 +115,9 @@
                          @num-iterations
                          @smoothing-passes)
       ::generate/grid
-      (draw-grid (/ canvas-width grid-width))))
+      draw-grid))

 ;; Reagent components
-
-(defn row [a-row y]
-  [:div.row
-   (for [[x cell] (map-indexed vector a-row)]
-     ^{:key ["cell" x y]} [:div.cell {:class (name cell)}])])
-
-(defn grid [visualization-state]
-  [:div.world
-   (conj (for [[y a-row] (map-indexed vector (@visualization-state ::generate/grid))]
-           ^{:key ["row" y]} [row a-row y])
-
-         (when-let [[x y] (@visualization-state ::active-cell)]
-           ^{:key "active-cell"} [:div.cell.active {:style {:left (* cell-size x)
-                                                            :top  (* cell-size y)}}]))])

 (defn slider [an-atom min max step callback]
   (let [_ @an-atom]
@@ -163,8 +150,9 @@
    (when (= @selected-tab :drunkard)
      [:div.drunkard-specific
       [:p (str "Dig until there are " @num-empty-cells " empty cells in the grid")]
-      [:p "(doesn't take effect until the next time you press \"generate\")"]
-      [slider num-empty-cells 10 1000 1]])
+      [slider num-empty-cells 0 1000 50
+       #(draw-grid ((generate/drunkards-walk grid-width grid-height @num-empty-cells)
+                     ::generate/grid))]])

    (when (= @selected-tab :automata)
      [:div.cellular-specific
@@ -186,23 +174,18 @@
       :on-click (fn [e]
                   (.preventDefault e)
                   (condp = @selected-tab
-                    :drunkard (animate-dungeon-history
-                                (generate/drunkards-walk grid-width grid-height @num-empty-cells))
+                    :drunkard (draw-grid ((generate/drunkards-walk grid-width grid-height @num-empty-cells)
+                                           ::generate/grid))
                     :automata (draw-automata-grid!)
                     :final (draw-grid ((generate/automata 400 400 0.45 4 5 400000 12)
-                                        ::generate/grid)
-                                      2)))}
+                                        ::generate/grid))))}
      "generate"]]

-   ; full #333, empty #ccc
-
-   (if (not= @selected-tab :drunkard)
-     [:canvas {:id     "visualization-canvas"
-               :width  canvas-width
-               :height canvas-height
-               :style  {:border           "none"
-                        :background-color "#333"}}]
-     [grid visualization-state])])
+   [:canvas {:id     "visualization-canvas"
+             :width  canvas-width
+             :height canvas-height
+             :style  {:border           "none"
+                      :background-color "#333"}}]])

 ;; Main


test for CLJS-598

test for CLJS-598


added support for parallel task processing

--- test/distillery/core_test.clj
+++ test/distillery/core_test.clj
@@ -134,8 +134,6 @@
                :videos dt/create-video-pages}]
     (dt/long-task
      "Complete run"
-     (doseq
-       [task (vals tasks)]
-       (task job)))))
+     (doall ((dt/map-fn) #(% job) (vals tasks))))))


ported test_morningstar_scraper.py

ported test_morningstar_scraper.py

--- test/flo_invest/core_test.clj
+++ test/flo_invest/core_test.clj
@@ -36,4 +36,8 @@
                   :split_bonus_factor 1.0,
                   :tangible_book_value 17.57009708737864,
                   :total_assets 10329.0e6,
-                  :total_liabilities 4276e6}))))+                  :total_liabilities 4276e6}))))
+
+(deftest  test_data_loads_without_hickups
+  (doseq [testdata (parse-dir "/home/flo/geldanlage/aktienscreen_2013_10_05/data/morningstar/2013_10_05/")]
+    (is (not= {} (load (last  testdata))))))


M0ar tests

M0ar tests

--- test/grimoire/either_test.clj
+++ test/grimoire/either_test.clj
@@ -12,3 +12,17 @@

     (is (either/either? (either/succeed r)))
     (is (either/either? (either/fail r)))))
+
+(deftest simple-with-result-test
+  (is (= \h
+         (either/with-result [x (either/succeed "hax! I call hax!")]
+           (first x)))))
+
+(deftest complex-with-result-test
+  (let [f (fn [x]
+            (either/with-result [a (x)]
+              (either/succeed (inc a))
+              (either/fail (str "Nested falure: " a " In fn " x))))]
+    (is (= (either/succeed 2)
+           (f #(either/succeed 1))))
+    (is (either/fail? (f #(either/fail "Fuck off!"))))))


Commit to fire travis

Commit to fire travis

--- test/parmenides/core_test.clj
+++ test/parmenides/core_test.clj
@@ -102,8 +102,5 @@
                         ids))

      (unleash-the-cupids! conn)
-     ;(println outcome)
-     ;(println (characteristics (d/db conn)))
-     ;(println)
      (= outcome
         (characteristics (d/db conn))))))


Add new errors to corner cases

Add new errors to corner cases

These fail when testing against js/json and js/json-verbose


Fix failing translation tests

Fix failing translation tests

--- umm-spec-lib/src/cmr/umm_spec/core.clj
+++ umm-spec-lib/src/cmr/umm_spec/core.clj
@@ -43,7 +43,7 @@
   "Validates the given metadata and returns a list of errors found."
   [concept-type metadata-standard metadata]
   (if (= metadata-standard :umm-json)
-    (js/validate-umm-json metadata)
+    (js/validate-umm-json metadata concept-type)
     (validate-xml concept-type metadata-standard metadata)))

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


Generate tiles with (save-tiles (gen-tiles 100 (test-image)) "test/resources/")

--- src/mosaic/tile.clj
+++ src/mosaic/tile.clj
@@ -1,28 +1,42 @@
 (ns mosaic.tile
   (import java.io.File)
-  (import java.awt.Color)
+  (import javax.imageio.ImageIO)
   (import java.awt.image.BufferedImage)
-  (import java.awt.image.Raster)
-  (import javax.imageio.ImageIO)
-  (import com.mortennobel.imagescaling.ResampleOp)
-  (import java.awt.Rectangle))
+  (import com.mortennobel.imagescaling.ResampleOp))

-(defn test-mosaic []
+(defn test-image []
   (ImageIO/read
    (File. "test/resources/image.jpg")))

 (defn rescale [x y ^BufferedImage b]
   (. (ResampleOp. x y) (filter b nil)))

-(defn tile-rects [n x y]
-  "divide dimensions x,y into Rectangles of size n
-   omitting regions that are not complete tiles"
-  (for [a (range 0 (- x n -1) n) b (range 0 (- y n -1) n)]
-    (Rectangle. a b n n)))
+(defn grid
+  "Divide region 0,0,x,y into grid squares of size n.
+   Partial grids squares are omitted. Optional parameter
+   s sets the step size to allow for overlapping squares."
+  ([n x y] (grid n x y n))
+  ([n x y s]
+     (for
+	 [a (range 0 (- x n -1) s)
+	  b (range 0 (- y n -1) s)]
+       [a,b,(+ a n),(+ b n)])))

-(defn tile-rasters [n ^BufferedImage b]
-  "divide buffered image into rasters of size n"
-  (let [h (.getHeight b)
-	w (.getWidth b)]
-    (map #(.getData b %) (tile-rects n w h))))
+(defn gen-tiles [n ^BufferedImage b]
+  "Generate tiles of size n from image b.
+   Returns a list of BufferedImages."
+  (map #(.getSubimage b (first %) (second %) n n)
+       (grid 100 (.getWidth b) (.getHeight b))))

+(defn save-image [^BufferedImage b ^String f]
+  "Save a BufferedImage to filename f."
+  (ImageIO/write b "jpg" (File. f)))
+
+(defn tile-names [^String base]
+  "Infinite sequence of tile names."
+  (map #(str base % ".jpg") (range)))
+
+(defn save-tiles [tiles ^String d]
+  "Save tiles (list of BufferedImages) to directory d."
+  (map #(save-image %1 %2) tiles (tile-names d)))
+


Created custom 7 element array clone for seq speedup

--- src/main/cljs/lean_map/core.cljs
+++ src/main/cljs/lean_map/core.cljs
@@ -527,11 +527,14 @@
   (-reduce [coll f] (seq-reduce f coll))
   (-reduce [coll f start] (seq-reduce f start coll)))

+(defn node-arr-clone [arr]
+  #js[(aget arr 0) (aget arr 1) (aget arr 2) (aget arr 3) (aget arr 4) (aget arr 5) (aget arr 6)])
+
 (defn- create-inode-seq [arr lvl nodes cursors data-idx data-len]
   (if (< data-idx data-len)
     (NodeSeq. nil arr lvl nodes cursors (inc data-idx) data-len nil)
-    (let [nodes     (aclone nodes)
-          cursors (aclone cursors)]
+    (let [nodes     (node-arr-clone nodes)
+          cursors (node-arr-clone cursors)]
       (loop [lvl lvl]
         (when (>= lvl 0)
           (let [node-idx (aget cursors lvl)]


Cleaned up comments in dev/world23.

Cleaned up comments in dev/world23.

--- src/pucks/worlds/dev/world23.clj
+++ src/pucks/worlds/dev/world23.clj
@@ -16,16 +16,7 @@
    (assoc (vent) :position [500 100] :solid false)
    (assoc (vent) :position [100 500] :solid false)
    (assoc (vent) :position [266 466] :solid false)
-   (assoc (vent) :position [466 266] :solid false)
-   ]
-  #_(vec (concat
-          #_(for [x (range 100 600 400 #_200)
-                 y (range 100 600 400 #_200)]
-             (assoc (vent) :position [x y] :mobile false :solid false))
-          #_(for [x (range 50 600 100)
-                 y (range 50 600 100)]
-             (assoc (stone) :position [x y] :mobile false))
-          [(assoc (nursery pusher) :position [200 200] :solid false)])))
+   (assoc (vent) :position [466 266] :solid false)]

 (defn settings []
   {:screen-size 600


Sketching on new class page

Sketching on new class page

--- src/tango/cljs/runtime/core.cljs
+++ src/tango/cljs/runtime/core.cljs
@@ -179,6 +179,67 @@
           )))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; CreateClassView
+(defui CreateClassView
+  static om/IQuery
+  (query [_]
+    [])
+  Object
+  (render
+    [this]
+    (let [x 1]
+      ;; - Class name
+      ;; - Adj Panel
+      ;; - Dances
+      ;; - Startlist (participants)
+      (dom/div nil
+        (dom/h2 {:className "sub-header"} "Create new class")
+        (dom/div #js {:className "container"}
+          (dom/div #js {:className "form-horizontal"}
+            (dom/div #js {:className "form-group"}
+              (dom/label #js {:className "col-sm-2 control-label"} "Class name")
+              (dom/div #js {:className "col-sm-8"}
+                (dom/input #js {:className "form-control"
+                                :value     "name"
+                                :id        "clientInputName"})))
+            (dom/div #js {:className "form-group"}
+              (dom/div #js {:className "col-sm-offset-2 col-sm-10"}
+                (dom/button
+                  #js {:className "btn btn-default"
+                       :type      "submit"
+                       :onClick   #()}
+                  "Create")))))
+        ))))
+
+;(dom/div #js {:className "container"}
+;  (dom/h3 nil "Assign this client a name to use it as an Adjudicator device")
+;  (dom/div #js {:className "form-horizontal"}
+;    (dom/div #js {:className "form-group"}
+;      (dom/label #js {:className "col-sm-2 control-label"
+;                      :htmlFor       "clientInputName"} "Client name")
+;      (dom/div #js {:className "col-sm-8"}
+;        (dom/input #js {:className "form-control"
+;                        :value name
+;                        :id        "clientInputName"
+;                        :onChange #(om/transact! this `[(app/set-client-info
+;                                                          {:client/name ~(.. % -target -value)})])})))
+;    (dom/div #js {:className "form-group"}
+;      (dom/div #js {:className "col-sm-offset-2 col-sm-10"}
+;        (dom/button
+;          #js {:className "btn btn-default"
+;               :type      "submit"
+;               :onClick   #(do
+;                            (let [idt (random-uuid)]
+;                              (swap! local-storage assoc :client-id idt)
+;                              (om/transact! this
+;                                            `[(app/set-client-info {:client/id   ~idt
+;                                                                    :client/name ~name})
+;                                              (app/status {:status :loading})
+;                                              :app/status])))}
+;          "Connect")))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; ClassRow

 (defui ClassRow
@@ -220,7 +281,10 @@
         (dom/div nil
           (dom/button #js {:onClick #(om/transact! this `[(class/create {:class/name "New Class"
                                                                          :class/id ~(random-uuid)})
-                                                          :app/selected-competition])} "New"))
+                                                          :app/selected-competition])} "New")
+          (dom/button #js {:onClick #(om/transact! this `[(app/select-page {:selected-page :create-class})
+                                                          :app/selected-page])} "Newer"))
+
         (dom/table
           #js {:className "table"}
           (dom/thead nil
@@ -418,6 +482,8 @@

           :classes ((om/factory ClassesView) (:competition/classes selected-competition))

+          :create-class ((om/factory CreateClassView))
+
           :time-schedule ((om/factory ScheduleView) {:competition/activities
                                                      (:competition/activities selected-competition)
                                                      :selected-activities
@@ -443,7 +509,7 @@
          #js {"Content-Type" "application/transit+json"}))

 (defn remote-send []
-d  (fn [edn cb]
+  (fn [edn cb]
     ;; TODO - seems that om will put togheter both command and query when needed
     ;;  so it should be possible to put them togheter on serverside
     (cond


🔊 Log the request method and URI for uncaught exceptions

--- src/territory_bro/middleware.clj
+++ src/territory_bro/middleware.clj
@@ -21,7 +21,7 @@
     (try
       (handler req)
       (catch Throwable t
-        (log/error t "Uncaught exception")
+        (log/error t "Uncaught exception" (pr-str (select-keys req [:request-method :uri])))
         (-> (internal-server-error "Internal Server Error")
             (response/content-type "text/html; charset=utf-8"))))))


now actually runs the test

now actually runs the test

--- test-cljs/complico/test/dom.cljs
+++ test-cljs/complico/test/dom.cljs
@@ -55,4 +55,5 @@
   (setting-text-on-elem-changes-text)
   (setting-text-on-elem-does-not-alter-child-elem-text)
   (replace-price-case-1)
-  (replace-price-case-2))
+  (replace-price-case-2)
+  (replace-price-should-not-change-text-without-price))


Removed commented out code.

Removed commented out code.

--- test/blutwurst/database_test.clj
+++ test/blutwurst/database_test.clj
@@ -53,8 +53,7 @@
                          :columns
                          ({:name "NAME", :type "VARCHAR", :length 100, :nullable true}
                           {:name "ID", :type "INTEGER", :length 10, :nullable true})})}]
-       (pprint table-graph)
-       ;(pprint (diff expected table-graph))
+       (pprint (diff expected table-graph))

        (is (= expected table-graph)))
    ))


remove db before all tests

remove db before all tests

--- test/mirthsync/fixture_tools.clj
+++ test/mirthsync/fixture_tools.clj
@@ -85,11 +85,13 @@
 (defn ensure-valid-mirth [mirth]
   (cond
     (mirth-unpacked? mirth) (run-with-mirth mirth
-                                            select-jvm-9-options)
+                                            select-jvm-9-options
+                                            remove-mirth-db)
     (mirth-tgz-here? mirth) (run-with-mirth mirth
                                             validate-mirth
                                             unpack-mirth
-                                            select-jvm-9-options)
+                                            select-jvm-9-options
+                                            remove-mirth-db)
     :else (run-with-mirth mirth
                           download-mirth
                           validate-mirth


It works :)

It works :)

--- test/onyx/coordinator/linear.clj
+++ test/onyx/coordinator/linear.clj
@@ -143,9 +143,8 @@
   (let [cluster-val @cluster
         n (count cluster-val)
         victim (nth (keys cluster-val) (rand-int n))]
-    (let [pulse (extensions/read-place (:sync components) victim)]
-      (prn "~>" victim)
-      (extensions/delete (:sync components) (:pulse victim))
+    (let [pulse (:pulse (extensions/read-place (:sync components) victim))]
+      (extensions/delete (:sync components) pulse)
       (future-cancel (get cluster-val victim))
       (swap! cluster dissoc victim))))


Remove comment and add SPScrapeTripReport to get-implementation.

--- project/scrape-trs/src/scrape_trs/core.clj
+++ project/scrape-trs/src/scrape_trs/core.clj
@@ -1,36 +1,13 @@
 (ns scrape-trs.core
-  (:require [scrape-trs.cascade-climbers.core :as cc]))
-
-(comment
-  "TODO:
-   - add SPScrapeTripReport
-   - upgrade get-trip-reports to return [errors, trip-reports]
-     based on try-slurp that returns [error, contents]
-   - add docs and tests for get-trip-reports
-   - implement save-trip-reports!
-   - make scrape-wa-trs project that
-       retrieves cc.com tr list pages for each region in WA (POST)
-       retrieves sp.com tr list page for WA
-       get-trip-reports on each page and concat all together
-       save to csv"
-
-  (def cascade-climbers-washington-regions
-    #{"Alpine Lakes"
-      "Central/Eastern  Washington"
-      "Columbia River Gorge"
-      "Ice Climbing Forum"
-      "Mount Rainier NP"
-      "North Cascades"
-      "Olympic Peninsula"
-      "Rock Climbing Forum"
-      "Southern WA Cascades"
-      "the *freshiezone*"}))
+  (:require [scrape-trs.cascade-climbers.core :as cc]
+            [scrape-trs.summitpost.core :as sp]))

 (defn get-implementation
   [url]
   (let [base-url (re-find #"https?://.*?/" url)]
     (condp = base-url
-      cc/base-url (cc/->CCScrapeTripReport))))
+      cc/base-url (cc/->CCScrapeTripReport)
+      sp/base-url (sp/->SPScrapeTripReport))))

 (defn get-trip-reports
   ""


Fix error message in if-let

Fix error message in if-let

--- data/core.clj
+++ data/core.clj
@@ -1108,7 +1108,7 @@
   `(do (when-not ~(first pairs)
          (throw (ex-info
                  (str (first ~'&form) " requires " ~(second pairs))
-                 {})))
+                 {:form ~'&form})))
      ~(let [more (nnext pairs)]
         (when more
           (list* `assert-args more)))))


[#3092] Adapt backend to uppercase default groups

so backend could work with:
`Main` or `main`
`Transformations` or `transformations`
`Metadata` or `metadata`

--- backend/src/akvo/lumen/lib/transformation/derive.clj
+++ backend/src/akvo/lumen/lib/transformation/derive.clj
@@ -67,12 +67,17 @@
                                                           (first
                                                            (filter
                                                             (fn [c]
-                                                              (and (or (= column-ref1 (:groupName c))
-                                                                       (and (engine/is-derived? (:columnName c))
-                                                                            (= column-ref1 "Transformations"))
-                                                                       (and (contains? flow-metadata-questions (:columnName c))
-                                                                            (= column-ref1 "Metadata")))
-                                                                   (= column-ref2 (:title c)))) columns)))
+                                                              (let [column-ref1 (if (= column-ref1 "Main")
+                                                                                nil
+                                                                                (if (contains? #{"Metadata" "Main" "Transformations"} column-ref1)
+                                                                                (str/lower-case column-ref1)
+                                                                                column-ref1))]
+                                                                (and (or (= column-ref1 (:groupName c))
+                                                                         (and (engine/is-derived? (:columnName c))
+                                                                              (= column-ref1 "transformations"))
+                                                                         (and (contains? flow-metadata-questions (:columnName c))
+                                                                              (= column-ref1 "metadata")))
+                                                                     (= column-ref2 (:title c))))) columns)))
                                                          (let [results (filter (fn [c] (= column-ref1 (:title c))) columns)]
                                                            (if (> (count results) 1)
                                                              (throw (ex-info (format "There is more than one column with this name: '%s', Js code needs to reference the column with the group. Eg: row['Transformations']['%s']" column-ref1 column-ref1)
@@ -132,18 +137,26 @@
        (map (fn [[i]] (db.tx.derive/delete-row conn (merge {:rnum i} opts))))
        doall))

+(defn adapt-groups-letter-case [main groups]
+  (cond-> groups
+    (get groups "transformations") (assoc "Transformations" (get groups "transformations"))
+    (get groups "metadata") (assoc "Metadata" (get groups "metadata"))
+    true (assoc "Main" main "main" main)))
+
 (defn columns-groups [columns]
   (let [groups (group-by :groupName columns)
         flow-groups (not-empty (dissoc groups nil))
         no-flow-qg (get groups  nil)
+        main-group (filter #((complement engine/is-derived?) (:columnName %)) (get groups nil))
         tx-group (when-let [txs (not-empty (filter #(engine/is-derived? (:columnName %)) no-flow-qg))]
-                   {"Transformations" txs })
+                   {"transformations" txs })
         mt-group (when-let [mts (not-empty (filter #(contains? flow-metadata-questions (:columnName %)) no-flow-qg))]
-                   {"Metadata" mts})]
+                   {"metadata" mts})]
     (when (or flow-groups tx-group mt-group)
       (->> (merge flow-groups
                   tx-group
                   mt-group)
+           (adapt-groups-letter-case main-group)
            (reduce (fn [c [k v]]
                      (assoc c k (map (comp keyword :columnName) v))) {})))))


Remove sidebar

Remove sidebar

--- src-cljs/frontend/components/app.cljs
+++ src-cljs/frontend/components/app.cljs
@@ -162,9 +162,6 @@
                                   (flash/flash-notification {:react-key number} message))})]]

             [:.below-top
-             (when (and (not outer?) logged-in?)
-               (build-legacy aside/aside-nav (dissoc app-without-container-data :current-build-data)))
-
              (factory props)]]))))))

 (def wrapper (om-next/factory Wrapper))


Improve sample

Improve sample

--- sample.clj
+++ sample.clj
@@ -1,5 +1,13 @@
+((("test")))

-(def sample-str "Hello str")
+[nil nil]
+#{nil "test"}

-(defn sample-fn [a b]
-  (str sample-str (+ a b)))
+[\a \newline \u2354 2/4 35.07e5 :keyw :aoeu/eto]
+
+(. thess cho-ec?)
+(.ou)
+
+
+;; ["test"]
+;; some comment here


CLJS-255: fix counting LazySeq

CLJS-255: fix counting LazySeq

(count (lazy-seq nil)) now correctly evaluates to 0.

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -606,10 +606,11 @@

 (declare counted?)

-(defn- accumulating-seq-count [coll acc]
-  (if (counted? coll) ; assumes nil is counted, which it currently is
-    (+ acc (-count coll))
-    (recur (next coll) (inc acc))))
+(defn- accumulating-seq-count [coll]
+  (loop [s (seq coll) acc 0]
+    (if (counted? s) ; assumes nil is counted, which it currently is
+      (+ acc (-count s))
+      (recur (next s) (inc acc)))))

 (defn count
   "Returns the number of items in the collection. (count nil) returns
@@ -617,7 +618,7 @@
   [coll]
   (if (counted? coll)
     (-count coll)
-    (accumulating-seq-count coll 0)))
+    (accumulating-seq-count coll)))

 (declare indexed?)


* src/cljs/cljs/core.cljs: single argument cases for array-seq and prim-seq

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -459,12 +459,18 @@
   IHash
   (-hash [coll] (hash-coll coll)))

-(defn prim-seq [prim i]
-  (when-not (zero? (.-length prim))
-    (IndexedSeq. prim i)))
-
-(defn array-seq [array i]
-  (prim-seq array i))
+(defn prim-seq
+  ([prim]
+     (prim-seq prim 0))
+  ([prim i]
+     (when-not (zero? (.-length prim))
+       (IndexedSeq. prim i))))
+
+(defn array-seq
+  ([array]
+     (prim-seq array 0))
+  ([array i]
+     (prim-seq array i)))

 (extend-type array
   ISeqable


Get a write lock at the beginning of the promotion process.

I believe this might fix #100 now that we have the busy timeout set as
per 7d5f342. If a promotion is in process, the RESERVED lock will
allow reads to go through but cause writes to block until the
transaction is complete according to http://www.sqlite.org/lockingv3.html

--- src/clojars/promote.clj
+++ src/clojars/promote.clj
@@ -107,6 +107,8 @@

 (defn promote [{:keys [group name version] :as info}]
   (korma/transaction
+   ;; grab a write lock so uploads don't rewrite jars out from under us
+   (korma/do-query "PRAGMA locking_mode = RESERVED")
    (println "checking" group "/" name "for promotion...")
    (let [blockers (blockers info)]
      (if (empty? blockers)


CMR-2362: Reset to use in-memory db

CMR-2362: Reset to use in-memory db

--- dev-system/dev/user.clj
+++ dev-system/dev/user.clj
@@ -41,8 +41,8 @@
   ;; MAKE SURE YOU DISABLE SYMANTEC ANTIVIRUS BEFORE STARTING THE TESTS WITH EXTERNAL DB
   ;; Renable them when you're done

-  ; (system/set-dev-system-db-type! :in-memory)
-  (system/set-dev-system-db-type! :external)
+  (system/set-dev-system-db-type! :in-memory)
+  ; (system/set-dev-system-db-type! :external)

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


Correct date formatting.

Correct date formatting.

--- src/defragment/feed.clj
+++ src/defragment/feed.clj
@@ -77,7 +77,7 @@
   [link dirname]
   (->>   dirname
          (process-dir link)
-         (sort-by :date)
+         (sort-by :title)
          reverse))

 ;; TODO: move to utlilza
@@ -93,7 +93,7 @@
 (defn format-item
   "logentry comes in from the view as :key date, :id guid, :value message.
    Change these to XML item elements for RSS feed."
-  [{:keys [file show date link fdate title artist]}]
+  [{:keys [file show date link date title artist]}]
   (let [full-title (umisc/inter-str " - " [artist title])]
     (xml/element :item {}
                  (xml/element :title {}
@@ -120,7 +120,7 @@
                  (xml/element :itunes:block {}
                               "no"             )
                  (xml/element :pubDate {}
-                              fdate)
+                              date)
                  (xml/element :link {}  link)
                  (xml/element :guid {:isPermaLink "false"}
                               link))))
@@ -129,7 +129,8 @@

 (defn xml-feedify
   [rss-file-self items]
-  (let [last-date (-> items first :date)]
+  (let [last-date (-> items first :date)
+        formatted-items (map format-item items)]
     (xml/emit-str
      (xml/element
       :rss
@@ -166,7 +167,7 @@
                           {:href rss-file-self
                            :rel "self"
                            :type "application/rss+xml"})
-             items)))))
+             formatted-items)))))

 (defn make-feed!
   [{:keys [out-oggs-path rss-base-url rss-self-url rss-out-file]}]
@@ -174,7 +175,6 @@
   (log/info "making feed" out-oggs-path rss-base-url rss-self-url " --> " rss-out-file)
   (->> out-oggs-path
        (get-files rss-base-url)
-       (map format-item)
        (xml-feedify rss-self-url)
        (spit rss-out-file)))

@@ -184,9 +184,6 @@

   ;; TODO: get the files, get list of shows in it, get all the feeds for those shows

-  (->> "/mnt/sdcard/tmp/out"
-       (make-feed nil)
-       (spit "/tmp/foo.xml"))

   (log/set-level! :trace)

@@ -194,5 +191,17 @@

   (urepl/massive-spew "/tmp/foo.edn" *1)

+  (-> "resources/test-config.edn"
+      slurp
+      edn/read-string
+      make-feed!)
+
+
+  (let [{:keys [out-oggs-path rss-base-url]}  (-> "resources/test-config.edn"
+                                                  slurp
+                                                  edn/read-string)]
+    (->> (get-files rss-base-url out-oggs-path)
+         (urepl/massive-spew "/tmp/foo.edn")))
+

   )


Moving data persistance layer to datomic. Nothing works yet

--- src/shurly/data.clj
+++ src/shurly/data.clj
@@ -1,15 +1,42 @@
-(ns shurly.data)
+(ns shurly.data
+  (:require [datomic.api :as d]
+            [environ.core :refer [env]]))

-(def ^:private urls (atom {}))
+(def uri (env :datomic-url))

-(defn- get-target [slug]
-  (get-in @urls [(keyword slug) :target]))
+(def schemas [[{:db/id #db/id[:db.part/db]
+                :db/ident :rule/url
+                :db/valueType :db.type/string
+                :db/cardinality :db.cardinality/one
+                :db/doc "The destination URL of a redirect rule"
+                :db.install/_attribute :db.part/db}]
+              [{:db/id #db/id[:db.part/db]
+                :db/ident :rule/slug
+                :db/valueType :db.type/string
+                :db/cardinality :db.cardinality/one
+                :db/doc "The slug for the redirect rule"
+                :db.install/_attribute :db.part/db}]])

-(defn store-slug! [slug target]
-  (if-not (get-target slug)
-    (swap! urls #(assoc %1 (keyword slug) {:target target :redirects 0}))))
+;; Create database and define schema
+(defn create []
+  (d/create-database uri)
+  (let [conn (d/connect uri)]
+    (map #(d/transact conn %1) schemas)))

-(defn request-redirect! [slug]
-  (when-let [target (get-target slug)]
-    (swap! urls #(update-in %1 [(keyword slug) :redirects] (fnil inc 0)))
-    target))
+(defn delete []
+  (d/delete-database uri))
+
+(defn recreate []
+  (delete)
+  (create))
+
+(defn conn []
+  (d/connect uri))
+
+(defn db []
+  (d/db (conn)))
+
+;; Wrapper for the query interface
+(def q #(d/q % (db)))
+(def t #(d/transact (conn) %))
+


Missed one docstring.

Missed one docstring.

--- src/geschichte/data.clj
+++ src/geschichte/data.clj
@@ -14,8 +14,9 @@
      :removals-b (first base-b)
      :additions-b (second base-b)}))

-(defn atom? [x]
+(defn atom?
   "Determines whether atomic places conflict."
+  [x]
   (not (or (seq? x) (vector? x) (map? x) (set? x) (nil? x))))

 (defn- gensym-nils [diff]


Ouch, glömde bytaf il.w

Ouch, glömde bytaf il.w

--- src/loudmoauth/core.clj
+++ src/loudmoauth/core.clj
@@ -2,14 +2,9 @@
   (:require [clojure.core.async :as a]
             [loudmoauth.authflow :as lma]))

-;TODO - Deal with errors and exceptions
-;TODO - Deal with missing :redirect-uri key, if that is possible?
-;TODO - Go over doc strings one more time.
-;TODO - How do we support several service-providers at the same time?
-
-;This is the handlers function to call after receiving callback to specified url.
-;TODO - Deal with cases where token is nil. If so don't put on channel.
-;TODO - What do we return here?
+;We need to identify what provider we are coming from here?
+;Together with the code do we get our state? That's our key so that's good.
+;But how do we map a key to another key provided by our users.
 (defn parse-code
   "Parse code from http-response and deliver promise."
   [response]
@@ -20,13 +15,14 @@
       :code
       (a/>! lma/code-chan))))

+;Here we pass the name of our provider, :spotify or "spotify" or whatever
 (defn refresh-token
   []
   "In case of emergency token refresh, we supply this function."
   (lma/get-tokens @lma/app-state))

 (defn init
-  "Init ouath token request cycle."
+  "Init oauth token request cycle."
   []
   (let [old-app-state @lma/app-state]
     (->>
@@ -36,13 +32,15 @@
       (reset! lma/app-state))))

 ;This is the handlers function to retrieve different kinds of dialog pages, nescessary for identification.
+;Here we could be creative and add our key in the metadata of the interaction url or just return a map instead with our key and url.
 (defn user-interaction
   "Prompt for user interaction."
   []
   (if-let [interaction-url (a/poll! lma/interaction-chan)]
     interaction-url
     "No user interaction nescessary."))
-
+
+;We can totally get away with only rewriting this namespace, just make each function take a keyword as argument, no argument, give us first in list.
 (defn set-oauth-params
   "Set oauth-parameters for use in call to get token"
   [params]
@@ -56,6 +54,7 @@
       (lma/add-encoded-auth-string)
       (reset! lma/app-state))))

+;Here we either supply our key or don't. If no key, just return (first tokens)
 (defn oauth-token
   "Retreive oauth token for use in authentication call"
   []


Add integrant system config to dev-extras

--- lib.app.dev/src/dev_extras.clj
+++ lib.app.dev/src/dev_extras.clj
@@ -18,12 +18,19 @@

 (proxy-ns integrant.repl clear halt prep init reset reset-all)

-(def system integrant.repl.state/system)
+(defmacro ^:private watch-var
+  [s alias]
+  `(do
+     (def ~alias ~s)
+     (add-watch (var ~s)
+                (keyword "dev-extras" ~(name alias))
+                (fn [_# _# _# new#]
+                  (alter-var-root
+                    (var ~alias)
+                    (constantly new#))))))

-(add-watch #'integrant.repl.state/system
-           ::system-watcher
-           (fn [_ _ _ new]
-             (alter-var-root #'system (constantly new))))
+(watch-var integrant.repl.state/system system)
+(watch-var integrant.repl.state/config system-config)

 (defn go []
   (let [res (integrant.repl/go)]


log to determine how the champion information is being obtained

--- src/mimic/champions.clj
+++ src/mimic/champions.clj
@@ -1,14 +1,26 @@
 (ns mimic.champions
-  (:require [clojure.java.io :as io])
+  (:require [clojure.java.io :as io]
+            [environ.core :refer [env]]
+            [clj-lolapi.query :as query]
+            [taoensso.timbre :refer [info]])
   (:import (java.io PushbackReader)))

 (defonce champions-db
-  (with-open
-    [in (PushbackReader. (-> "champions.edn"
-                             io/resource
-                             io/reader))]
-    (read in)))
+  (if (env :riot-api-key)
+    (do
+      (info "Using Riot API Key")
+      (query/static "na" ["champion"]))
+    (with-open
+      [in (PushbackReader. (-> "champions.edn"
+                               io/resource
+                               io/reader))]
+      (info "Using dev-resources: champions.edn")
+      (read in))))

 (def champions-by-name
   "Returns an array containing all champions"
-  (sort (map name (keys champions-db))))+  (->> champions-db
+       :data
+       keys
+       (map name)
+       sort))


predict-3

--- src/paulkrake/goals.clj
+++ src/paulkrake/goals.clj
@@ -2,6 +2,8 @@
   (:require [paulkrake.score :as s]
             [paulkrake.predict :as p]
             [paulkrake.spielplan :as sp]
+            [paulkrake.shots :as shots]
+            [paulkrake.goals-per-shots :as gps]
             [incanter.distributions :as d]))

 (defn goals-to-score-fn
@@ -39,3 +41,17 @@
         (reduce (fn [a i] (new-rating-goals a
                                            (sp/spieltag 1415 i)))
                 x (range 1 spieltag-nr))))
+
+
+(defn predict-3
+  ([shots-data gps-data games]
+     (predict-3 shots-data gps-data games 1.0))
+  ([shots-data gps-data games faktor-sigma]
+
+     (as-> games x
+           (map (fn [[ h g]]
+
+                  (let [[_ _ [shots-hmin shots-hmax] [shots-gmin shots-gmax]] (p/predict-single-game shots-data h g faktor-sigma shots/score-to-shots-fn)
+                        [_ _ [gps-hmin gps-hmax] [gps-gmin gps-gmax]] (p/predict-single-game gps-data h g faktor-sigma gps/score-to-gps-fn)]
+                    [h g [(* shots-hmin gps-hmin 1/100) (* shots-hmax gps-hmax 1/100)] [(* shots-gmin gps-gmin 1/100) (* shots-gmax gps-gmax 1/100)] ])) x)
+           (map (fn [[h g [hmin hmax] [gmin gmax]]] (format "%24s - %24s   [%.2f - %.2f] : [%.2f - %.2f]" h g hmin hmax gmin gmax)) x))))


Extend expiration of long token and improve secret handling

--- src/photon/security.clj
+++ src/photon/security.clj
@@ -25,15 +25,15 @@
 (defn basic-backend [user-info]
   (http-basic-backend {:authfn (basic-auth user-info)}))

-(defn create-token [user]
+(defn create-token [secret user]
   (let [stringify-user
         (-> user
             (update-in [:username] str)
             (update-in [:email] str)
-            (assoc     :exp (time/plus (time/now) (time/seconds 86400))))
+            (assoc     :exp (time/plus (time/now) (time/years 5))))
         token-contents
         (select-keys stringify-user [:permissions :username :email :id :exp])]
-    (jws/sign token-contents "secret" {:alg :hs512})))
+    (jws/sign token-contents secret {:alg :hs512})))

 (defn create-simple-token [tokens user]
   (let [stringify-user
@@ -47,8 +47,8 @@
     (dosync (alter tokens assoc simple-token token-contents))
     simple-token))

-(def jws-token-backend
-  (jws-backend {:secret "secret" :options {:alg :hs512}}))
+(defn jws-token-backend [secret]
+  (jws-backend {:secret secret :options {:alg :hs512}}))

 (defn simple-token-fn [tokens]
   (fn [req token]
@@ -93,7 +93,7 @@
   (token-auth-mw [this]
     (fn [handler]
       (wrap-authentication
-       handler jws-token-backend
+       handler (jws-token-backend secret)
        (token-backend {:authfn (simple-token-fn tokens)}))))
   (auth-credentials-response [this req]
     (let [user          (:identity req)
@@ -103,7 +103,7 @@
       {:id            (:id user)
        :username      (:username user)
        :permissions   (:permissions user)
-       :token         (create-token user)
+       :token         (create-token secret user)
        :simple-token  (create-simple-token tokens user)
        :refreshToken  refresh-token}))
   (qs->token-mw [this]


Update space_age.clj (#455)

Update space_age.clj (#455)

formatting to correspond with test order

--- exercises/practice/space-age/src/space_age.clj
+++ exercises/practice/space-age/src/space_age.clj
@@ -24,10 +24,10 @@
   ;; your code goes here
 )

+(defn on-uranus [] ;; <- arglist goes here
+  ;; your code goes here
+)
+
 (defn on-neptune [] ;; <- arglist goes here
   ;; your code goes here
 )
-
-(defn on-uranus [] ;; <- arglist goes here
-  ;; your code goes here
-)


revert everything back

revert everything back

--- src/clj/rumahsewa141/routes/admin.clj
+++ src/clj/rumahsewa141/routes/admin.clj
@@ -83,9 +83,6 @@
                                         nil
                                         (get-content-fn)))))

-(defn admin-page-test []
-  (layout/render "member.html"))
-
 (defn settings-page [subsection req & [get-content-fn]]
   (admin-page "settings" get-content-fn req subsection))

@@ -93,7 +90,7 @@
   {:allowed (:value (db/get-registration-config))})

 (defroutes admin-routes
-  (GET "/admin" req (admin-page-test))
+  (GET "/admin" req (admin-page "overview" all-users-summary req))
   (GET "/admin/billing" req (admin-page "billing" all-users req))
   (GET "/admin/payment" req (admin-page "payment" all-users req))
   (GET "/admin/manage" req (admin-page "manage" (other-users req) req))


Small fix for edge cases in camel->clojure

--- src/clj_chrome_devtools/impl/util.clj
+++ src/clj_chrome_devtools/impl/util.clj
@@ -3,13 +3,15 @@

 (defn camel->clojure [string]
   (-> string
-      ;; Add dashes before uppercase letters that come after a lowercase letter
-      (str/replace #"([a-z])([A-Z])"
-                   (fn [[_ lower upper]]
-                     (str lower "-" upper)))
-
-      ;; Replace underscores with dashes
+      ;; borrowed from r0man/inflections
+      ;; -------------------------------
+      ;; consoleAPICalled -> console-api-called
+      (str/replace #"([A-Z]+)([A-Z][a-z])" "$1-$2")
+      ;; console1APICalled -> console1-api-called
+      (str/replace #"([a-z\d])([A-Z])" "$1-$2")
+      ;; console api called -> console-api-called
+      (str/replace #"\s+" "-")
+      ;; ;; console_api_called -> console-api-called
       (str/replace #"_" "-")
-
       ;; Lower case everything
       (str/lower-case)))


Check if translator plugin is enabled in site context

--- src/cljs/salava/core/ui/dispatch.cljs
+++ src/cljs/salava/core/ui/dispatch.cljs
@@ -8,12 +8,17 @@
             [salava.resolver]
             [salava.core.ui.helper :refer [current-path]]))

-(session/put! :lang :en)
-
-
 (defn get-ctx []
    (let [core-ctx (aget js/window "salavaCoreCtx")]
      (js->clj (core-ctx) :keywordize-keys true)))
+
+(def ctx (get-ctx))
+
+(session/put! :lang :en)
+
+(session/put! :i18n-editable (some #(= "translator" %1) (get-in ctx [:plugins :all])))
+
+;;;

 (defn resolve-plugin [kind plugin ctx]
@@ -32,13 +37,13 @@

 (defn collect-site-navi []
-  (let [ctx (get-ctx)
-        plugins (get-in ctx [:plugins :all])]
+  (let [plugins (get-in ctx [:plugins :all])]
     {:plugins    plugins
      :routes     (collect-routes plugins ctx)
      :navi-items (collect-navi plugins ctx)}))

 (def site-navi (collect-site-navi))
+

 ;;;


Need to set x,y in entity for first frame

--- desktop/src-common/ds3/enemy.clj
+++ desktop/src-common/ds3/enemy.clj
@@ -54,11 +54,12 @@

 (defn create-mini-entity! [screen ship-texture x y]
   (let [mini-ship (assoc (texture ship-texture)
-            :body (create-mini-body! screen)
-            :translate-x (- (c/screen-to-world 4)) :translate-y (- (c/screen-to-world 6.6))
-            :width mini-size :height mini-size
-            :id :mini-enemy :mini? true :render-layer 70 :score 200
-            :ticks-to-bomb (rand-int default-ticks-first-bomb))]
+                    :body (create-mini-body! screen)
+                    :x x :y y
+                    :translate-x (- (c/screen-to-world 4)) :translate-y (- (c/screen-to-world 6.6))
+                    :width mini-size :height mini-size
+                    :id :mini-enemy :mini? true :render-layer 70 :score 200
+                    :ticks-to-bomb (rand-int default-ticks-first-bomb))]
     (doto mini-ship
       (body! :set-linear-velocity 0 (c/screen-to-world -20.0))
       (body-position! x y 180.0))


Create ".nrepl-port" file instead of "repl-port"

--- src/leiningen/droid/compatibility.clj
+++ src/leiningen/droid/compatibility.clj
@@ -20,8 +20,7 @@
                (io/file destination-dir (.getName ^java.io.File dep))))))

 (defn create-repl-port-file
-  "Creates a file named `repl-port` in target directory with port
-  number inside, so fireplace.vim can connect to the REPL."
-  [{{:keys [repl-local-port]} :android, target-path :target-path :as project}]
-  (ensure-paths target-path)
-  (spit (io/file target-path "repl-port") repl-local-port))
+  "Creates a file named `.nrepl-port` in project directory with port
+  number inside, so that fireplace.vim can connect to the REPL."
+  [{{:keys [repl-local-port]} :android, root :root}]
+  (spit (io/file root ".nrepl-port") repl-local-port))


Made the result object returned by the fetch function no longer convert header names to keywords.

--- src/appengine_magic/services/url_fetch.clj
+++ src/appengine_magic/services/url_fetch.clj
@@ -23,17 +23,16 @@
 			 response-code])

 (defn- parse-headers [headers]
-  (zipmap (map #(keyword (.getName %)) headers)
+  (zipmap (map #(.getName %) headers)
 	  (map #(.getValue %) headers)))

 (defn- make-headers [header-map]
   (map
    (fn [[name-key val]]
-     (com.google.appengine.api.urlfetch.HTTPHeader.
-      (if (keyword? name-key)
-          (.substring (str name-key) 1)
-          (str name-key))
-      val))
+     (HTTPHeader. (if (keyword? name-key)
+                      (.substring (str name-key) 1)
+                      (str name-key))
+                  val))
    header-map))

 (defn- parse-response
@@ -47,11 +46,11 @@
   [url &
    {:keys [method headers payload allow-truncate follow-redirects deadline]
     :or {method :get
-          headers {}
-          payload nil
-          allow-truncate FetchOptions/DEFAULT_ALLOW_TRUNCATE
-          follow-redirects FetchOptions/DEFAULT_FOLLOW_REDIRECTS
-          deadline FetchOptions/DEFAULT_DEADLINE}}]
+         headers {}
+         payload nil
+         allow-truncate FetchOptions/DEFAULT_ALLOW_TRUNCATE
+         follow-redirects FetchOptions/DEFAULT_FOLLOW_REDIRECTS
+         deadline FetchOptions/DEFAULT_DEADLINE}}]
   (let [fetch-options (FetchOptions$Builder/withDefaults)]
     (if allow-truncate
       (.allowTruncate fetch-options)


Have chase delegate still-active?/end

Have chase delegate still-active?/end

The previous implementation discarded any notion of tracking the ending
of underlying effects in the chase; they were assumed to run forever
until the chase itself was ended. Now, they are asked if they are
running, and replaced with blank effects if they end themselves before
the chase itself ends. When the chase is asked to end, it now asks each
constituent effect to end, and will continue running until they all have
done so.

--- src/afterglow/effects.clj
+++ src/afterglow/effects.clj
@@ -395,16 +395,25 @@
              (fn [show snapshot]  ; Ask any remaining active effects to end, record and report results
                (every? false? (swap! active end-still-active [from-effect to-effect] show snapshot))))))

+(defn- bounce-if-needed
+  "If a chanse is operating in bounce mode, expand the vector of
+  effects (or their activity states) to include a reflection of the
+  middle values, so that looping over the expanded list would have the
+  same effect as bouncing back and forth in the original list."
+  [mode values]
+  (vec (if (= mode :bounce) (concat values (butlast (reverse (butlast values)))) values)))
+
 (defn- find-chase-element
   "Look up the effect within a chase corresponding to a given position.
   If the chase is looping, takes the index modulo the number of
   elements; otherwise, if it falls outside the range of elements,
-  returns a [[blank]] effect."
-  {:doc/format :markdown}
-  [position effects looping?]
+  returns a [[blank]] effect. If an actual effect is found, but it is
+  no longer active, return a blank effect instead."
+  {:doc/format :markdown}
+  [position effects active looping?]
   (let [position (if looping? (mod position (count effects)) position)
         i (int (math/floor position))]
-    (get effects i (blank))))
+    (if (get active i false) (get effects i blank-effect) blank-effect)))

 (defn chase
   "Create an effect which moves through a list of other effects based
@@ -432,8 +441,10 @@
   the final effect is reached, the chase begins fading into the first
   effect again, and so on. Similarly, if `position` drops below `1`,
   the chase starts fading in to the final effect. In this mode the
-  chase continues until it is ended by the operator, or `position`
-  resolves to `nil`.
+  chase continues until all of its underlying effects have
+  ended (either on their own, or because they were asked to end by the
+  operator), or `position` resolves to `nil`, which kills it
+  instantly.

   Finally, passing `:bounce` with `:beyond` is similar to `:loop`,
   except that every other repetition of the list of effects is
@@ -455,19 +466,26 @@
   (params/validate-param-type position Number)
   ;; Could optimize for a non-frame-dynamic position, but that is unlikely to ever occur.
   (let [looping? (not= beyond :blank)
-        effects (vec (if (= beyond :bounce) (concat effects (butlast (reverse (butlast effects)))) effects))]
+        bounced-effects (bounce-if-needed beyond effects)
+        active (atom (vec (repeat (count effects) true)))]
     (Effect. chase-name
              (fn [show snapshot]
-               ;; Run as long as position does not resolve to nil, or fall outside a non-looped chase
+               ;; Run as long as position does not resolve to nil, or fall outside a non-looped chase,
+               ;; and the underlying effects are still running.
                (let [v (params/resolve-param position show snapshot)]
                  (and (some? v)
-                      (or looping? (<= 0 v (inc (count effects)))))))
+                      (or looping? (<= 0 v (inc (count bounced-effects))))
+                      (some true? (swap! active update-still-active effects show snapshot)))))
              (fn [show snapshot]
                (let [v (dec (params/resolve-param position show snapshot))
                      fraction (- v (math/floor v))
-                     first-effect (find-chase-element v effects looping?)]
+                     bounced-active (bounce-if-needed beyond @active)
+                     first-effect (find-chase-element v bounced-effects bounced-active looping?)]
                  (if (util/float= 0 fraction)
-                   (generate first-effect show snapshot) ;; We're positioned precisely at one effect; just generate it
-                   (let [next-effect (find-chase-element (inc v) effects looping?)] ;; Fade with next effect
+                   ;; We're positioned precisely at one effect; just generate it
+                   (generate first-effect show snapshot)
+                    ;; We are in between effects, so fade them together
+                   (let [next-effect (find-chase-element (inc v) bounced-effects bounced-active looping?)]
                      (generate-fade first-effect next-effect fraction show snapshot)))))
-             end-immediately)))
+             (fn [show snapshot]  ; Ask any remaining active effects to end, record and report results
+               (every? false? (swap! active end-still-active effects show snapshot))))))


Further parameterization

Further parameterization

--- src-cljs/qcon/main.cljs
+++ src-cljs/qcon/main.cljs
@@ -23,42 +23,42 @@
 (defrecord PutAndTakeSlide [opts]
   Slide
   (init-slide-state [_]
-    (let [bufsize (:buffer-size opts)
-          buf1 (buffer bufsize)
-          chan1 (chan buf1)]
-      {:bufsize bufsize
-       :buf1 buf1
-       :chan1 chan1
-       :default-font (:font-size opts)}))
+    (let [buf (buffer (:buffer-size opts))
+          ch (chan buf)]
+      {:buffer-size (:buffer-size opts)
+       :buf buf
+       :ch ch
+       :default-font (:font-size opts)
+       :radius (:radius opts)}))
   (render-slide [_ data owner]
-    (let [bufsize (om/get-state owner :bufsize)
-          buf1 (om/get-state owner :buf1)
-          chan1 (om/get-state owner :chan1)
-          default-font (om/get-state owner :default-font)]
+    (let [bufsize (om/get-state owner :buffer-size)
+          buf (om/get-state owner :buf)
+          ch (om/get-state owner :ch)
+          default-font (om/get-state owner :default-font)
+          radius (om/get-state owner :radius)]
       [:div
        [:svg {:version "1.1" :width 800 :height 600}
-
         [:g {:transform "translate(70,65)"
              :onClick (fn [_]
                         (go
-                          (>! chan1 (str (rand-int 10)))
+                          (>! ch (str (rand-int 10)))
+                          ;; Forces a re-render
                           (om/set-state! owner :modified (new js/Date))))}

          [:rect {:x 0 :y 0 :width 140 :height 100 :fill "black"}]
          [:text {:x 30 :y 80 :style {:font-size default-font :stroke "white" :fill "white"}} ">!"]]

         (for [x (range bufsize)]
-          (let [radius 50]
-            [:g {:transform (str "translate(320,320)")}
-             [:g {:transform (str "rotate(" (- (* (- x (/ bufsize 2) (- 1)) (/ 180 bufsize))) ") translate(200)")}
-              [:circle {:cx 0 :cy radius :r radius :style {:fill "#224"}}]
-              [:text {:x (- 0 (/ radius 2) 5) :y (* 1.7 radius) :style {:font-size default-font :fill "white"}}
-               (str (aget (.-arr (.-buf buf1)) (mod (+ x (.-head (.-buf buf1))) bufsize)))]]]))
+          [:g {:transform (str "translate(320,320)")}
+           [:g {:transform (str "rotate(" (- (* (- x (/ bufsize 2) (- 1)) (/ 180 bufsize))) ") translate(200)")}
+            [:circle {:cx 0 :cy radius :r radius :style {:fill "#224"}}]
+            [:text {:x (- 0 (/ radius 2) 5) :y (* 1.7 radius) :style {:font-size default-font :fill "white"}}
+             (str (aget (.-arr (.-buf buf)) (mod (+ x (.-head (.-buf buf))) bufsize)))]]])

         [:g {:transform "translate(70,475)"
              :onClick (fn [_]
                         (go
-                          (<! chan1)
+                          (<! ch)
                           (om/set-state! owner :modified (new js/Date))))}
          [:rect {
                  :x 0 :y 0 :width 140 :height 100 :fill "black"}]
@@ -86,7 +86,7 @@
           {:title "Quick tutorial"}

           {:subtitle "put and take"
-           :custom (PutAndTakeSlide. {:buffer-size 7 :font-size "72pt"})}
+           :custom (PutAndTakeSlide. {:buffer-size 7 :font-size "72pt" :radius 50})}

           {:title "Buffers"
            :code "(<! (chan))"}


Couple of TODOs added to mark the refactoring parts of websocket component

--- src/clj/hellhound/components/websocket.clj
+++ src/clj/hellhound/components/websocket.clj
@@ -48,7 +48,9 @@
   ([event-msg-handler web-server-adapter]
    (new-channel-socket-server event-msg-handler web-server-adapter {}))
   ([event-msg-handler web-server-adapter options]
+   ;; TODO: Refactor this `let` statement
    (let [opts (merge {:packer  (packer/->TransitPacker :json {} {})
+                      ;; TODO: Use something elegant instead of the epoch time for uids
                       :user-id-fn  (fn [_] (str (quot (System/currentTimeMillis) 1000)))}
                      options)]
      (map->WebSocketServer {:web-server-adapter web-server-adapter


Codingame - APU: Init Phase solved

Codingame - APU: Init Phase solved

--- src/clojureplayground/codingame_helper.clj
+++ src/clojureplayground/codingame_helper.clj
@@ -10,30 +10,30 @@
 (defn allowed-lines [theta]
   (first
     (for [t [[#(<= % (/ Math/PI 8)) [(co 1 0 "E") (co 1 0 "E") (co -1 0 "W") (co -1 0 "W")]]
-           [#(and (> % (/ Math/PI 8)) (<= % (* Math/PI 0.375))) [(co 1 1 "SE") (co 1 -1 "NE") (co -1 1 "SW") (co -1 -1 "NW")]]
-           [#(and (> % (* Math/PI 0.375)) (<= % (/ Math/PI 2))) [(co 0 1 "S") (co 0 -1 "N") (co 0 1 "S") (co 0 -1 "N")]]]
-        :when ((first t) theta)] (second t))))
+             [#(and (> % (/ Math/PI 8)) (<= % (* Math/PI 0.375))) [(co 1 1 "SE") (co 1 -1 "NE") (co -1 1 "SW") (co -1 -1 "NW")]]
+             [#(and (> % (* Math/PI 0.375)) (<= % (/ Math/PI 2))) [(co 0 1 "S") (co 0 -1 "N") (co 0 1 "S") (co 0 -1 "N")]]]
+          :when ((first t) theta)] (second t))))

 (defn thor-move2 [adj opp theta]
   ((allowed-lines theta) (direction adj opp)))

 ;APU: Init Phase
 (let [inp ["00" "0."]
-      node? #(when (= \0 (.charAt %2 %)) %)
-      nright #(let [x (.indexOf % %2)]
-               (if (>= x 0) [x %3] [-1 -1]))
-      nbottom #()]
-  (map-indexed (fn [y row]
-                 (map-indexed (fn [x c]
-                                (when (node? c x)
-                                  (let [ntb (nbottom (drop (inc y) inp))
-                                        ntr (nright row (inc x) y)]))) row)) inp))
+      neighr (fn [x y row]
+               (let [nx (.indexOf row "0" (inc x))]
+                 (if (>= nx 0) [nx y] [-1 -1])))
+      neighb (fn [x y in]
+               (reduce (fn [[_ _ cnt] i]
+                         (if (= \0 (.charAt i x))
+                           (reduced [x cnt])
+                           [-1 -1 (inc cnt)])) [-1 -1 (inc y)] (drop (inc y) in)))]
+  (map #(clojure.string/join " " %)
+       (filter some?
+               (apply concat
+                      (map-indexed (fn [y row]
+                                     (map-indexed (fn [x c]
+                                                    (when (= c \0)
+                                                      (let [[x1 y1] (neighr x y row)
+                                                            [x2 y2] (neighb x y inp)] [x y x1 y1 x2 y2]))) row)) inp)))))

-
-
-
-
-
-
-


Adapt to leiningen-core-preview6

Adapt to leiningen-core-preview6

- change lein newnew version
- adapt code

--- ccw.leiningen/src/clj/ccw/leiningen/util.clj
+++ ccw.leiningen/src/clj/ccw/leiningen/util.clj
@@ -193,22 +193,19 @@
          ->files
          "Generate a file with content. path can be a java.io.File or string.\n   It will be turned into a File regardless. Any parent directories will\n   be created automatically. Data should include a key for :name so that\n   the project is created in the correct directory"
          [{:keys [name], :as data} & paths]
-         (let
-           [normalized-name (normalize-project-name name)]
-           (.mkdir (io/file (System/getProperty "user.dir")))
-           (doseq
-             [path paths]
-             (if
-               (string? path)
-               (.mkdirs (template-path normalized-name path data))
-               (let
-                 [[path content]
-                  path
-                  path
-                  (template-path normalized-name path data)
-                  path (io/file (System/getProperty "user.dir") path)]
-                 (.mkdirs (.getParentFile path))
-                 (io/copy content (io/file path))))))))))
+         (.mkdir (io/file (System/getProperty "user.dir")))
+         (doseq
+           [path paths]
+           (if
+             (string? path)
+             (.mkdirs (template-path name path data))
+             (let
+               [[path content] path
+                path (template-path name path data)
+                path (io/file (System/getProperty "user.dir") path)
+                ]
+               (.mkdirs (.getParentFile path))
+               (io/copy content (io/file path)))))))))

 (defn lein-new [location & args]
   (let [project-map (lein-project :project-less
@@ -218,7 +215,7 @@
                           `(-> '~p
                              (leiningen.core.project/add-profiles
                                '{:user
-                                 ~'{:plugins [[lein-newnew "0.2.6"]]}})
+                                 ~'{:plugins [[lein-newnew "0.3.1"]]}})
                              (leiningen.core.project/merge-profiles
                                [:user])))))]
     (monkey-patch-lein-new :project-less)


Format commit date correctly

Format commit date correctly

--- src/tyranitar/store.clj
+++ src/tyranitar/store.clj
@@ -1,6 +1,8 @@
 (ns tyranitar.store
   (:require [cheshire.core :as json]
-            [clj-time.core :as time]
+            [clj-time
+             [core :as time]
+             [format :as fmt]]
             [clojure.java.io :refer [as-file]]
             [clojure.string :as str]
             [clojure.tools.logging :refer [debug error warn]]
@@ -222,7 +224,7 @@
   [application environment tree]
   (try
     (let [repo-name (repo-name application environment)
-          date (str (time/now))
+          date (fmt/unparse (fmt/formatters :date-time-no-ms) (time/now))
           info {:date date :email "mixradiobot@gmail.com" :name "Mix Radio Bot"}
           options {:author info :committer info :parents []}
           response (data/create-commit organisation repo-name "Initial commit" tree options)]


get snapshot_id that matches the current release

--- src/wb_es/web/setup.clj
+++ src/wb_es/web/setup.clj
@@ -39,7 +39,18 @@
                   (flush)
                   (Thread/sleep interval))))))))))

-
+(defn get-snapshot-id
+  []
+  (let [response (http/get (format "%s/_cat/snapshots/s3_repository?format=json" es-base-url))
+        all-snapshots (json/parse-string (:body response) true)]
+    (->> all-snapshots
+         (filter (fn [snapshot]
+                   (and
+                    (= "SUCCESS" (:status snapshot))
+                    (let [id-pattern (re-pattern (format "snapshot_%s(_\\d+)?" release-id))]
+                      (re-matches id-pattern (:id snapshot))))))
+         (first)
+         (:id))))

 ;; (let [
 ;;       response
@@ -60,7 +71,9 @@
   "I don't do a whole lot ... yet."
   [& args]
   (let [index-id release-id]
-    (if (has-index index-id)
-      (println (format "Index %s found, starting server..."))
-      (do
-        ))))
+    (do
+      (es-connect)
+      (if (has-index index-id)
+        (println (format "Index %s found, starting server..."))
+        (do
+          )))))


add a table in a table

add a table in a table

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/editor/ui.cljs
+++ src/aurora/editor/ui.cljs
@@ -265,12 +265,17 @@
 (defn ref-menu [step & [cb]]
   (fn [e]
     (when (mutable? step)
-      (show-menu! e (for [ref (refs-in-scope (current :page) (current :step))]
-                      {:label (subs ref 0 5)
-                       :action (fn []
-                                 (swap! step (constantly (ref-id ref)))
-                                 (when cb
-                                   (cb)))})))))
+      (show-menu! e (concat [{:label "table!"
+                              :action (fn []
+                                        (swap! step (constantly (table)))
+                                        (when cb
+                                           (cb)))}]
+                            (for [ref (refs-in-scope (current :page) (current :step))]
+                              {:label (subs ref 0 5)
+                               :action (fn []
+                                         (swap! step (constantly (ref-id ref)))
+                                         (when cb
+                                           (cb)))}))))))

 (defmethod item-ui :ref/id [step]
   (dom
@@ -341,12 +346,7 @@
                         (add-step|swap! cursor "foo"))}
     "string"]
    [:button {:onClick (fn []
-                        (add-step|swap! cursor {"headers" ["a" "b"]
-                                                "columns" [{:type :ref/js
-                                                            :js "aurora.runtime.table.identity_column"}
-                                                           {:type :ref/js
-                                                            :js "aurora.runtime.table.identity_column"}]
-                                                "rows" [[1 2] [3 4]]}))}
+                        (add-step|swap! cursor (table)))}
     "table"]])

 (defdom ref-inserter [page cursor]
@@ -565,48 +565,37 @@
                 (pr-str x)]
    :else [:span (pr-str x)]))

+(defn cell [x parser]
+  (let [path (cursor->path x)
+        commit (fn [e]
+                 (swap! x (constantly (parser (.-target.value e))))
+                 (remove-input! path))]
+    (dom
+     (if (input? path)
+       [:input {:type "text"
+                :className "focused"
+                :style #js {"width" (* 10 (count (str @x)))}
+                :defaultValue @x
+                :onKeyPress (fn [e]
+                              (when (= 13 (.-charCode e))
+                                (commit e)))
+                :onBlur commit}]
+       [:span {:className "value"
+               :onContextMenu (ref-menu x)
+               :onClick (fn [e]
+                          (when (mutable? x)
+                            (add-input! path true)))}
+        (str @x)]))))
+
 (defn build-rep-cache [state]
   (assoc-in state [:cache :representations]
             {"math" math-ui
              "rect" (fn [x]
                       )
              "number" (fn [x]
-                        (let [path (cursor->path x)]
-                          (dom
-                           (if (input? path)
-                             [:input {:type "text"
-                                      :className "focused"
-                                      :style #js {"width" (* 10 (count (str @x)))}
-                                      :defaultValue @x
-                                      :onKeyPress (fn [e]
-                                                    (when (= 13 (.-charCode e))
-                                                      (swap! x (constantly (reader/read-string (.-target.value e))))
-                                                      (remove-input! path)))}]
-                             [:span {:className "value"
-                                     :onContextMenu (ref-menu x)
-                                     :onClick (fn [e]
-                                                (when (mutable? x)
-                                                  (add-input! path true)))}
-                              (str @x)]))))
-             "string" (fn [x path]
-                        (let [path (cursor->path x)]
-                          (dom
-                           (if (input? path)
-                             [:input {:type "text" :defaultValue @x
-                                      :className "focused"
-                                      :style #js {"width" (* 10 (count (str @x)))}
-                                      :onKeyPress (fn [e]
-                                                    (when (= 13 (.-charCode e))
-                                                      (swap! x (constantly (.-target.value e)))
-                                                      (remove-input! path)
-                                                      ))}]
-                             [:span {:className "value"
-                                     :onContextMenu (ref-menu x)
-                                     :onClick (fn []
-                                                (when (mutable? x)
-                                                  (add-input! path path)))}
-                              (str @x)])
-                           )))
+                        (cell x reader/read-string))
+             "string" (fn [x]
+                        (cell x identity))
              "table" (fn [x]
                        (if (map? @x)
                          (table-map-ui x)
@@ -656,6 +645,14 @@
                            :ref ref
                            :args args}
                       opts)))
+
+(defn table []
+  {"headers" ["a" "b"]
+   "columns" [{:type :ref/js
+               :js "aurora.runtime.table.identity_column"}
+              {:type :ref/js
+               :js "aurora.runtime.table.identity_column"}]
+   "rows" [[1 2] [3 4]]})

 (defn ref-id [id]
   {:type :ref/id
@@ -881,9 +878,8 @@
                                  )))

 (defn focus! []
-  (->> (dom/$$ :.focused)
-       (last)
-       (.focus)))
+  (when-let [cur (last (dom/$$ :.focused))]
+    (.focus cur)))

 ;;*********************************************************
 ;; Go!


re-add initialization needed for workbook to work

--- src/babel/workbook/fr.clj
+++ src/babel/workbook/fr.clj
@@ -41,8 +41,7 @@

 (def foo (expression {:synsem {:cat :verb}}))
 ;(def foo (lightning-bolt nil nil nil))
-
-;(def foo2 (expression {:synsem {:sem {:pred :have-fun}}}))
+(def foo2 (expression {:synsem {:sem {:pred :have-fun}}}))

 (def rules (:grammar-map @medium))


Send when there are birthdays

Send when there are birthdays

--- src/birthday_bot/core.clj
+++ src/birthday_bot/core.clj
@@ -45,4 +45,6 @@
     (config/config-log options)
     (let [config (config/read-config (:config options))
           people (parser/get-people (:birthday-webpage config))]
-      (send-message config people))))
+      (if people
+        (send-message config people)
+        (log/info "No birthdays today")))))


Improvements to the upload forms

Improvements to the upload forms

- The confirm dialogs now have a cancel button, fixes #16
- file inputs now have a label (sometimes only visible in the screen
  reader), fixes #13
- custom confirm dialog doesn't repeat the customer and query fields,
  fixes #14

--- src/catalog/web/views.clj
+++ src/catalog/web/views.clj
@@ -172,12 +172,12 @@
    (when (seq errors)
      [:p [:ul.alert.alert-danger (for [e errors] [:li e])]])
    (form/form-to
-    {:enctype "multipart/form-data"
-     :class "form-inline"}
+    {:enctype "multipart/form-data"}
     [:post url]
     (anti-forgery-field)
-    (form/file-upload "file")
-    " "
+    [:div.form-group
+     (form/label {:class "sr-only"} "file" "File:")
+     (form/file-upload {:required "required"} "file")]
     (form/submit-button {:class "btn btn-default"} "Upload"))])

 (defn upload-form [request year issue & [errors]]
@@ -253,7 +253,10 @@
               [:post (format "/%s/%s/%s/upload" year issue (name fmt))]
               (anti-forgery-field)
               (form/hidden-field "items" (prn-str items))
-              (form/submit-button "Upload Anyway"))))
+              (layout/button (format "/%s/%s/%s"
+                                     year issue
+                                     (if (= fmt :all-formats) "upload" "upload-full")) "Cancel")
+              (form/submit-button {:class "btn btn-default"} "Upload Anyway"))))
           (do
             ;; FIXME: add the file
             ;; and redirect to the index
@@ -302,13 +305,18 @@
   [query]
   [:div.form-group
    (form/label "query" "Query:")
-   (form/text-area {:class "form-control" :rows 3} "query" query)])
+   (form/text-area {:class "form-control"
+                    :rows 3
+                    :placeholder "Description of the catalog"}
+                   "query" query)])

 (defn- customer-field
   [customer]
   [:div.form-group
    (form/label "customer" "Customer:")
-   (form/text-field {:class "form-control"} "customer" customer)])
+   (form/text-field {:class "form-control"
+                     :placeholder "Name of the customer that will receive the catalog"}
+                    "customer" customer)])

 (defn- format-field
   [selected]
@@ -334,7 +342,9 @@
        {:enctype "multipart/form-data"}
        [:post (format "/%s/%s/custom-confirm" year issue)]
        (anti-forgery-field)
-       (form/file-upload "file")
+       [:div.form-group
+        (form/label "file" "File:")
+        (form/file-upload {:required "required"} "file")]
        (query-field nil)
        (customer-field nil)
        (format-field :pdf)
@@ -360,10 +370,11 @@
               [:post (format "/%s/%s/custom" year issue)]
               (anti-forgery-field)
               (form/hidden-field "items" (prn-str items))
-              (query-field query)
-              (customer-field customer)
-              (format-field fmt)
-              (form/submit-button "Upload Anyway"))))
+              (form/hidden-field "query" query)
+              (form/hidden-field "customer" customer)
+              (form/hidden-field "fmt" fmt)
+              (layout/button (format "/%s/%s/custom" year issue) "Cancel")
+              (form/submit-button {:class "btn btn-default"} "Upload Anyway"))))
           (do
             ;; FIXME: add the file
             ;; and redirect to the index


add theme descriptions for secret themes

--- src/client/game/core.cljs
+++ src/client/game/core.cljs
@@ -47,9 +47,11 @@

 (def themes {
   0 {:year "1984" :platform "Electronika 60"}
+  10 {:year "1984" :platform "Electronika 60"}
   1 {:year "1986" :platform "MS DOS"}
   2 {:year "1986" :platform "Tengen/Atari Arcade"}
   3 {:year "1989" :platform "Gameboy"}
+  13 {:year "1989" :platform "Gameboy"}
   4 {:year "1989" :platform "NES"}
   5 {:year "1989" :platform "Sega Genesis"}
   6 {:year "1998" :platform "Gameboy color"}


Fixed server-side paths

Fixed server-side paths

--- src/clj/bookmarx/auth.clj
+++ src/clj/bookmarx/auth.clj
@@ -45,12 +45,12 @@
     (if (:auth-user request)
       (handler request)
       {:status 302
-       :headers {"Location " (str "/login?m=" (:uri request))}})))
+       :headers {"Location " (str (:prefix (env :client-env)) "/login?m=" (:uri request))}})))

 (defn wrap-authorized-redirects [handler]
   (fn [request]
     (let [response (handler request)
           location (get-in response [:headers "Location"])]
       (if (and location (not-any? #(re-matches % location) redirect-whitelist))
-        (assoc-in response [:headers "Location"] "/")
+        (assoc-in response [:headers "Location"] (str (:prefix (env :client-env)) "/"))
         response))))


CLJS-544: named fn self reference lexical scope issue

named fns were passing along raw names instead of the name var map
which includes shadowing information. this meant that during
emission the name of the fn would not match the name that would be
emitted inside for self reference.

We now construct the name var map and set the :name field of the
fn AST appropriately.

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -383,7 +383,9 @@
         ;;turn (fn [] ...) into (fn ([]...))
         meths (if (vector? (first meths)) (list meths) meths)
         locals (:locals env)
-        locals (if (and locals name) (assoc locals name {:name name :shadow (locals name)}) locals)
+        name-var (if name
+                   {:name name :shadow (locals name)})
+        locals (if (and locals name) (assoc locals name name-var) locals)
         type (-> form meta ::type)
         fields (-> form meta ::fields)
         protocol-impl (-> form meta :protocol-impl)
@@ -421,7 +423,7 @@
                   (no-warn (doall (map #(analyze-fn-method menv locals % type) meths)))
                   methods)]
     ;;todo - validate unique arities, at most one variadic, variadic takes max required args
-    {:env env :op :fn :form form :name name :methods methods :variadic variadic
+    {:env env :op :fn :form form :name name-var :methods methods :variadic variadic
      :recur-frames *recur-frames* :loop-lets *loop-lets*
      :jsdoc [(when variadic "@param {...*} var_args")]
      :max-fixed-arity max-fixed-arity


call str on var names to avoid lossiness when going through JSON conversion

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -139,7 +139,7 @@
                 (let [minfo (cond-> {:gcol (:gen-col m)
                                      :gline (:gen-line m)}
                               (= (:op ast) :var)
-                              (assoc :name (-> ast :info :name)))]
+                              (assoc :name (str (-> ast :info :name))))]
                   ; Dec the line number for 0-indexed line numbers.
                   ; tools.reader has 0-indexed line number, chrome
                   ; expects 1-indexed source maps.


render only qr origin

render only qr origin

--- src/cljs/jsconf/core.cljs
+++ src/cljs/jsconf/core.cljs
@@ -12,6 +12,7 @@

 (def client-id (int (.get goog.net.cookies "client-id")))
 (def slide? (-> js/location (aget "hash") (= "#slide")))
+(def origin (-> js/location .-origin))

 (defcomponent stat-widget [{:keys [text votes]} _]
   (render
@@ -55,16 +56,14 @@
     [:div
      [:h2 text]])))

-(defn or-origin [v]
-  (or v (-> js/location .-origin)))

-(defcomponent qr-widget [{:keys [size ecl value]} _]
+(defcomponent qr-widget [{:keys [size ecl]} _]
   (did-mount [_]
     (println "did-mount called")
-    (make-symbol "qr" ecl (-> value or-origin)))
+    (make-symbol "qr" ecl origin))
   (did-update [_ _ _]
     (println "did-update called")
-    (make-symbol "qr" ecl (-> value or-origin)))
+    (make-symbol "qr" ecl origin))
   (render [_]
     (println "render called")
     (html


wait until first database is synced in re-frame

--- src/cljs/kulive/core.cljs
+++ src/cljs/kulive/core.cljs
@@ -188,5 +188,5 @@

 (defn init! []
   (hook-browser-navigation!)
-  (re-frame/dispatch [:initialise-db])
+  (re-frame/dispatch-sync [:initialise-db])
   (mount-root))


some type annotations

some type annotations

--- src/datascript/btset.cljc
+++ src/datascript/btset.cljc
@@ -22,11 +22,11 @@
         (7 << 16) | (53 << 8) | 11 = 472331
         0000 0111   0011 0101   0000 1011

-  Iter: set       :: Set this iterator belongs to
-             left      :: Current path
-             right     :: Right bound path (exclusive)
-             keys      :: Cached ref for keys array for a leaf
-             idx       :: Cached idx in keys array
+  Iter:     set       :: Set this iterator belongs to
+            left      :: Current path
+            right     :: Right bound path (exclusive)
+            keys      :: Cached ref for keys array for a leaf
+            idx       :: Cached idx in keys array
   Keys and idx are cached for fast iteration inside a leaf
 "
   :author "Nikita Prokopov"}
@@ -46,46 +46,48 @@
 (def ^:const path-mask (dec (bit-shift-left 1 level-shift)))
 (def ^:const empty-path 0)

-(defn path-get ^long [path level]
+(defn path-get ^long [^long path ^long level]
   (bit-and path-mask
            (unsigned-bit-shift-right path level)))

-(defn path-set ^long [path level idx]
+(defn path-set ^long [^long path ^long level ^long idx]
   (bit-or path
           (bit-shift-left idx level)))

-(defn binary-search-l [cmp arr l r k]
-  ;; TODO less loop args?
-  (if (<= l r)
-    (let [m  (shim/half (+ l r))
-          mk (shim/aget arr m)]
-      (if (neg? (cmp mk k))
-        (recur cmp arr (inc m) r k)
-        (recur cmp arr l (dec m) k)))
-    l))
-
-
-(defn binary-search-r [cmp arr l r k]
-  ;; TODO less loop args?
-  (if (<= l r)
-    (let [m  (shim/half (+ l r))
-          mk (shim/aget arr m)]
-      (if (pos? (cmp mk k))
-        (recur cmp arr l (dec m) k)
-        (recur cmp arr (inc m) r k)))
-    l))
-
-(defn lookup-exact [cmp arr key]
+(defn binary-search-l ^long [cmp arr ^long r k]
+  (loop [l 0
+         r (long r)]
+    (if (<= l r)
+      (let [m  (shim/half (+ l r))
+            mk (shim/aget arr m)]
+        (if (neg? (cmp mk k))
+          (recur (inc m) r)
+          (recur l (dec m))))
+      l)))
+
+
+(defn binary-search-r ^long [cmp arr ^long r k]
+  (loop [l 0
+         r (long r)]
+    (if (<= l r)
+      (let [m  (shim/half (+ l r))
+            mk (shim/aget arr m)]
+        (if (pos? (cmp mk k))
+          (recur l (dec m))
+          (recur (inc m) r)))
+      l)))
+
+(defn lookup-exact ^long [cmp arr key]
   (let [arr-l (shim/alength arr)
-        idx   (binary-search-l cmp arr 0 (dec arr-l) key)]
+        idx   (binary-search-l cmp arr (dec arr-l) key)]
     (if (and (< idx arr-l)
              (== 0 (cmp (shim/aget arr idx) key)))
       idx
       -1)))

-(defn lookup-range [cmp arr key]
+(defn lookup-range ^long [cmp arr key]
   (let [arr-l (shim/alength arr)
-        idx   (binary-search-l cmp arr 0 (dec arr-l) key)]
+        idx   (binary-search-l cmp arr (dec arr-l) key)]
     (if (== idx arr-l)
       -1
       idx)))
@@ -313,7 +315,7 @@
         (node-lookup (shim/aget pointers idx) cmp key))))

   (node-conj [_ cmp key]
-    (let [idx   (binary-search-l cmp keys 0 (- (shim/alength keys) 2) key)
+    (let [idx   (binary-search-l cmp keys (- (shim/alength keys) 2) key)
           nodes (node-conj (shim/aget pointers idx) cmp key)]
       (when nodes
         (let [new-keys     (check-n-splice cmp keys     idx (inc idx) (shim/amap node-lim-key nodes))
@@ -369,7 +371,7 @@
         (shim/aget keys idx))))

   (node-conj [_ cmp key]
-    (let [idx    (binary-search-l cmp keys 0 (dec (shim/alength keys)) key)
+    (let [idx    (binary-search-l cmp keys (dec (shim/alength keys)) key)
           keys-l (shim/alength keys)]
       (cond
         ;; element already here
@@ -422,7 +424,7 @@
     (-meta [_] meta)

     IEmptyableCollection
-    (-empty [_] (BTSet. (Leaf. (array)) 0 0 comparator meta uninitialized-hash))
+    (-empty [_] (BTSet. (Leaf. (shim/array)) 0 0 comparator meta uninitialized-hash))

     IEquiv
     (-equiv [this other]
@@ -880,10 +882,10 @@
     (let [keys-l (node-len node)]
       (if (== 0 level)
         (let [keys (.-keys ^Leaf node)
-              idx  (binary-search-l (.-comparator set) keys 0 (dec keys-l) key)]
+              idx  (binary-search-l (.-comparator set) keys (dec keys-l) key)]
           (if (== keys-l idx) -1 (path-set path 0 idx)))
         (let [keys (.-keys ^Node node)
-              idx  (binary-search-l (.-comparator set) keys 0 (- keys-l 2) key)]
+              idx  (binary-search-l (.-comparator set) keys (- keys-l 2) key)]
           (recur (shim/aget (.-pointers ^Node node) idx)
                  (path-set path level idx)
                  (- level level-shift)))))))
@@ -899,10 +901,10 @@
     (let [keys-l (node-len node)]
       (if (== 0 level)
         (let [keys (.-keys ^Leaf node)
-              idx  (binary-search-r (.-comparator set) keys 0 (dec keys-l) key)]
+              idx  (binary-search-r (.-comparator set) keys (dec keys-l) key)]
           (path-set path 0 idx))
         (let [keys (.-keys ^Node node)
-              idx  (binary-search-r (.-comparator set) keys 0 (- keys-l 2) key)]
+              idx  (binary-search-r (.-comparator set) keys (- keys-l 2) key)]
           (recur (shim/aget (.-pointers ^Node node) idx)
                  (path-set path level idx)
                  (- level level-shift)))))))


need that not found action

need that not found action

--- weld-blog-example/src/weldblog/controllers.clj
+++ weld-blog-example/src/weldblog/controllers.clj
@@ -9,7 +9,7 @@
       [config   :as config])
     [stash.core :as stash]))

-(defn not-found []
+(defn not-found [& [req]]
   (respond-404 (v/not-found)))

 (defmacro with-post


Revisions to orphan concept query (singles)

Added franz prefixes for clauseReorderer = identity and
chunkProcessingAllowed = yes

Added distinct to the singles query

--- src/kabob/build/id_sets/id_set_triples.clj
+++ src/kabob/build/id_sets/id_set_triples.clj
@@ -22,14 +22,14 @@
 (def ^:dynamic *id-set-ns* "ccp")

 (def magic-prefixes
-  (str "PREFIX franzOption_memoryLimit: <franz:85g> \n"
+  (str "prefix franzOption_clauseReorderer: <franz:identity> \n"
+       "prefix franzOption_chunkProcessingAllowed: <franz:yes> \n"
+       "PREFIX franzOption_memoryLimit: <franz:85g> \n"
        "PREFIX franzOption_memoryExhaustionWarningPercentage: <franz:95> \n"
        "PREFIX franzOption_logQuery: <franz:yes> \n "
        "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> \n"
        "PREFIX obo: <http://purl.obolibrary.org/obo/> \n"
        "PREFIX ccp: <http://ccp.ucdenver.edu/obo/ext/> \n"
-       ;; "PREFIX franzOption_chunkProcessingAllowed: <franz:yes> \n"
-       ;; "PREFIX franzOption_chunkProcessingSize: <franz:500000> \n"
        ))

 ;;;-------------------------------------------------------------------
@@ -127,13 +127,13 @@
     (let [query-body
           (str "where {
                 ?id_type rdfs:subClassOf* ccp:IAO_EXT_0000342 .
-  				?id rdf:type ?id_type .
+  				      ?id rdf:type ?id_type .
                 MINUS { {?id2 skos:exactMatch ?id . }
                         UNION
                         { ?id skos:exactMatch ?id2 . } }}")
           count-query (str magic-prefixes
-                           " select (count(?id) as ?count) " query-body)
-          singles-query (str magic-prefixes " select ?id " query-body)
+                           " select (count( distinct ?id) as ?count) " query-body)
+          singles-query (str magic-prefixes " select distinct ?id " query-body)
           num-pairs (time
                      (second (first (first (query-sparql source-kb
                                                          count-query)))))


Comply with upstream changes

Comply with upstream changes

--- src/flense_nw/keymap.cljs
+++ src/flense_nw/keymap.cljs
@@ -7,6 +7,11 @@
             [flense.actions.text :as text]
             [flense.model :as model]
             [xyzzy.core :as z]))
+
+(defn maybe-insert-char [ch else-fn]
+  #(if (model/editing? %)
+     (text/insert-char ch %)
+     (else-fn %)))

 (def keymap
   {#{:down} (some-fn text/begin-editing completions/next-completion z/down)
@@ -21,7 +26,7 @@
    #{:backspace} #(or (text/delete-char %) (paredit/delete %))
    #{:shift :backspace} paredit/delete
    #{:shift :space} paredit/insert-left
-   #{:space} paredit/insert-right
+   #{:space} (maybe-insert-char \space paredit/insert-right)

    #{:ctrl :shift :open-square-bracket} paredit/make-map
    #{:ctrl :shift :nine} paredit/make-seq


Drop some old debug output

Drop some old debug output

--- src/foreclojure/login.clj
+++ src/foreclojure/login.clj
@@ -212,5 +212,4 @@
         (set-disable-codebox disable-codebox))

   (POST "/users/set-hide-solutions" [hide-solutions]
-    (println "POST")
     (set-hide-solutions hide-solutions)))


Reorder static files at Chrome's suggestion.

@gigasquid, if there's some reason Chrome is wrong about this,
feel free to roll back - I just know it told me to put CSS before
JS, and to put inline CSS before external CSS.

--- src/foreclojure/utils.clj
+++ src/foreclojure/utils.clj
@@ -173,13 +173,13 @@
        [:title (:title attrs)]
        [:link {:rel "alternate" :type "application/atom+xml" :title "Atom" :href "http://4clojure.com/problems/rss"}]
        [:link {:rel "shortcut icon" :href "/favicon.ico"}]
+       [:style {:type "text/css"}
+        ".syntaxhighlighter { overflow-y: hidden !important; }"]
+       (css "/css/style.css" "/css/demo_table.css" "/css/shCore.css" "/css/shThemeDefault.css")
        (js "/vendor/script/jquery-1.5.2.min.js" "/vendor/script/jquery.dataTables.min.js")
        (js "/script/foreclojure.js")
        (js "/vendor/script/xregexp.js" "/vendor/script/shCore.js" "/vendor/script/shBrushClojure.js")
        (js "/vendor/script/ace/ace.js" "/vendor/script/ace/mode-clojure.js")
-       (css "/css/style.css" "/css/demo_table.css" "/css/shCore.css" "/css/shThemeDefault.css")
-       [:style {:type "text/css"}
-        ".syntaxhighlighter { overflow-y: hidden !important; }"]
        [:script {:type "text/javascript"} "SyntaxHighlighter.all()"]]
       [:body
        (when (:fork-banner attrs)


Added github banner.

Added github banner.

--- src/foreclojure/utils.clj
+++ src/foreclojure/utils.clj
@@ -145,6 +145,9 @@
         ".syntaxhighlighter { overflow-y: hidden !important; }"]
        [:script {:type "text/javascript"} "SyntaxHighlighter.all()"]]
       [:body
+       [:div#github_header
+         [:a {:href "http://github.com/4clojure"}
+          [:img {:style "position: absolute; top: 0; right: 0; border: 0;" :src "https://a248.e.akamai.net/assets.github.com/img/71eeaab9d563c2b3c590319b398dd35683265e85/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" :alt "Fork me on GitHub"}]]]
        [:div#top
         (link-to "/" [:img#logo {:src "/images/logo.png" :alt "4clojure.com"}])]
        [:div#content