formatting

formatting

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -497,86 +497,95 @@
                    (recur true))
                  (recur false)))))))

+     om/IDidUpdate
+     (did-update
+       [_ prev-props _]
+       (when (and stream (not= (:stream prev-props) stream))
+         (set-vid-src owner stream)))
+
      om/IRender
-     (render [_]
-       (dom/div nil
-                (modal app)
-                (dom/div
-                 #js {:id        "sidebar"
-                      :className (when-not stream "hidden")
-                      :style     #js {:width capture-size}}
-
-                 (dom/img #js {:src "img/cellf.svg" :alt "Cellf"})
-                 (dom/h2 nil "find yourself")
-                 (dom/canvas #js {:ref    "playback"
-                                  :width  capture-size
-                                  :height (* capture-size 2)})
-
-                 (when stream
-                   (dom/div nil
-                            (dom/label
-                             #js {:className "move-count"}
-                             (str (inc tick) \/ (count moves)))
-
-                            (dom/label
-                             #js {:htmlFor "show-nums"}
-                             "show numbers?")
-
-                            (dom/input
-                             #js {:id       "show-nums"
-                                  :type     "checkbox"
-                                  :checked  show-nums
-                                  :onChange #(om/update!
-                                              app :show-nums (not show-nums))})
-
-                            (dom/label
-                             nil
-                             (str "grid size (" grid-size \× grid-size ")")
-                             (dom/em nil "(starts new game)"))
-
-                            (dom/input #js {:type     "range"
-                                            :value    grid-size
-                                            :min      "2"
-                                            :max      "9"
-                                            :step     "1"
-                                            :onChange
-                                            #(set-grid-size!
-                                              app
-                                              (js/parseInt
-                                               (.. % -target -value)))})
-
-                            (dom/label nil "playback speed")
-
-                            (dom/input
-                             #js {:type     "range"
-                                  :value    (- tick-ms)
-                                  :min      "-1000"
-                                  :max      "-30"
-                                  :step     "10"
-                                  :onChange #(set-tick-ms!
-                                              app
-                                              (- (js/parseInt
-                                                  (.. % -target -value))))})
-
-                            (apply dom/button
-                                   (if gif-building?
-                                     [#js {:className "wait"} "hold on"]
-                                     [#js {:onClick #(make-gif app tick-ms)}
-                                      "make gif"]))
-
-                            (dom/button
-                             #js {:onClick #(om/update! app :show-about? true)}
-                             "help")
-
-                            (dom/p nil
-                                   (dom/a
-                                    #js {:href source-url :target "_blank"}
-                                    "source")
-                                   (dom/span nil \/)
-                                   (dom/a
-                                    #js {:href home-url :target "_blank"}
-                                    "oxism")))))
-
-                (when stream (om/build grid app))))))
+     (render
+       [_]
+       (dom/div
+        nil
+        (dom/canvas #js {:ref canvas-ref :style #js {:display "none"}})
+        (modal app)
+        (dom/div
+         #js {:id        "sidebar"
+              :className (when-not stream "hidden")
+              :style     #js {:width capture-size}}
+
+         (dom/img #js {:src "img/cellf.svg" :alt "Cellf"})
+         (dom/h2 nil "find yourself")
+         (dom/canvas #js {:ref    "playback"
+                          :width  capture-size
+                          :height (* capture-size 2)})
+
+         (when stream
+           (dom/div nil
+                    (dom/label
+                     #js {:className "move-count"}
+                     (str (inc tick) \/ (count moves)))
+
+                    (dom/label
+                     #js {:htmlFor "show-nums"}
+                     "show numbers?")
+
+                    (dom/input
+                     #js {:id       "show-nums"
+                          :type     "checkbox"
+                          :checked  show-nums
+                          :onChange #(om/update!
+                                      app :show-nums (not show-nums))})
+
+                    (dom/label
+                     nil
+                     (str "grid size (" grid-size \× grid-size ")")
+                     (dom/em nil "(starts new game)"))
+
+                    (dom/input #js {:type     "range"
+                                    :value    grid-size
+                                    :min      "2"
+                                    :max      "9"
+                                    :step     "1"
+                                    :onChange
+                                    #(set-grid-size!
+                                      app
+                                      (js/parseInt
+                                       (.. % -target -value)))})
+
+                    (dom/label nil "playback speed")
+
+                    (dom/input
+                     #js {:type     "range"
+                          :value    (- tick-ms)
+                          :min      "-1000"
+                          :max      "-30"
+                          :step     "10"
+                          :onChange #(set-tick-ms!
+                                      app
+                                      (- (js/parseInt
+                                          (.. % -target -value))))})
+
+                    (apply dom/button
+                           (if gif-building?
+                             [#js {:className "wait"} "hold on"]
+                             [#js {:onClick #(make-gif app tick-ms)}
+                              "make gif"]))
+
+                    (dom/button
+                     #js {:onClick #(om/update! app :show-about? true)}
+                     "help")
+
+                    (dom/p nil
+                           (dom/a
+                            #js {:href source-url :target "_blank"}
+                            "source")
+                           (dom/span nil \/)
+                           (dom/a
+                            #js {:href home-url :target "_blank"}
+                            "oxism")))))
+
+        (when stream (om/build grid app))))))
  app-state
  {:target (.getElementById js/document "app")})


playsinline on video els

playsinline on video els

--- src/cellf/core.cljs
+++ src/cellf/core.cljs
@@ -208,6 +208,7 @@
     om/IDidMount
     (did-mount [_]
       (when (not= n :empty)
+        (.setAttribute (om/get-node owner "vid") "playsinline" "")
         (set-vid-src owner stream)))

     om/IDidUpdate


Drop unused code.

Drop unused code.

--- src/cgdata/core.clj
+++ src/cgdata/core.clj
@@ -339,22 +339,6 @@

 ;TARGET-30-PAHYWC-01     chr5    33549462        33549462        ADAMTS12        G       T       missense_variant        0.452962        NA      F1384L

-(defn- mutation-row [row]
-  (let [[sample chrom start end genes reference alt effect dna-af rna-af amino-acid]
-        (s/split row #"\t")]
-    {:sample sample
-     :chrom chrom
-     :chromStart (. Integer parseInt start)
-     :chromEnd (. Integer parseInt end)
-     :strand "+"
-     :genes (split-no-empty genes #",")
-     :reference reference
-     :alt alt
-     :effect effect
-     :dna-af (parseFloatNA dna-af)
-     :rna-af (parseFloatNA rna-af)
-     :amino-acid amino-acid}))
-
 (defmulti field-spec (fn [field _] (:type field)))

 (defmethod field-spec :category


Fixed new-cookie function

Fixed new-cookie function

--- src/compojure/http/helpers.clj
+++ src/compojure/http/helpers.clj
@@ -12,6 +12,7 @@

 (ns compojure.http.helpers
   (:use [compojure.str-utils :only (str*)])
+  (:use [clojure.contrib.def :only (defmacro-)])
   (:import java.io.File)
   (:import javax.servlet.http.Cookie))

@@ -52,14 +53,15 @@
 (defn new-cookie
   "Helper function for creating new Cookie objects."
   [name value & attrs]
-  (let [cookie    (new Cookie (str* name) value)
-        attrs     (apply hash-map attrs)
-        set-attr #(if (attrs %1)
-                    (eval (list %2 cookie (attrs %1))))]
-    (set-attr :comment '.setComment)
-    (set-attr :domain  '.setDomain)
-    (set-attr :max-age '.setMaxAge)
-    (set-attr :path    '.setPath)
-    (set-attr :secure  '.setSecure)
-    (set-attr :version '.setVersion)
-    cookie))
+  (let [cookie   (new Cookie (str* name) value)
+        attrs    (apply hash-map attrs)
+        setters  {:comment (memfn setComment comment)
+                  :domain  (memfn setDomain domain)
+                  :max-age (memfn setMaxAge age)
+                  :path    (memfn setPath path)
+                  :secure  (memfn setSecure secure)
+                  :version (memfn setVersion version)}]
+    (doseq [[attr setter] setters]
+      (if-let [value (attrs attr)]
+        (setter cookie value)))
+    cookie))


Moving some Java code around

Moving some Java code around

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

--- src/conexp/util.clj
+++ src/conexp/util.clj
@@ -9,10 +9,6 @@
 (in-ns 'conexp.base)

 (use 'clojure.test)
-
-(import 'javax.swing.JOptionPane
-        'java.util.Calendar
-        'java.text.SimpleDateFormat)

 ;;;

@@ -434,6 +430,9 @@
                    (lazy-seq
                      (cons (vec rest) (runner (next rest))))))]
     (runner (seq sqn))))
+
+(import 'java.util.Calendar
+        'java.text.SimpleDateFormat)

 (defn now
   "Returns the current time in a human readable format."


Title should be dynamically configurable

--- src/zg/html_renderer.clj
+++ src/zg/html_renderer.clj
@@ -6,9 +6,9 @@

 (defn render-html-header
     "Renders part of HTML page - the header."
-    [word url-prefix]
+    [word url-prefix zw-mode]
     [:head
-        [:title "zg " word]
+        [:title (if zw-mode "zw " "zg ") word]
         [:meta {:name "Author"    :content "Pavel Tisnovsky"}]
         [:meta {:name "Generator" :content "Clojure"}]
         [:meta {:http-equiv "Content-type" :content "text/html; charset=utf-8"}]
@@ -46,13 +46,13 @@

 (defn render-navigation-bar-section
     "Renders whole navigation bar."
-    [word user-name url-prefix]
+    [word user-name url-prefix zw-mode]
     [:nav {:class "navbar navbar-inverse navbar-fixed-top" :role "navigation"}
         [:div {:class "container-fluid"}
             [:div {:class "row"}
                 [:div {:class "col-md-1"}
                     [:div {:class "navbar-header"}
-                        [:a {:href url-prefix :class "navbar-brand"} "zg"]
+                        [:a {:href url-prefix :class "navbar-brand"} (if zw-mode "zw" "zg")]
                     ] ; ./navbar-header
                 ] ; col ends
                 [:div {:class "col-md-3"}
@@ -85,10 +85,10 @@
     "Render error page with a 'back' button."
     [word user-name message url-prefix]
     (page/xhtml
-        (render-html-header "" url-prefix)
-        [:body
-            [:div {:class "container"}
-                (render-navigation-bar-section word user-name url-prefix)
+        (render-html-header "" url-prefix nil) ; TODO change
+        [:body
+            [:div {:class "container"}
+                (render-navigation-bar-section word user-name url-prefix nil); TODO change
                 [:div {:class "col-md-10"}
                     [:h2 "Sorry, error occured in zg"]
                     [:p message]
@@ -101,12 +101,12 @@
     ))

 (defn render-front-page
-    [word user-name search-results message url-prefix]
-    (page/xhtml
-        (render-html-header word url-prefix)
-        [:body
-            [:div {:class "container"}
-                (render-navigation-bar-section word user-name url-prefix)
+    [word user-name search-results message url-prefix zw-mode]
+    (page/xhtml
+        (render-html-header word url-prefix zw-mode)
+        [:body
+            [:div {:class "container"}
+                (render-navigation-bar-section word user-name url-prefix zw-mode)

                 (form/form-to [:post (str url-prefix "add-words")]
                         [:div {:class "label label-primary"} "New words"]
@@ -129,6 +129,8 @@
                         [:tr [:th "Word"]
                              [:th "Added at"]
                              [:th "Added by"]
+                             (if zw-mode
+                                 [:th "Description"])
                              [:th "Status"]
                              [:th "Operation"]]
                         (for [search-result search-results]
@@ -137,9 +139,11 @@
                                 [:tr [:td word]
                                      [:td (:datetime search-result)]
                                      [:td (:user search-result)]
+                                     (if zw-mode
+                                         [:td (:description search-result)])
                                      [:td (if deleted "deleted" "active")]
                                      [:td (if deleted [:a {:href (str "?undelete=" word) :class "btn btn-success"} "undelete"]
-                                                      [:a {:href (str "?delete=" word)   :class "btn btn-danger"}  "delete"])]
+                                                      [:a {:href (str "?delete="   word) :class "btn btn-danger"}  "delete"])]
                                 ]))
                     ])
                 (render-html-footer)
@@ -148,12 +152,12 @@
     ))

 (defn render-users
-    [user-name statistic changes url-prefix]
-    (page/xhtml
-        (render-html-header nil url-prefix)
-        [:body
-            [:div {:class "container"}
-                (render-navigation-bar-section nil user-name url-prefix)
+    [user-name statistic changes url-prefix zw-mode]
+    (page/xhtml
+        (render-html-header nil url-prefix zw-mode)
+        [:body
+            [:div {:class "container"}
+                (render-navigation-bar-section nil user-name url-prefix zw-mode)

                 [:table {:class "table table-stripped table-hover" :style "width:auto"}
                     [:tr [:th "User name"]
@@ -179,12 +183,12 @@
     ))

 (defn render-user-info
-    [user-name changes url-prefix]
-    (page/xhtml
-        (render-html-header nil url-prefix)
-        [:body
-            [:div {:class "container"}
-                (render-navigation-bar-section nil user-name url-prefix)
+    [user-name changes url-prefix zw-mode]
+    (page/xhtml
+        (render-html-header nil url-prefix zw-mode)
+        [:body
+            [:div {:class "container"}
+                (render-navigation-bar-section nil user-name url-prefix zw-mode)
                 [:h1 (str "Changes made by " user-name)]

                 [:br]


2017/day1

--- src/adventofcode2017/day1.clj
+++ src/adventofcode2017/day1.clj
@@ -3,17 +3,19 @@

 (def input (slurp (io/resource "2017/day1")))

-(->> (str input (first input))
-     (partition 2 1)
-     (filter (fn [[a b]] (= a b)))
-     (map (fn [[a _]] (Character/getNumericValue a)))
-     (reduce +))
+(reduce + (map (fn [a b]
+                 (if (= a b)
+                   (Integer/parseInt (str a))
+                   0))
+               input
+               (drop 1 (cycle input))))
 ; 1253

-(let [step (/ (count input) 2)]
-  (->> (str input (subs input 0 step))
-       (partition (inc step) 1)
-       (filter #(= (first %) (last %)))
-       (map #(Character/getNumericValue (first %)))
-       (reduce +)))
+(let [half (/ (count input) 2)]
+  (reduce + (map (fn [a b]
+                   (if (= a b)
+                     (Integer/parseInt (str a))
+                     0))
+                 input
+                 (drop half (cycle input)))))
 ; 1278


Implemented Tinkering

Implemented Tinkering

--- src/clj/game/cards-events.clj
+++ src/clj/game/cards-events.clj
@@ -428,6 +428,16 @@
    {:end-turn {:effect (effect (gain :credit (* 2 (count (:successful-run runner-reg)))))
                :msg (msg "gain " (* 2 (count (:successful-run runner-reg))) " [Credits]")}}

+   "Tinkering"
+   {:choices {:req #(and (has? % :type "ICE") (= (first (:zone %)) :servers))}
+    :effect (req (let [ice target]
+                   (resolve-ability
+                     state :runner
+                     {:prompt (msg "Choose a type")
+                      :choices ["sentry" "code gate" "barrier"]
+                      :msg (msg "give " (:title ice) " " target " until the end of turn")}
+                      card nil)))}
+
    "Trade-In"
    {:prompt "Choose a hardware to trash" :choices {:req #(and (:installed %) (= (:type %) "Hardware"))}
     :msg (msg "trash " (:title target) " and gain " (quot (:cost target) 2) " [Credits]")


Added tag stats.

Added tag stats.

--- src/dragon/blog.clj
+++ src/dragon/blog.clj
@@ -83,7 +83,39 @@
        (map (partial post/process uri-base))
        (sort compare-timestamp-desc)))

-(defn tags
+(defn get-tag-freqs
+  [data]
+  (->> data
+       (map (comp vec :tags))
+       (flatten)
+       (frequencies)))
+
+(defn add-tag-percents
+  [total highest tag-data]
+  (let [percent (float (/ (:count tag-data) highest))]
+    (assoc tag-data
+           :total total
+           :highest highest
+           :percent percent
+           :five-star (Math/round (* 5 percent))
+           :hundred (Math/round (* 100 percent)))))
+
+(defn add-tags-percents
+  [total highest tags-data]
+  (map #(add-tag-percents total highest %) tags-data))
+
+(defn tag-stats
+  [data]
+  (let [freqs (get-tag-freqs data)
+        total (reduce + (vals freqs))
+        highest (apply max (vals freqs))]
+    (->> freqs
+         (vec)
+         (map #(zipmap [:name :count] %))
+         (add-tags-percents total highest)
+         (sort-by :name))))
+
+(defn tags-unique
   [data]
   (->> data
        (map :tags)
@@ -104,8 +136,8 @@

 (defn data-for-tags
   [data]
-  (let [all-tags (tags data)]
-    (map (partial group-by-tag data) all-tags)))
+  (let [unique-tags (tags-unique data)]
+    (map (partial group-by-tag data) unique-tags)))

 (defn data-for-authors
   [data]


reverse booleans to fix error

reverse booleans to fix error

--- src/gangway/web.clj
+++ src/gangway/web.clj
@@ -23,8 +23,8 @@
                                               route-params (get-in ctx [:request :route-params])
                                               validated (gw-validation/valid? message route-params :assert)]
                                           (if (:valid validated)
-                                            [true  {::validated (:data  validated)}]
-                                            [false {::malformed (:error validated)}])))
+                                            [false  {::validated (:data  validated)}]
+                                            [true {::malformed (:error validated)}])))
                           :handle-malformed (fn [ctx] (str (::malformed ctx)))
                           :post! (fn incoming!- [ctx]
                                    (let [rp  (get-in ctx [:request :route-params])


simplify help a bit and consolidate logging

--- src/goodbot/bot.clj
+++ src/goodbot/bot.clj
@@ -4,10 +4,7 @@
    [irclj.core :as irclj]
    [goodbot.parse :refer [extract-command extract-word]]])

-(defn select-plugin [plugins name]
-  (->> plugins (filter #(= (:command %) name)) first))
-
-(defn make-help [plugins]
+(defn add-help [plugins]
   (declare plugins-with-help)
   (defn help-handler [irc message]
     (defn handle [command]
@@ -24,21 +21,22 @@
      :doc ".help <command> : print documentation for the given command"
      :handler help-handler})
   (def plugins-with-help (conj plugins help-plugin))
-  help-plugin)
+  plugins-with-help)

 (defn respond-with [irc message responses]
   (when-not (nil? responses)
     (def vec-responses (if (coll? responses) responses [responses]))
-    (doseq [r vec-responses] (irclj/reply irc message r))))
+    (doseq [r vec-responses]
+      (println "RESPONDING:" r)
+      (irclj/reply irc message r))))

 (defn make-callback [plugins]
-  (def plugins-with-help (conj plugins (make-help plugins)))
+  (def plugins-with-help (add-help plugins))
   (fn [irc message]
     (when-let [[command rest-of-text] (extract-command message)]
-      (println "COMMAND: " command)
+      (println "COMMAND: " command rest-of-text)
       (when-let [plugin (select-plugin plugins-with-help command)]
         (def updated-message (assoc message :text rest-of-text) )
         (def handler (:handler plugin))
         (when-let [responses (handler irc updated-message)]
-          (println "RESPONSES: " responses)
           (respond-with irc message responses))))))


added get-last-error

added get-last-error

--- src/karras/core.clj
+++ src/karras/core.clj
@@ -170,3 +170,9 @@
     (doseq [[k v] pairs]
       (.add builder (name k) (to-dbo v)))
     (.get builder)))
+
+(defn get-last-error
+  ([#^DB db]
+     (to-clj (.getLastError db)))
+  ([#^DB db w wtimeout fsync]
+     (to-clj (.getLastError db w wtimeout fsync))))


Pass in entire parse to layout function.

--- src/incise/layouts/core.clj
+++ src/incise/layouts/core.clj
@@ -15,7 +15,7 @@

 (defn Parse->string
   [^incise.parsers.core.Parse parse-data]
-  ((get (:layout parse-data)) conf/get (:content parse-data)))
+  ((get (:layout parse-data)) conf/get parse-data))

 (defn register
   "Register a layout function to a shortname"


Create a schema for a FailureResponse

Create a schema for a FailureResponse

--- src/io/aviso/rook/utils.clj
+++ src/io/aviso/rook/utils.clj
@@ -1,11 +1,11 @@
 (ns io.aviso.rook.utils
   "Kitchen-sink of useful standalone utilities."
-  (:import
-    (java.util UUID))
-  (:require
-    [ring.util.response :as r]
-    [ring.util.time :as t]
-    [clojure.pprint :as pprint]))
+  (:require [ring.util.response :as r]
+            [io.aviso.rook.schema :as rs]
+            [ring.util.time :as t]
+            [clojure.pprint :as pprint]
+            [schema.core :as s])
+  (:import (java.util UUID)))

 (defn new-uuid
   "Generates a new UUID string, via UUID/randomUUID."
@@ -17,9 +17,9 @@
   to 200.  If only the body is provided, but it is numeric, then it is treated as a status code with
   an empty body."
   ([body]
-    (if (number? body)
-      (response body nil)
-      (r/response body)))
+   (if (number? body)
+     (response body nil)
+     (r/response body)))
   ([status body] (->
                    (r/response body)
                    (r/status status))))
@@ -46,8 +46,13 @@
   [request]
   (summarize-method-and-uri (:request-method request) (:uri request)))

+(rs/defschema ^{:added "0.1.27"} FailureResponse
+  "A standard response consisting of an error string and a user-presentable error message."
+  {:error   s/Str
+   :message s/Str})
+
 (defn failure-response
-  "Builds a standard failure response, consisting of two keys, :error and :message, each a string.
+  "Builds a standard [[FailureResponse]], consisting of two keys, :error and :message, each a string.

   This method can be overridden (via alter-var-root!) to impose a different format for such responses."
   {:added "0.1.23"}


Minor refactoring

Minor refactoring

--- src/leiningen/droid/sdk.clj
+++ src/leiningen/droid/sdk.clj
@@ -40,7 +40,8 @@
       (debug "Adding native libraries: " all-native-libraries)
       (doseq [lib all-native-libraries]
         (.addNativeLibraries apkbuilder ^File (io/file lib))))
-    (when-not (empty? dexes)
+    (when (seq dexes)
+      (debug "Adding DEX files: " dexes)
       (doseq [dex dexes]
         (.addFile apkbuilder dex (.getName dex))))
     (.sealApk apkbuilder)))


riot code

riot code

--- src/lolteambuilder/core.clj
+++ src/lolteambuilder/core.clj
@@ -156,6 +156,7 @@
   (GET  "/" [] (mustache/render-file "index.html"
                  {:regions (map (fn [reg] {:name reg}) regions)}))
   (POST  "/" {params :params} (search-page params))
+  (GET  "/riot.txt" [] "c0a9de7b-0355-4dcb-b63a-a7b62c19de83")
   (GET "/team" {params :params} (team-page params)))

 (def app (wrap-params routes))


test if :proxy true will fix need to detect proper /api endpoint url

--- src/main/cawala/client.cljs
+++ src/main/cawala/client.cljs
@@ -35,7 +35,7 @@
                       {:target [:person-list/by-id :friends :person-list/people]}))
            :networking
            {:remote (net/fulcro-http-remote
-                     {:url (str (-> js/window .-location .-href) "api")
+                     {:url "/api" #_(str (-> js/window .-location .-href) "api")
                           :request-middleware secured-request-middleware})}))
   (start))


add authenticated? function

add authenticated? function

--- src/open_company/api/common.clj
+++ src/open_company/api/common.clj
@@ -91,6 +91,11 @@

 ;; ----- Authentication and Authorization -----

+(defn authenticated?
+  "Return true if the request contains a valid JWToken"
+  [ctx]
+  (and (:jwtoken ctx) (:user ctx)))
+
 (defn authorized-to-company?
   "Return true if the user is authorized to this company, false if not."
   [ctx]
@@ -120,7 +125,7 @@
 (defn allow-authenticated
   "Allow unless there is a JWToken provided and it's invalid"
   [ctx]
-  (boolean (:jwtoken ctx)))
+  (authenticated? ctx))

 (defn allow-org-members
   "Allow only if there is no company, or the user's JWToken indicates membership in the company's org."
@@ -150,7 +155,7 @@
 ;; verify validity and presence of required JWToken
 (def authenticated-resource {
   :initialize-context (fn [ctx] (read-token (get-in ctx [:request :headers])))
-  :authorized? (fn [{:keys [jwtoken]}] (boolean jwtoken))
+  :authorized? (fn [ctx] (authenticated? ctx))
   :handle-not-found (fn [_] (missing-response))
   :handle-unauthorized (fn [_] (unauthorized-response))
   :handle-forbidden (fn [_] (forbidden-response))})


make non-public-api stuff private

make non-public-api stuff private

--- src/overtone/libs/freesound.clj
+++ src/overtone/libs/freesound.clj
@@ -15,7 +15,7 @@
   (let [params (assoc params :api_key *api-key*)]
     (build-url url params)))

-(def base-url "http://www.freesound.org/api")
+(def ^:private base-url "http://www.freesound.org/api")

 (defn- freesound-url
   "Generate a freesound.org api url. Accepts an optional map of query-params as the last argument."
@@ -67,7 +67,7 @@
     (asset/asset-path url name)))

 ;; ## Pack Info
-(defn pack-info-url
+(defn- pack-info-url
   [id]
   (freesound-url "/packs/" id))


Separate init function which requests all references

--- src/discuss/communication.cljs
+++ src/discuss/communication.cljs
@@ -122,7 +122,9 @@
               :path          js/location.pathname
               :issue_id      (get-in @lib/app-state [:issues :uid])
               :slug          (get-in @lib/app-state [:issues :slug])}]
-    (post-json url body process-url-handler headers)))
+    (post-json url body process-url-handler headers)
+    (println reference)
+    (discuss.references.integration/convert-reference reference)))

 ;;;; For preparation
@@ -161,5 +163,10 @@
   []
   (let [url (:init config/api)]
     (lib/update-state-item! :layout :add? (fn [_] false))
-    (ajax-get-and-change-view url :default)
-    (request-references)))+    (ajax-get-and-change-view url :default)))
+
+(defn init-with-references!
+  "Load discussion and initially get reference to include them in the discussion."
+  []
+  (request-references)
+  (init!))


fix doc string

fix doc string

--- src/doctopus/configuration.clj
+++ src/doctopus/configuration.clj
@@ -35,7 +35,7 @@
   (io/delete-file (make-head-filename head-name)))

 (defn save-tentacle!
-  "given a Doctopus Head map, save it to disk as an edn file in resources/"
+  "given a Doctopus Tentacle map, save it to disk as an edn file in resources/"
   [doctopus-tentacle]
   (let [tentacle-name (:name doctopus-tentacle)]
     (save-to-disk! (make-tentacle-filename tentacle-name) doctopus-tentacle)))


[PDOK-1023] exends generator with delete support

--- src/main/clojure/pdok/featured/generator.clj
+++ src/main/clojure/pdok/featured/generator.clj
@@ -47,6 +47,12 @@
       (assoc :_current_validity (:_validity feature))
       (assoc :_validity (tf/unparse date-time-formatter (t/plus (local-now) (t/minutes 1))))))

+(defn transform-to-delete [{:keys [_dataset _collection _id _validity]}]
+  {:_action "delete"
+   :_collection _collection
+   :_id _id
+   :_current_validity _validity})
+
 (defn transform-to-nested [feature]
   (apply dissoc feature [:_action :_collection :_id :_validity :_current_validity]))

@@ -64,7 +70,7 @@
                        [:_action :_collection :_id :_validity :_current_validity]))

 (defn nillify-an-attribute [feature]
-  (update-an-attribute feature #(assoc %1 %2 nil)
+  (update-an-attribute feature #(if %2 (assoc %1 %2 nil) %1)
                        [:_action :_collection :_id :_validity :_current_validity :_geometry]))

 (defn random-new-feature
@@ -89,15 +95,19 @@
       1 (assoc base attr (first nested-features))
       (assoc base attr (into [] nested-features)))))

-(defn followed-by [feature change? close?]
+(defn followed-by [feature change? close? delete?]
   (let [change (fn [f] (selective-feature (transform-to-change f)))
         close  (fn [f] (selective-feature (transform-to-close f)))
+        delete (fn [f] (selective-feature (transform-to-delete f)))
         result [feature]
         result (if change?
                  (conj result (change feature))
                  result)
         result (if close?
                  (conj result (close feature))
+                 result)
+        result (if delete?
+                 (conj result (delete feature))
                  result)]
     result))

@@ -108,12 +118,13 @@
     attributes))

 (defn random-json-features [out-stream dataset collection total & args]
-  (let [{:keys [change? close? nested geometry?] :or {change? false close? false nested 0 geometry? true}} args
+  (let [{:keys [change? close? delete? nested geometry?]
+         :or {change? false close? false delete? false nested 0 geometry? true}} args
         validity (tf/unparse date-time-formatter (local-now))
         attributes (create-attributes 3)
         new-features (repeatedly #(random-new-feature collection attributes))
         with-nested (map #(combine-to-nested-feature % "nested" geometry?) (partition (+ 1 nested) new-features))
-        with-extra (mapcat #(followed-by % change? close?) with-nested)
+        with-extra (mapcat #(followed-by % change? close? delete?) with-nested)
         package {:_meta {}
                  :dataset dataset
                  :features (take total with-extra)}]
@@ -145,6 +156,11 @@
     (with-open [w (clojure.java.io/writer (str ".test-files/close-features-single-collection-" c ".json"))]
       (random-json-features w "closeset" "collection1" c :close? true))))

+(defn generate-test-files-with-deletes []
+  (doseq [c [10 100 1000 10000 100000]]
+    (with-open [w (clojure.java.io/writer (str ".test-files/delete-features-single-collection-" c ".json"))]
+      (random-json-features w "deleteset" "collection1" c :delete? true))))
+
 (defn generate-test-files-with-nested-feature []
   (doseq [c [5 50 500 5000 50000]]
     (with-open [w (clojure.java.io/writer (str ".test-files/new-features-nested-feature-" c ".json"))]


Doc strings for all files in server.clj module

--- src/emender_jenkins/server.clj
+++ src/emender_jenkins/server.clj
@@ -10,7 +10,8 @@
 ;      Pavel Tisnovsky
 ;

-(ns emender-jenkins.server)
+(ns emender-jenkins.server
+    "Server module that accepts all requests from users and generates proper responses.")

 (require '[clojure.pprint           :as pprint])
 (require '[ring.util.response       :as http-response])
@@ -36,6 +37,7 @@
     (return-file "error.html" "text/html"))

 (defn get-hostname
+    "Returns hostname of the server."
     []
     (.. java.net.InetAddress getLocalHost getHostName))

@@ -53,6 +55,8 @@
                         api-part)))))))

 (defn api-call-handler
+    "This function is used to handle all API calls. Three parameters are expected:
+     data structure containing HTTP request, string with URI, and the HTTP method."
     [request uri method]
     (if (= uri "/api")
         (rest-api/info-handler request (get-hostname))
@@ -76,18 +80,22 @@
                                           (rest-api/unknown-call-handler uri method))))

 (defn restcall-options-handler
+    "Empty handler for OPTIONS method."
     []
     (println "Method:  OPTIONS")
     (-> (http-response/response "")
         (http-response/content-type "application/json")))

 (defn restcall-head-handler
+    "Empty handler for HEAD method."
     []
     (println "Method:  HEAD")
     (-> (http-response/response "")
         (http-response/content-type "application/json")))

 (defn non-api-call-handler
+    "This function is used to handle all API calls. Two parameters are expected:
+     data structure containing HTTP request and string with URI."
     [request uri]
     (condp = uri
         "/"                      (render-front-page request)


use assoc not update \!

use assoc not update \!

--- src/mermaid_ldjam/core.cljs
+++ src/mermaid_ldjam/core.cljs
@@ -19,8 +19,7 @@
   (let [entities (:entities state)
         entity (hidden-entity entities)
         new-entity (dissoc entity :hidden)]
-    (update-in state [:entities hidden-entity] new-entity)))
-
+    (assoc-in state [:entities hidden-entity] new-entity)))

 (def actions-map
   {[:look :window] {:text "You look outside the window and see your home, the mighty ocean." :action ""}


fix for auto share

fix for auto share

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -145,7 +145,7 @@
                            :channel slack-channel}
             share-ctx (-> ctx
                           (assoc :share-requests (list share-request))
-                          (api-common/rep (assoc :existing-entry entry-result))
+                          (assoc :existing-entry (api-common/rep entry-result))
                           (assoc :auto-share true))]
         (share-entry conn share-ctx (:uuid entry-result))))))


Keywordize keys in sql query result maps

--- src/fivethreeonern/sqlite.cljs
+++ src/fivethreeonern/sqlite.cljs
@@ -10,7 +10,7 @@
   (.executeSql tx query #js []
                (fn [tx results]
                  (if (empty? other-queries)
-                   (let [results (-> results .-rows .raw js->clj)]
+                   (let [results (-> results .-rows .raw (js->clj :keywordize-keys true))]
                      (final-cb results))
                    (execute-sql tx other-queries final-cb on-error)))
                on-error))


Deletes logging.

Deletes logging.

--- src/onyx/peer/operation.clj
+++ src/onyx/peer/operation.clj
@@ -31,20 +31,6 @@
   (let [drained-inputs (keys (into {} (filter second (:drained-inputs state))))]
     (= (into #{} drained-inputs)
        (into #{} (keys (:onyx.core/ingress-queues event))))))
-
-;; (defn dump [event uuid n-messages decompressed input state]
-;;   (prn "==")
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event))
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event) "::" (:onyx.core/ingress-queues event))
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event) "::" (:onyx.core/task event))
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event) "::" uuid)
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event) "::" n-messages)
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event) "::" (count decompressed))
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event) "::" (last (:onyx.core/batch event)))
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event) "::" state)
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event) "::" (learned-all-sentinels? event state))
-;;   (prn (:onyx.core/id event) "/" (:onyx.core/lifecycle-id event) "::" (drained-all-inputs? event state))
-;;   (prn "=="))

 (defn on-last-batch
   [{:keys [onyx.core/sync onyx.core/queue onyx.core/decompressed


Fix bug in robot-kata-routes test

Fix bug in robot-kata-routes test

--- test/clj/robot_kata/server_test.clj
+++ test/clj/robot_kata/server_test.clj
@@ -12,6 +12,6 @@
                            (let [resp (robot-kata-routes {:request-method :get :uri "/robot-kata.html" :headers {"if-modified-since" "Sat, 29 Oct 1994 19:43:31 GMT"}})]
                              (is (= 200 (:status resp)) "GET of '/robot-kata.html' returns 200 status")
                              (is (= "text/html" ((:headers resp) "Content-Type")) "GET of '/robot-kata.html' returns content type 'text/html'")
-                             (is (> ((:headers resp) "Content-Length") 0) "GET of '/robot-kata.html' returns content of length > 0") ) )
+                             (is (> (Integer. ((:headers resp) "Content-Length")) 0) "GET of '/robot-kata.html' returns content of length > 0") ) )
                   (testing "Page not found"
                            (is (= 0 1) "Implement page not found tests!") ) ) )


Fixed typo in rhythm.

Fixed typo in rhythm.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -36,7 +36,7 @@

 (def progression [I I II II II V I (update-in V [:base] lower)])

-(defn rythm-n-bass# [timing [chord1 chord2 & chords]]
+(defn rhythm-n-bass# [timing [chord1 chord2 & chords]]
   (do
     (at (timing 0) (note# (:base chord1)))
     (at (timing 2) (chord# (dissoc chord1 :base)))
@@ -44,7 +44,7 @@
     (at (timing 4) (note# (:base chord2)))
     (at (timing 6) (chord# (dissoc chord2 :base)))
     (if chords
-      (rythm-n-bass# (from timing 8) chords))))
+      (rhythm-n-bass# (from timing 8) chords))))

 (defn even-melody# [timing [note & notes]]
@@ -56,7 +56,7 @@
 (defn play# []
   (let [timing (from (bpm 120) 2)]
     (even-melody# timing (take 32 (cycle [9 7])))
-    (rythm-n-bass# timing (take 16 (cycle progression)))
+    (rhythm-n-bass# timing (take 16 (cycle progression)))
     (even-melody# (speed-up (from timing 31) 2) (map ionian [2 4 5 4 4 2 4]))
     (even-melody# (speed-up (from timing 39) 2) (map ionian [-3 1 2 1 1 -3 1]))
     (even-melody# (speed-up (from timing 47) 2) (map ionian [-3 1 2 1 1 -3 1 2 3 4]))


Simplify create-class

Simplify create-class

--- src/reagent/impl/component.cljs
+++ src/reagent/impl/component.cljs
@@ -222,12 +222,7 @@
   (let [spec (cljsify body)
         res (.createClass React spec)
         f (fn [& args]
-            (let [props (nth args 0 nil)
-                  hasmap (map? props)
-                  first-child (if (or hasmap (nil? props)) 1 0)]
-              (res (js-obj cljs-props    (if hasmap props)
-                           cljs-children (if (> (count args) first-child)
-                                           (subvec args first-child))))))]
+            (tmpl/as-component (apply vector res args)))]
     (set! (.-cljsReactClass f) res)
     (set! (.-cljsReactClass res) res)
     f))


rename print-schedule to show-schedule

rename print-schedule to show-schedule

--- src/overtone/music/time.clj
+++ src/overtone/music/time.clj
@@ -73,7 +73,7 @@
       (after-delay 0 #(apply f (#'clojure.core/spread args)))
       (after-delay delay-time #(apply f (#'clojure.core/spread args))))))

-(defn print-schedule
+(defn show-schedule
   "Print the schedule of currently running audio players."
   []
-  (at-at/print-schedule player-pool))
+  (at-at/show-schedule player-pool))


add in a small delay on view_log entries to account for the fact that MySQL datetimes don't include milliseconds.

--- test/metabase/api/activity_test.clj
+++ test/metabase/api/activity_test.clj
@@ -158,8 +158,10 @@
                         :model    model
                         :model_id model-id
                         :timestamp (u/new-sql-timestamp))
-                      ;; we sleep a few milliseconds to ensure no events have the same timestamp
-                      (Thread/sleep 5))]
+                      ;; we sleep a bit to ensure no events have the same timestamp
+                      ;; sadly, MySQL doesn't support milliseconds so we have to wait a second
+                      ;; otherwise our records are out of order and this test fails :(
+                      (Thread/sleep 1000))]
     (do
       (create-view (user->id :crowberto) "card" (:id card2))
       (create-view (user->id :crowberto) "dashboard" (:id dash1))


Make with-resources take many setup functions

Thanks for proposing @cgrand!

--- test/powderkeg/integration_test.clj
+++ test/powderkeg/integration_test.clj
@@ -59,16 +59,19 @@
   (when-not (System/getenv "CIRCLECI")
     (sh! "docker" "rm" instance)))

-(defmacro with-resource
+(defmacro with-resources
   "Setup resources and tear them down after running body.
+  Takes a function, which when called, will setup necessary resources,
+  and returns a function, which when called, will tear the resources down.

-  Takes a function, which when called, will setup necessary resources,
-  and returns a function, which when called, will tear the resources down"
-  [setup & body]
-  `(let [teardown# (~setup)]
-     (try
-       (do ~@body)
-       (finally (teardown#)))))
+  Can be given multiple setup functions, which are called in order"
+  [setups & body]
+  (if-some [[setup & setups] (seq setups)]
+    `(let [teardown# (~setup)]
+       (try
+         (with-resources [~@setups] ~@body)
+         (finally (teardown#))))
+    `(do ~@body)))

 (defn start-spark [version]
   (let [pwd (.getAbsolutePath (java.io.File. ""))]
@@ -96,21 +99,17 @@
   #(keg/disconnect!))

 (deftest ^:integration rdd-spark-2.1.0
-  (with-resource
-    (spark "2.1.0-hadoop-2.7")
-    (with-resource
-      clojure-dynamic-classloader
-      (with-resource
-        keg-connection
-        (is (= (into [] (keg/rdd (range 10)))
-               (range 10)))))))
+  (with-resources
+    [(spark "2.1.0-hadoop-2.7")
+     clojure-dynamic-classloader
+     keg-connection]
+    (is (= (into [] (keg/rdd (range 10)))
+           (range 10)))))

 (deftest ^:integration rdd-spark-1.5.2
-  (with-resource
-    (spark "1.5.2-hadoop-2.6")
-    (with-resource
-      clojure-dynamic-classloader
-      (with-resource
-        keg-connection
-        (is (= (into [] (keg/rdd (range 10)))
-               (range 10)))))))
+  (with-resources
+    [(spark "1.5.2-hadoop-2.6")
+     clojure-dynamic-classloader
+     keg-connection]
+    (is (= (into [] (keg/rdd (range 10)))
+           (range 10)))))


Make sure the acl pattern is a vector and not a lazyseq

Otherwise comparison during ordering can fail.

--- src/puppetlabs/trapperkeeper/authorization/acl.clj
+++ src/puppetlabs/trapperkeeper/authorization/acl.clj
@@ -71,7 +71,7 @@
     (compare (deny? b) (deny? a))
     (if (ip? a)
       (compare (str (a :pattern)) (str (b :pattern)))
-      (compare (a :pattern) (b :pattern)))))
+      (compare (dbg (a :pattern)) (dbg (b :pattern))))))

 (def empty-acl (sorted-set-by ace-compare))

@@ -79,7 +79,7 @@

 (defn munge-name
   [pattern]
-  (-> pattern (str/lower-case) (str/split #"\.") reverse))
+  (-> pattern (str/lower-case) (str/split #"\.") reverse vec))

 (def allow-all { :auth-type :allow :type :allow-all :qualifier :exact :length nil :pattern [] })

@@ -94,7 +94,7 @@
     (re-matches #"^(\w[-\w]*\.)+[-\w]+$" pattern) { :auth-type type :type :domain :qualifier :exact :length nil :pattern (munge-name pattern) }
     ; *.domain.com
     (re-matches #"^\*(\.(\w[-\w]*)){1,}$" pattern)
-      (let [host_sans_star (drop-last (munge-name pattern))]
+      (let [host_sans_star (vec (drop-last (munge-name pattern)))]
         {:auth-type type :type :domain :qualifier :inexact :length (count host_sans_star) :pattern host_sans_star})
     ; backreference
     (re-find #"\$\d+" pattern) {:auth-type type :type :dynamic :qualifier :exact :length nil :pattern (munge-name pattern)}


Doc return values of web fns.

Doc return values of web fns.

--- web/src/immutant/web.clj
+++ web/src/immutant/web.clj
@@ -45,7 +45,7 @@
   "Mount a handler at a context path on a server. The handler is
   typically a Ring function, taking a request map and returning a
   response map, but it can also be an instance of
-  io.undertow.server.HttpHandler"
+  io.undertow.server.HttpHandler. Returns the server instance."
   [server handler & {:as opts}]
   (let [opts (->> (keywordize-keys opts)
                (merge {:context-path "/"})
@@ -79,7 +79,8 @@

 (defn ^{:valid-options #{:context-path}}
   mount-servlet
-  "Mount a servlet on a server"
+  "Mount a servlet on a server.
+   Returns the server instance."
   [server servlet & {:as opts}]
   (let [opts (->> (keywordize-keys opts)
                (merge {:context-path "/"})


define support node

define support node

--- src/synthesis_crawlers/core.clj
+++ src/synthesis_crawlers/core.clj
@@ -199,7 +199,16 @@
                                                      (s/coll-of #(instance? Element %))))))
 (defn find-support-nodes
   [url-attr-nodes]
-  nil)
+  (let [result (for [[url attr-nodes] url-attr-nodes
+                     [attr nodes] attr-nodes
+                     node (set (flatten (map reachable-elements nodes)))]
+                 [url [node nodes]])]
+    (reduce (fn [acc [url [node nodes]]]
+              (let [node-nodes (get acc url {})
+                    node-set (get node-nodes node #{})]
+                (assoc acc url (assoc node-nodes node (into node-set nodes)))))
+            {}
+            result)))

 #_(let [best-attr-set (keys (filter (fn [[attr nodes]] (not-empty nodes)) attr-nodes))]
     best-attr-set)


renaming request-reddit-auth-token to reddit-request-auth-token

name all fns that deal with reddit api to start with reddit-

--- src/saved_for_reddit/core.cljs
+++ src/saved_for_reddit/core.cljs
@@ -55,7 +55,7 @@
             (get-all-saved-posts token username saved-posts))
           (handle-error (str error " " (:error-text response) "\nYour API token might've expired."))))))

-(defn request-reddit-auth-token [client-id redirect-uri code]
+(defn reddit-request-auth-token [client-id redirect-uri code]
   ;; request reddit api token from code provided by reddit
   (go (let [response (<! (http/post "https://www.reddit.com/api/v1/access_token"
                                     {:with-credentials? false
@@ -72,9 +72,7 @@
             ]
         #_(println response) ;; will it block here till body is available?
         (if (clojure.string/blank? error)
-          (do
-            (set-app-state-field :token access-token)
-            )
+          (set-app-state-field :token access-token)
           (handle-error error)))))

 ;; Starting point
@@ -97,7 +95,7 @@
             (if  (clojure.string/blank? (:token @app-state))
               ;; app-state does not contain auth-token
               ;; retreive auth-token from reddit api
-              (request-reddit-auth-token client-id redirect-uri code))
+              (reddit-request-auth-token client-id redirect-uri code))
             ;; access-token should exist in app-state by this point
             (get-username (:token @app-state))
             (go (js/setTimeout #(refresh-reddit-auth-token client-id redirect-uri) 3300000)))


New functions for read products sorted by name and read authors sorted by name too

--- src/arachnida/db_interface.clj
+++ src/arachnida/db_interface.clj
@@ -58,6 +58,13 @@
                                 :files_changed files-changed
                                 :insertions insertions
                                 :deletions deletions}))
+
+(defn read-autor-names
+    []
+    (jdbc/query db-spec/data-db
+                               ["select author
+                                 from commits
+                                 group by author order by author"]))

 (defn read-authors
     []


add 12 and 24 to text size options

add 12 and 24 to text size options

--- src-cljs/frontend/state.cljs
+++ src-cljs/frontend/state.cljs
@@ -90,7 +90,7 @@
 (def tools #{:pen :select :line :text :rect :circle})
 (def default-font-family "Roboto")
 (def default-font-size 20)
-(def font-options [16 20 32])
+(def font-options [12 16 20 24 32])

 (def user-path [:current-user])


Test explanation

Test explanation

--- test/cljs/fatlip/core_test.cljs
+++ test/cljs/fatlip/core_test.cljs
@@ -6,7 +6,8 @@

 (deftest graph-properties
   (let [input [{:groups [{:characters [:a :a]}]}]]
-    (is (thrown? js/Error (f/make-sparse-graph input))))
+    (is (thrown? js/Error (f/make-sparse-graph input))
+        "Duplicate characters in a layer throw an error"))

   (let [input [{:duration 10
                 :groups [{:characters [:a :b :c]}


Reimplement auth frontend code using simple http api.

--- src/uxbox/frontend/auth.clj
+++ src/uxbox/frontend/auth.clj
@@ -5,17 +5,17 @@
 ;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>

 (ns uxbox.frontend.auth
-  (:require [catacumba.handlers.postal :as pc]
+  (:require [catacumba.http :as http]
             [promesa.core :as p]
             [uxbox.schema :as us]
-            [uxbox.frontend.core :refer (-handler)]
+            [uxbox.frontend.core :as ufc]
             [uxbox.services :as sv]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Schema
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(def +auth-frame-schema+
+(def +auth-schema+
   {:username [us/required us/string]
    :password [us/required us/string]
    :scope [us/required us/string]})
@@ -24,9 +24,9 @@
 ;; Handlers
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defmethod -handler [:novelty :auth/login]
-  [context {:keys [data dest]}]
-  (p/alet [data (us/extract! data +auth-frame-schema+)
-           data (assoc data :type dest)
+(defn login
+  [{:keys [data] :as context}]
+  (p/alet [data (us/extract! data +auth-schema+)
+           data (assoc data :type :auth/login)
            resp (p/await (sv/novelty data))]
-    (pc/frame resp)))
+    (http/ok (ufc/rsp resp))))


add new table-mount and home functions

add new table-mount and home functions

--- src_cljs/rrms/corecljs.cljs
+++ src_cljs/rrms/corecljs.cljs
@@ -26,7 +26,6 @@
 (defn http-get [url callback]
   (xhr/send url callback))

-
 (defn http-post [url callback data]
   (xhr/send url callback "POST" data  (structs/Map. (clj->js {:Content-Type "application/json"}))))

@@ -41,15 +40,18 @@
                 (r/render [render-documents (getdata json)]
                           (.getElementById js/document "app1")))]
     (http-get (str "http://localhost:8193/documents/title/" stext) onres)))
+
 (defn row [label input]
   [:div.row
    [:div.col-md-2 [:label label]]
    [:div.col-md-5 input]])
+
 (defn radio [label name value]
   [:div.radio
    [:label
     [:input {:field :radio :name name :value value}]
     label]])
+
 (defn input
   ([label type id value]
    (row label [:input.form-control {:type type :id id :defaultValue value}]))
@@ -64,9 +66,7 @@
    :title (getinputvalue "title")
    :employeename (getinputvalue "employeename")
    :date (getinputvalue "date")
-   :location (getinputvalue "location")
-   })
-
+   :location (getinputvalue "location") })

 (defn save [event]
   (let [onres (fn[data] (set! (.-location js/window) "http://localhost:8193"))]
@@ -81,8 +81,7 @@
    [:div#dt (input "Date":Date :date)]
    [:div#loc (input "Location":text :location)]
    [:input {:type "button" :value "Save"
-            :class "btn btn-primary" :on-click save}]
-   ])
+            :class "btn btn-primary" :on-click save}]])

 (defn get-update-documents-formdata []
   {
@@ -91,10 +90,7 @@
    :title (getinputvalue "upd_title")
    :employeename (getinputvalue "upd_employeename")
    :date (getinputvalue "upd_date")
-   :location (getinputvalue "upd_location")
-   })
-
-
+   :location (getinputvalue "upd_location")})

 (defn click-update[id]
   (.assign js/location (str "#/documents/update/" id)))
@@ -104,7 +100,6 @@
                 (.assign js/location "/"))]
     (http-post "http://localhost:8193/documents/update"
                onres (.serialize (Serializer.) (clj->js (get-update-documents-formdata))))))
-

 (defn document-update-template [id dmt]
   [:div.form-group {:id "update" :class "form-group"}
@@ -173,20 +168,23 @@
                               ;;               :class "glyphicon glyphicon-remove"  :value "Delete"}]]
                               [:td  [:a {:href "javascript:;" :on-click #(delete(.-id dn))  :class "glyphicon glyphicon-remove"}] ]

-                              ])]]]
-      ]
-
-     ]
-
-    ]
+                              ])]]]]]]
    ;; [:div.padding]
    ;;  [:div.page-footer [:h4 "Copyright All Rights Reserved © 2016 TechnoIdentity Solutions Pvt.Ltd"]]
    ])
+(defn table-mount []
+  (.ready (js/$ js/document)
+          (fn []
+            (.DataTable (js/$ "#example1")))))
+(defn home [documents]
+  (r/create-class {:reagent-render render-documents
+                   :component-did-mount table-mount }))
+

 (defroute home-path "/" []
   (let [onres (fn [json]
                 ((reset! documents (getdata json))
-                 (r/render [render-documents @documents]
+                 (r/render [home @documents]
                            (.getElementById js/document "app1"))))]
     (http-get "http://localhost:8193/documents/all" onres)))


Round robin multi job test works now.

Round robin multi job test works now.

--- test/onyx/log/round_robin_multi_job_test.clj
+++ test/onyx/log/round_robin_multi_job_test.clj
@@ -137,13 +137,6 @@
           task-d (nth (get-in new-replica [:tasks j2]) 0)
           task-e (nth (get-in new-replica [:tasks j2]) 1)
           task-f (nth (get-in new-replica [:tasks j2]) 2)]
-      (println "round robin multi job test " task-d task-e task-f
-                   (count (get (get (:allocations new-replica) j1) task-a))
-                   (count (get (get (:allocations new-replica) j1) task-b))
-                   (count (get (get (:allocations new-replica) j1) task-c))
-                   (count (get (get (:allocations new-replica) j2) task-d))
-                   (count (get (get (:allocations new-replica) j2) task-e))
-                   (count (get (get (:allocations new-replica) j2) task-f)))
       (if-not (and (= (count (get (get (:allocations new-replica) j1) task-a)) 0)
                    (= (count (get (get (:allocations new-replica) j1) task-b)) 0)
                    (= (count (get (get (:allocations new-replica) j1) task-c)) 0)
@@ -157,5 +150,5 @@
   (onyx.api/shutdown-peer v-peer))

 (onyx.api/shutdown-env env)
-(fact true => true)
+(fact "Peers balanced after job killed in multi-job test" true => true)


fix tests and add new testcase for behavior added in last commit

--- test/clj/lambdacd/internal/pipeline_state_test.clj
+++ test/clj/lambdacd/internal/pipeline_state_test.clj
@@ -65,18 +65,19 @@
           callback (fn [& _] (swap! call-counter inc))]
       (notify-when-most-recent-build-running { :_pipeline-state pipeline-state} callback)
       (is (= 0 @call-counter))
-      (update {:step-id [0] :_pipeline-state pipeline-state  :build-number 0 } {:status :success})
-      (is (= 1 @call-counter))
       (update {:step-id [1] :_pipeline-state pipeline-state  :build-number 0 } {:status :success})
       (is (= 1 @call-counter))
-      (update {:step-id [0] :_pipeline-state pipeline-state  :build-number 1 } {:status :waiting})
+      (update {:step-id [2] :_pipeline-state pipeline-state  :build-number 0 } {:status :success})
       (is (= 1 @call-counter))
-      (update {:step-id [0] :_pipeline-state pipeline-state  :build-number 1 } {:status :running})
+      (update {:step-id [1] :_pipeline-state pipeline-state  :build-number 1 } {:status :waiting})
       (is (= 1 @call-counter))
-      (update {:step-id [0] :_pipeline-state pipeline-state  :build-number 1 } {:status :failure})
+      (update {:step-id [1] :_pipeline-state pipeline-state  :build-number 1 } {:status :running})
+      (is (= 1 @call-counter))
+      (update {:step-id [1] :_pipeline-state pipeline-state  :build-number 1 } {:status :failure})
       (is (= 2 @call-counter))
-      (update {:step-id [0] :_pipeline-state pipeline-state  :build-number 1 } {:status :failure})
+      (update {:step-id [1] :_pipeline-state pipeline-state  :build-number 1 } {:status :failure})
       (is (= 2 @call-counter))
-      (update {:step-id [1] :_pipeline-state pipeline-state  :build-number 2 } {:status :ok :retrigger-mock-for-build-number 1 })
+      (update {:step-id [2] :_pipeline-state pipeline-state  :build-number 2 } {:status :ok :retrigger-mock-for-build-number 1 })
       (is (= 2 @call-counter))
-      )))
+      (update {:step-id [2] :_pipeline-state pipeline-state  :build-number 3 } {:status :ok })
+      (is (= 2 @call-counter)))))


Extract integration card to component

Extract integration card to component

--- src-cljs/frontend/components/pages/user_settings/integrations.cljs
+++ src-cljs/frontend/components/pages/user_settings/integrations.cljs
@@ -1,13 +1,26 @@
 (ns frontend.components.pages.user-settings.integrations
   (:require [frontend.components.pieces.card :as card]
             [frontend.models.user :as user]
+            [frontend.utils.function-query :as fq :include-macros true]
             [om.next :as om-next :refer-macros [defui]])
   (:require-macros [frontend.utils :refer [html]]))
+
+(defn- card
+  {::fq/queries {:identity [:identity/login]}}
+  [name identity]
+  (card/titled {:title name}
+               (html
+                [:div
+                 [:p "Build and deploy your " name " repositories."]
+                 (if identity
+                   [:p "Connected to " (:identity/login identity) "."]
+                   [:p "Not connected."])])))

 (defui Subpage
   static om-next/IQuery
   (query [this]
-    [{:app/current-user [{:user/identities [:identity/type :identity/login]}]}])
+    [{:app/current-user [{:user/identities (fq/merge [:identity/type]
+                                                     (fq/get card :identity))}]}])
   Object
   (render [this]
     (let [{[github-identity] "github"
@@ -15,17 +28,5 @@
           (group-by :identity/type
                     (-> (om-next/props this) :app/current-user :user/identities))]
       (card/collection
-       [(card/titled {:title "GitHub"}
-                     (html
-                      [:div
-                       [:p "Build and deploy your GitHub repositories."]
-                       (if github-identity
-                         [:p "Connected to " (:identity/login github-identity) "."]
-                         [:p "Not connected."])]))
-        (card/titled {:title "Bitbucket"}
-                     (html
-                      [:div
-                       [:p "Build and deploy your Bitbucket repositories."]
-                       (if bitbucket-identity
-                         [:p "Connected to " (:identity/login bitbucket-identity) "."]
-                         [:p "Not connected."])]))]))))
+       [(card "GitHub" github-identity)
+        (card "Bitbucket" bitbucket-identity)]))))


Fix typo on tests main ns.

Fix typo on tests main ns.

--- test/beicon/tests/main.cljc
+++ test/beicon/tests/main.cljc
@@ -5,7 +5,7 @@
 #?(:cljs
    (do
      (enable-console-print!)
-     (set! *main-cli-fn* #(t/run-tests 'promesa.tests.test-core)))
+     (set! *main-cli-fn* #(t/run-tests 'beicon.tests.test-core)))
    :clj
    (defn -main
      [& args]


BUGFIX: Shouldn't add the current reference when a new one is retrieved

--- src-cljs/tropology/core.cljs
+++ src-cljs/tropology/core.cljs
@@ -15,7 +15,7 @@

 (defn general-query
-  [db, [sid element-id]]
+  [db [sid element-id]]
   (reaction (get-in @db [sid element-id])))

 (re-frame/register-sub :ui-state general-query)
@@ -186,7 +186,7 @@
       ; [:p "Hello article"]
       [:input {:type     "button"
                :value    "Retrieve references"
-               :on-click #(re-frame/dispatch [:load-article (:trope-code @form-data)])}]
+               :on-click #(re-frame/dispatch [:load-article (:trope-code @form-data) false])}]
       [:div {:id "current-trope"}
        [:h2 {:class "trope-title"} (:title @current-article)]
        [:p (:description @current-article)]]


Use clojure.java.io/file to concatenate paths in test

--- test/cljam/io/util_test.clj
+++ test/cljam/io/util_test.clj
@@ -13,9 +13,10 @@
             [cljam.io.bigwig :as bigwig]))

 (deftest about-file-type-detection
-  (are [?path ?expected] (and (= (io-util/file-type ?path) ?expected)
-                              (= (io-util/file-type (str "./" ?path)) ?expected)
-                              (= (io-util/file-type (str "/home/bar/" ?path)) ?expected))
+  (are [?path ?expected]
+       (and (= (io-util/file-type ?path) ?expected)
+            (= (io-util/file-type (cio/file "./" ?path)) ?expected)
+            (= (io-util/file-type (cio/file "/home/bar" ?path)) ?expected))
     "foo.bam" :bam
     "foo.BAM" :bam
     "foo.bam.bai" :bai
@@ -69,7 +70,7 @@
     "foo.bw" :bigwig
     "foo.BW" :bigwig)
   (are [?dir]
-       (are [?path] (thrown? Exception (io-util/file-type (str ?dir ?path)))
+       (are [?path] (thrown? Exception (io-util/file-type (cio/file ?dir ?path)))
          "foo.bam.gz"
          "foo.SAM.gz"
          "foo.cram"


keys unit tests

keys unit tests

--- test/clojure/migae/keys.clj
+++ test/clojure/migae/keys.clj
@@ -226,10 +226,10 @@
     (ds/ekey? (ds/entity-key [:Family/Felidae :Subfamily/Felinae :Genus/Felis :Species/Felis_catus]))))

-(deftest ^:keychain keychain20
-  (testing "keychain string key literals 2"
-    (ds/ekey? (ds/entity-key [:Subfamily :Felinae :Genus :Felis]))
-    (ds/ekey? (ds/entity-key ["Subfamily" "Felinae" "Genus" "Felis"]))))
+;; (deftest ^:keychain keychain20
+;;   (testing "keychain string key literals 2"
+;;     (ds/ekey? (ds/entity-key [:Subfamily :Felinae :Genus :Felis]))
+;;     (ds/ekey? (ds/entity-key ["Subfamily" "Felinae" "Genus" "Felis"]))))

 ;; TODO: support string syntax:
 ;; (deftest ^:keychain keychain30
@@ -253,3 +253,9 @@
     (let [e1 (ds/entity-map [:Foo/Bar :Baz/Buz :X/Y] {:a 1 :b 2})]
       (log/trace "e1" (ds/print e1)))
       ))
+
+;; (deftest ^:reader reader
+;;   (testing "reader foo"
+;;     (let [e1 #migae/em [:Foo/Bar] {:a 1}]
+;;       (log/trace "e1" (ds/print e1))
+;;       )))


fix docker test

fix docker test

--- test/denvr/docker_test.cljs
+++ test/denvr/docker_test.cljs
@@ -13,8 +13,8 @@
 (deftest start-status-stop-test
   (async
    done
-   (go (let [name (gensym "test")
-             env {:containers [{:id "nginx" :image "nginx"}]}
+   (go (let [name (str (gensym "test"))
+             env {:containers [{:id "nginx" :image "nginx:1.9.8"}]}
              id' (atom nil)]
          (testing "validate env"
            (is (= env (cfg/check-env env))))


additional optional database filename parameter

--- src/ads_txt_crawler/core.clj
+++ src/ads_txt_crawler/core.clj
@@ -10,15 +10,12 @@

 (def cli-options
   ;; domain list file
-  [["-t" "--targets FILE" "List of domains to crawl ads.txt files from"]])
+  [["-t" "--targets FILE" "List of domains to crawl ads.txt files from"]
+   ["-d" "--database FILE" "Database to dump crawled data into"]])

-(defn -main
-  ""
-  [& args]
+(defn -main [& args]
   (let [opts (parse-opts args cli-options)]
     (let [fname (or (:targets (:options opts)) targets-file)
-          domain (:domain (:options opts))]
-          (if domain
-            (c/crawl-domain domain)
-            (c/crawl fname)))))
+          database (:database (:options opts))]
+      (c/crawl fname database))))


move noun-related default rule to noun group

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2315,6 +2315,13 @@
                     {:english {:agr agr}
                      :synsem {:cat :noun
                               :agr agr}}))
+
+                 ;; A pronoun is either reflexive or not reflexive, but
+                 ;; a non-pronoun is never reflexive.
+                 (default
+                  {:synsem {:cat :noun
+                            :pronoun false
+                            :reflexive false}})

                  ;; </noun default rules>

@@ -2448,13 +2455,6 @@
                   {:synsem {:cat :verb
                             :subcat {:2 {:subcat '()}}}})

-                 ;; A pronoun is either reflexive or not reflexive, but
-                 ;; a non-pronoun is never reflexive.
-                 (default
-                  {:synsem {:cat :noun
-                            :pronoun false
-                            :reflexive false}})
-
                  ;; </verb default rules>

                  ))))


s/anoncier/annoncer/

s/anoncier/annoncer/

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -41,9 +41,9 @@
                      :sem {:subj {:animate true}
                            :pred :go}}}

-   "anoncier" {:synsem {:cat :verb
-                        :sem {:pred :announce}}}
-
+   "annoncer" {:synsem {:cat :verb
+                       :sem {:pred :announce}}}
+
    "appeler" {:synsem {:cat :verb
                        :boot-stem "appell"
                        :future-stem "appell"


"volere" => "have to", not "want"

"volere" => "have to", not "want"

--- src/babel/italiano/lexicon.clj
+++ src/babel/italiano/lexicon.clj
@@ -2014,7 +2014,7 @@
               :subcat '()}}]

     "volere" {:synsem {:cat :verb
-                       :sem {:pred :have-to}}
+                       :sem {:pred :want}}
               :italiano {:future-stem "vorr"
                          :drop-e true
                          :present {:1sing "voglio"


Fix italic? -> italics? in wpml

Fix italic? -> italics? in wpml

--- src/bakyeono/litedocx/wpml.clj
+++ src/bakyeono/litedocx/wpml.clj
@@ -391,7 +391,7 @@
                      space-before space-after space-line
                      indent-left indent-right indent-first-line mirror-indents?)
              (ppr options))
-           (when (or font font-size font-color bold? italic? underline?)
+           (when (or font font-size font-color bold? italics? underline?)
              (rpr options)))
      (when font
        ;; Font Style Definition for above Paragraph Style
@@ -439,7 +439,7 @@
                      space-before space-after space-line
                      indent-left indent-right indent-first-line mirror-indents?)
              (ppr options))
-           (when (or font font-size font-color bold? italic? underline?)
+           (when (or font font-size font-color bold? italics? underline?)
              (rpr options))
            ;; Style Table Properties
            (node :w:tblPr {}


removed class attr for a tags and replaced them with dot notation

--- src/braid/ui/views/header.cljs
+++ src/braid/ui/views/header.cljs
@@ -19,27 +19,24 @@
     (fn []
       (let [path (routes/inbox-page-path {:group-id @open-group-id})]
         [:div.inbox.shortcut {:class (when (routes/current-path? path) "active")}
-          [:a {:href path
-               :class "title"
-               :title "Inbox"}]]))))
+          [:a.title {:href path
+                     :title "Inbox"}]]))))

 (defn recent-page-button-view [{:keys [subscribe]}]
   (let [open-group-id (subscribe [:open-group-id])]
     (fn []
       (let [path (routes/recent-page-path {:group-id @open-group-id})]
         [:div.recent.shortcut {:class (when (routes/current-path? path) "active")}
-          [:a {:href path
-               :class "title"
-               :title "Recent"}]]))))
+          [:a.title {:href path
+                     :title "Recent"}]]))))

 (defn help-page-pane-view [{:keys [subscribe]}]
   (let [open-group-id (subscribe [:open-group-id])]
     (fn []
       (let [path (routes/help-page-path {:group-id @open-group-id})]
         [:div.help.shortcut {:class (when (routes/current-path? path) "active")}
-          [:a {:href path
-               :class "title"
-               :title "Help"}]
+          [:a.title {:href path
+                     :title "Help"}]
           [:div.modal
             [:p "Conversations must be tagged to be seen by other people."]
             [:p "Tag a conversation by mentioning a tag in a message: ex. #general"]
@@ -61,14 +58,13 @@
                                            (user :status)))))
             path (routes/users-page-path {:group-id @open-group-id})]
         [:div.users.shortcut {:class (when (routes/current-path? path) "active")}
-          [:a {:href path
-               :class "title"
-               :title "Users"}
-            (count users-online)]
-           [:div.modal
-            [:h2 "Online"]
-            (for [user users-online]
-              [user-pill-view user subscribe])]]))))
+          [:a.title {:href path
+                     :title "Users"}
+                  (count users-online)]
+                 [:div.modal
+                  [:h2 "Online"]
+                  (for [user users-online]
+                    [user-pill-view user subscribe])]]))))

 (defn tags-pane-view [{:keys [subscribe]}]
@@ -105,11 +101,10 @@
     (fn []
       (let [path (routes/extensions-page-path {:group-id @open-group-id})]
         [:div.extensions.shortcut {:class (when (routes/current-path? path) "active")}
-          [:a {:href path
-               :class "title"
-               :title "Extensions"}]
-          [:div.modal
-            [:div "extensions"]]]))))
+          [:a.title {:href path
+                     :title "Extensions"}]
+                [:div.modal
+                  [:div "extensions"]]]))))

 (defn header-view [props]
   [:div.header


WIP: Add concept-identifier

WIP: Add concept-identifier

--- src/cfpb/qu/query/parser.clj
+++ src/cfpb/qu/query/parser.clj
@@ -57,6 +57,14 @@
   (let [ident (regex #"[A-Za-z][A-Za-z0-9\-_]*")]
     (keyword ident)))

+(defn concept-identifier
+  "Parse function for identifiers that look inside a concept."
+  []
+  (let [concept (identifier)
+        _ (chr \.)
+        ident (identifier)]
+    [concept ident]))
+
 (defn- comparison-normal []
   (let [[identifier op value]
         (series identifier comparison-operator value)]
@@ -156,9 +164,7 @@

 (defn- concept-select
   []
-  (let [concept (identifier)
-        _ (chr \.)
-        field (identifier)]
+  (let [[concept field] (concept-identifier)]
     {:select (keyword (str (name concept) "." (name field)))
      :concept concept
      :field field}))


(TK-35) Update multiserver example

(TK-35) Update multiserver example

Update the multiserver example to reflect the new changes
to the Jetty9 Webserver Service API.

--- examples/multiserver_app/src/examples/multiserver_app/example_services.clj
+++ examples/multiserver_app/src/examples/multiserver_app/example_services.clj
@@ -20,24 +20,24 @@

 (defservice hello-proxy-service
   [[:ConfigService get-in-config]
-   [:WebserverService add-proxy-route-to add-ring-handler-to]]
+   [:WebserverService add-proxy-route add-ring-handler]]
   (init [this context]
     (log/info "Initializing hello webservice")
     (let [url-prefix (get-in-config [:hello-web :url-prefix])]
       ; Since we're using the -to versions of the below functions and are specifying
       ; server-id :ziggy, these will be added to the :ziggy server specified in the
       ; config file.
-      (add-proxy-route-to
-        :ziggy
+      (add-proxy-route
         {:host "localhost"
          :port 8080
          :path "/hello"}
-        "/hello")
-      (add-ring-handler-to
-        :ziggy
+        "/hello"
+        {:server-id :ziggy})
+      (add-ring-handler
         (fn [req]
           {:status 200
            :headers {"Content-Type" "text/plain"}
            :body "Goodbye world"})
-        "/goodbye")
+        "/goodbye"
+        {:server-id :ziggy})
       (assoc context :url-prefix url-prefix))))


added few more cl arg validation

added few more cl arg validation

--- src/clinvar_submitter/core.clj
+++ src/clinvar_submitter/core.clj
@@ -14,11 +14,11 @@
 (def cli-options
   [;; output file defaults to clinvar-variant.csv and will not overwrite
    ;; unless -f force-overwrite option is specified
-   ["-o" "--output FILENAME" "CSV output filename"
-    :default "clinvar-variant.csv"]
+   ["-o" "--output FILENAME" "CSV output filename"]
+    ;:default "clinvar-variant.csv" :mandatory true]
    ["-f" "--force" :default false]
-   ["-x" "--jsonld-context URI" "JSON-LD context file URI"
-    :default "http://http://datamodel.clinicalgenome.org/interpretation/context/jsonld"]
+   ["-x" "--jsonld-context URI" "JSON-LD context file URI"]
+    ;:default "http://http://datamodel.clinicalgenome.org/interpretation/context/jsonld" :mandatory true]
    ["-i" "--input FILENAME" "JSON filename"
     :default "dmwg.json"]
    ["-b" "--build BUILD" "Genome build alignment, GRCh37 or GRCh38"
@@ -52,11 +52,13 @@
   (str "The following errors occurred while parsing your command:\n\n"
        (str/join \newline errors)))

+
 (defn validate-args
   "Validate command line arguments. Either return a map indicating the program
   should exit (with a error message, and optional ok status), or a map
   indicating the action the program should take and the options provided."
   [args]
+  (println args)
   (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)]
     (cond
       (:help options) ; help => exit OK with usage summary
@@ -145,21 +147,27 @@
   "take input assertion, transformation context, and output filename as input and write variant table in csv format"
   [& args]
   (let [{:keys [input options exit-message ok?]} (validate-args args)]
-  (log/debug "Input,output and context filename in main method: " input (get options :jsonld-context) (get options :output))
-  (report/write-report input (get options :jsonld-context) (get options :output) (get options :force) (get options :report))
-  (let [records (construct-variant-table input (get options :jsonld-context))]
+  ;(if (nil? (get options :jsonld-context)) (println "(use‚ -x to enter context file name)."))
+  ;(if (nil? (get options :output)) (println "(use‚ -o to enter output file name)."))
   (if exit-message
       (exit (if ok? 0 1) exit-message)
-  ;if output or report file exists then check if there is a force option. If there is no force option the throw an error with message
-  ;"ERROR 101 ‚output or report file exists! (use‚ -f Force overwrite to overwrite these files)." Otherwise create output and report file
-  (try
-      (if (and (.exists (io/as-file (get options :output))) (.exists (io/as-file (get options :report))))
-      (if (get options :force)
+
+  (if-not(or (nil? (get options :output)) (nil? (get options :jsonld-context)))
+    (let [records (construct-variant-table input (get options :jsonld-context))]
+    (log/debug "Input,output and context filename in main method: " input (get options :jsonld-context) (get options :output))
+    (report/write-report input (get options :jsonld-context) (get options :output) (get options :force) (get options :report))
+    (try
+    ;if output or report file exists then check if there is a force option. If there is no force option the throw an error with message
+      ;"ERROR 101 ‚output or report file exists! (use‚ -f Force overwrite to overwrite these files)." Otherwise create output and report file
+      (if(and (.exists (io/as-file (get options :output))) (.exists (io/as-file (get options :report))))
+        (if (get options :force)
+          [(spit (get options :output) (csv/write-csv records))
+          (report/append-to-report (get options :report) input (get options :output) records)]
+          (println "ERROR 101 ‚output or report file exists! (use‚ -f Force overwrite to overwrite these files)."))
         [(spit (get options :output) (csv/write-csv records))
-        (report/append-to-report (get options :report) input (get options :output) records)]
-        (println "ERROR 101 ‚output or report file exists! (use‚ -f Force overwrite to overwrite these files)."))
-        [(spit (get options :output) (csv/write-csv records))
-        (report/append-to-report (get options :report) input (get options :output) records)])
-  (catch Exception e (log/error (str "Exception in main: " e))))))))
+          (report/append-to-report (get options :report) input (get options :output) records)])
+    (catch Exception e (log/error (str "Exception in main: " e)))))
+    (usage cli-options)
+  ))))


Add ns docs per request in https://github.com/reddmetrics/forma-clj/pull/88#issuecomment-6975366

--- src/clj/forma/playground.clj
+++ src/clj/forma/playground.clj
@@ -1,4 +1,7 @@
 (ns forma.playground
+  "This namespace is a playground for playing in the playground with play things.
+  It mostly includes handy Thrift objects and Thrift memory taps for playing with
+  at the REPL."
   (:require [forma.thrift :as thrift]))

 ;; MODIS tile chunk:


Progressing with creating syntax for resolving json-ld maps

--- src/clinvar_submitter/core.clj
+++ src/clinvar_submitter/core.clj
@@ -1,9 +1,11 @@
 (ns clinvar-submitter.core
   (:require [cheshire.core :as json]
             [clojure.java.io :as io]
-            [clojure.pprint :refer [pprint]])
+            [clojure.pprint :refer [pprint]]
+            [clojure.walk :as walk])
   (:import [com.github.jsonldjava.core JsonLdProcessor JsonLdOptions]
-           [com.github.jsonldjava.utils JsonUtils])
+           [com.github.jsonldjava.utils JsonUtils]
+           [java.util Map List])
   (:gen-class))

 (def test-allele "data/CA090898.jsonld")
@@ -11,12 +13,50 @@
 (def test-interpretation "data/test_interp_1.dmwg.json")
 (def interpretation-cx "data/short-context.jsonld")
 (def frame "data/frame.jsonld")
-(defn flatten-allele
-  []
-  (let [allele (json/parse-stream (io/reader test-allele))
-        context (json/parse-stream (io/reader allele-cx))
-        opts (JsonLdOptions.)]
-    (-> (JsonLdProcessor/flatten allele context opts) JsonUtils/toPrettyString println)))
+
+
+;; TODO, this arrangement seems not to be handling collection types appropriately
+;; need to figure out why
+(defn resolve-id
+  "Return the referent of an identifier if found in symbol table
+  otherwise return a bare string"
+  [t s]
+  (println "resolve-id" s)
+  (if (instance? Map s) (if-let [v (get s "id")]
+                                        (resolve-id t v) s))
+  (if-let [ret (get t s)] ret s))
+
+(defn ld-get
+  "Get property from a map, if the property is a string matching a key
+  in the symbol table, return the value of that key instead. If the property
+  is a map with a single 'id' property, return either the value of the property
+  or the value of the referent of that property, if it exists in the symbol table"
+  [t loc prop]
+  (let [v (get loc prop)]
+    (cond
+      (string? v) (resolve-id t v)
+      (instance? Map v) (if-let [vn (get v "id")] (resolve-id t vn) v)
+      (instance? List v) (map #(resolve-id t %) v)
+      :else v)))
+
+(defn ld->
+  "Take a symbol table, a location, and a set of predicates,
+  return the set of nodes mapping to a given property"
+  [t loc & preds]
+  (reduce #(ld-get t %1 %2) loc preds))
+
+(defn convert-jsonld
+  "Convert java structures from jsonld library into clojure structures"
+  [m]
+  (walk/postwalk (fn [n] (cond
+                           (instance? Map n) (into {} n)
+                           (instance? List n) (into [] n)
+                           :else n)) m))
+
+(defn construct-symbol-table
+  [coll]
+  (let [graph (into [] (get coll "@graph"))]
+    (reduce (fn [acc v] (assoc acc (.get v "id") (convert-jsonld v))) {} graph)))

 (defn flatten-interpretation
   []
@@ -25,18 +65,20 @@
     (let [i (json/parse-stream ir)
           cx (json/parse-stream cxr)
           opts (JsonLdOptions.)]
-      (-> (JsonLdProcessor/flatten i cx opts) JsonUtils/toPrettyString println))))
+      (-> (JsonLdProcessor/flatten i cx opts) convert-jsonld))))

-(defn frame-interpretation
+(defn construct-variant
+  "Construct and return one row of variant table, with VariantInterpretation as root"
+  [t i]
+  (ld-> t i "cg:A122" "cg:relatedContextualAllele"))
+
+(defn construct-variant-table
+  "Construct and return variant table"
   []
-  (with-open [ir (io/input-stream test-interpretation)
-              fr (io/input-stream frame)]
-    (let [i (JsonUtils/fromInputStream ir)
-          f (JsonUtils/fromInputStream fr)
-          opts (JsonLdOptions.)]
-      ;;(.setEmbed opts true)
-      (.setExplicit opts true)
-      (-> (JsonLdProcessor/frame i f opts) JsonUtils/toPrettyString println))))
+  (let [t (construct-symbol-table (flatten-interpretation))
+        interps (vals (filter #(= "cg:VariantInterpretation" (-> % val (get "@type"))) t))
+        rows (map #(construct-variant t %) interps)]
+    rows))

 (defn -main
   "I don't do a whole lot ... yet."


process one pdf at a time, make pdf generation fail proof

--- src/clj/salava/badge/pdf.clj
+++ src/clj/salava/badge/pdf.clj
@@ -35,6 +35,22 @@
                            :endorsements (vec (select-badge-endorsements {:id (:badge_id %1)} (u/get-db ctx)))
                            :content %2)) badge-with-content temp)]
     (replace-nils badges)))
+
+(defn process-pdf-page [stylesheet template badge]
+  (let [p (slurp (io/piped-input-stream (fn [out] (pdf/pdf (into [stylesheet] (template badge)) out))))]
+    (if (blank? p)
+      (io/piped-input-stream (fn [out] (pdf/pdf [{} [:paragraph "Error while processing, Page can't be displayed"]] out)))
+      (io/piped-input-stream (fn [out] (pdf/pdf (into [stylesheet] (template badge)) out))))))
+
+
+(defn process-markdown [content markdown]
+  (if (== 1 (count markdown))
+    markdown
+    (let [markdown-to-clj (markdown->clj-pdf {:image {:x 10 :y 10} :spacer {:extra-starting-value 1 :allow-extra-line-breaks? true :single-value 2} :wrap {:global-wrapper :paragraph}} markdown)
+          p (slurp (io/piped-input-stream (fn [out] (pdf/pdf [{} markdown-to-clj] out))))]
+      (if (blank? p)
+        [:paragraph (str content " can't be displayed")]
+        markdown-to-clj))))

 (defn generatePDF [ctx user-id input lang]
   (let [data-dir (get-in ctx [:config :core :data-dir])
@@ -153,5 +169,6 @@

                            (reduce into [] content)))]
     (fn [output-stream]
-      (pdf/pdf (into [pdf-settings] (badge-template badges)) output-stream)))
-  )
+      (apply pdf/collate output-stream
+             (for [b badges]
+               (process-pdf-page pdf-settings badge-template (list b)))))))


Don't use special comic-list link->map on chapter list

--- src/clj/comic_reader/sites.clj
+++ src/clj/comic_reader/sites.clj
@@ -100,20 +100,21 @@
          manga-url     (format "%s/manga" canonical-url)
          mangalist-url (format "%s/mangalist/" canonical-url)
          manga-pattern (re-pattern (str manga-url "/(.*?)/"))
-         link->map (gen-link->map (comp #(s/replace % #"\"" "")
-                                        second)
-                                  identity)]
+         cl-link->map (gen-link->map (comp #(s/replace % #"\"" "")
+                                           second)
+                                     identity)
+         link->map (gen-link->map identity identity)]
      {:id :manga-here
       :name "Manga Here"
       :comic->url (fn [comic-id]
-                    (str canonical-url "/" comic-id))
+                    (str manga-url "/" comic-id))
       :comic-list-data {:url mangalist-url
                         :selector [:section.main
                                    :li :a.manga_info]
                         :normalize (comp (gen-add-key-from-url
                                           :id
                                           manga-pattern)
-                                         link->map)}
+                                         )}
       :chapter-list-data-for-comic
       (fn [comic-url]
         {:url comic-url


Prevent default in submit

Prevent default in submit

--- src/cljs/re_form/submit.cljs
+++ src/cljs/re_form/submit.cljs
@@ -9,10 +9,12 @@
     (str/join " " (str/split (name class) \.))
     class))

-(defn- submit-button* [{:keys [form-name] :as props} & children]
+(defn- submit-button* [{:keys [form-name prevent-default] :as props} & children]
   (let [form-errors (rf/subscribe [:re-form/form-errors form-name])
         form-value (rf/subscribe [:re-form/form-value form-name])
-        onclick (fn [submit-fn]
+        onclick (fn [ev submit-fn]
+                  (when prevent-default
+                    (.preventDefault ev))
                   (rf/dispatch [:re-form/start-submitting form-name])
                   (when (empty? @form-errors)
                     (and submit-fn (submit-fn @form-value))))]
@@ -20,7 +22,7 @@
     (fn [{:keys [submit-fn class]}]
       (into [:button.submit {:type "submit"
                              :class (process-class class)
-                             :on-click #(onclick submit-fn)}]
+                             :on-click #(onclick % submit-fn)}]
             children))))

 (defn submit-button [props & children]


fix Bifrost Array + Corp Sales team bug

fix Bifrost Array + Corp Sales team bug

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -78,9 +78,12 @@
    {:req (req (not (empty? (filter #(not= (:title %) "Bifrost Array") (:scored corp)))))
     :optional {:prompt "Trigger the ability of a scored agenda?"
                :yes-ability {:prompt "Choose an agenda to trigger its \"when scored\" ability"
-                             :choices (req (filter #(not= (:title %) "Bifrost Array") (:scored corp)))
+                             :choices {:req #(and (is-type? % "Agenda")
+                                                  (not= (:title %) "Bifrost Array")
+                                                  (= (first (:zone %)) :scored)
+                                                  (:abilities %))}
                              :msg (msg "trigger the \"when scored\" ability of " (:title target))
-                             :effect (effect (card-init target))}}}
+                             :effect (effect (resolve-ability (card-def target) target nil))}}}

    "Braintrust"
    {:effect (effect (set-prop card :counter (quot (- (:advance-counter card) 3) 2)))


ai best move

ai best move

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -42,7 +42,7 @@

 (defn- min-max-step
   [ai turn on-transition]
-  (min-max-step-by identity ai turn on-transition)) ;; TODO - avoid projection
+  (min-max-step-by identity ai turn on-transition))         ;; TODO - avoid projection

 ;; -----------------------------------------

@@ -53,7 +53,7 @@
       (summarize-score ai (reduce scores/update-scores scores transition))
       )))

-(defn tree-score
+(defn- tree-score
   [ai turn depth]
   (if (= 0 depth)
     (leaf-score ai turn)
@@ -63,6 +63,16 @@
           (turn/apply-transition turn transition)
           (dec depth))))
     ))
+
+(defn- best-move
+  [ai turn]
+  (first
+    (min-max-step-by
+      second ai turn
+      (fn [coord transition]
+        (let [new-turn (turn/apply-transition turn transition)]
+          [coord (tree-score ai new-turn 1)]))
+      )))

 ;; -----------------------------------------
 ;; Public API
@@ -76,15 +86,7 @@
   [game]
   (let [turn (game/current-turn game)
         ai (make-ai (:player turn))]
-    (:game
-      (min-max-step-by
-        :score ai turn
-        (fn [coord _]
-          (let [new-game (game/play-move game coord)
-                new-turn (game/current-turn new-game)]
-            {:game new-game                             ;; TODO - Not sure keeping game in memory is wise
-             :score (tree-score ai new-turn 1)})))
-      )))
+    (game/play-move game (best-move ai turn))))

 ;; -----------------------------------------


remove agenda points from the correct player

--- src/clj/game/cards-agendas.clj
+++ src/clj/game/cards-agendas.clj
@@ -3,12 +3,12 @@
 (def cards-agendas

   {"15 Minutes"
-   (let [agenda-owner :corp]
-     {:abilities [{:cost   [:click 1] :msg (msg (str "shuffle 15 Minutes into R&D " card))
+     {:abilities [{:cost   [:click 1] :msg "shuffle 15 Minutes into R&D"
                    :effect (req (move state :corp (dissoc card :seen :rezzed) :deck {:front true})
                                 (shuffle! state :corp :deck)
-                                (gain-agenda-point state agenda-owner -1))
-                   }]})
+                                (let [agenda-owner (if (= (:zone card) :scored) :corp :runner)]
+                                  (gain-agenda-point state agenda-owner -1)))
+                   }]}

    "Accelerated Beta Test"
    (letfn [(abt [n i]


high level ai counting the number of transitions available for it

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -6,11 +6,6 @@
     [triboard.logic.board :as board]
     [triboard.logic.game :as game]
     [triboard.logic.turn :as turn]))
-
-
-;; TODO - Plug other ways to score (like counting available transitions)
-;; * The high level AI will select the available transitions in early game
-;; * The high level AI will select the score for the late game

 ;; -----------------------------------------
@@ -31,16 +26,21 @@
       )))

 (defn- focus-human-player?
-  "High level AI to decude whether the AI ally against the human player"
   [{:keys [blue red green] :as scores}]
   (let [human-score (* 1.1 blue)]
     (and (< red human-score) (< green human-score))))

+(defn- limited-move-options?
+  [turn]
+  (< (count (turn/transitions turn)) 5))
+
 (defn- high-level-ai
-  [turn]
+  "High level AI: choose the right evaluation function to play"
+  [{:keys [player scores] :as turn}]
   (cond
-    (focus-human-player? (:scores turn)) (strategies/allied-against-player-ai)
-    :else (strategies/score-sensible-ai (:player turn))
+    (focus-human-player? scores) (strategies/allied-against-player-ai)
+    (limited-move-options? turn) (strategies/like-freedom-ai player)
+    :else (strategies/score-sensible-ai player)
     ))

 ;; -----------------------------------------


enable to add new todo items

enable to add new todo items

--- src/om_next_todolist/core.cljs
+++ src/om_next_todolist/core.cljs
@@ -4,6 +4,8 @@
             [om.dom :as dom]))

 (enable-console-print!)
+
+(def ENTER_KEY 13)

 (def app-state
   (atom {:todos [{:id 1 :title "豚肉を買ってくる"}
@@ -12,7 +14,42 @@
                  {:id 4 :title "じゃがいもを買ってくる"}
                  {:id 5 :title "カレーを作る"}]}))

+
+;; -----------------------------------------------------------------------------
+;; Parsing
+
+(defmulti read om/dispatch)
+
+(defmethod read :todos
+  [env key params]
+  (let [state (:state env)]
+    {:value (:todos @state)}))
+
+(defmulti mutate om/dispatch)
+
+(defn- gen-id
+  [todos]
+  (->> (map :id todos)
+       (apply max)
+       inc))
+
+(defmethod mutate 'todos/add
+  [env key params]
+  (let [state (:state env)
+        id (gen-id (:todos @state))
+        new-todo (assoc params :id id)]
+    {:action
+     (fn []
+       (swap! state update :todos conj new-todo))}))
+
+
+;; -----------------------------------------------------------------------------
+;; Components
+
 (defui TodoItem
+  static om/IQuery
+  (query [this]
+    [:id :title])
   Object
   (render [this]
     (let [props (om/props this)
@@ -21,15 +58,32 @@

 (def todo-item (om/factory TodoItem))

+(defn- handle-key-down
+  [component e]
+  (when (= (.-keyCode e) ENTER_KEY)
+    (let [new-field (.-target e)
+          title (.-value new-field)]
+      (om/transact! component `[(todos/add ~{:title title})])
+      (set! (.-value new-field) ""))))
+
 (defui TodoList
+  static om/IQuery
+  (query [this]
+    (let [subquery (om/get-query TodoItem)]
+      [{:todos subquery}]))
   Object
   (render [this]
     (let [props (om/props this)
           todos (:todos props)]
-      (apply dom/ul nil
-        (map todo-item todos)))))
+      (dom/div nil
+        (dom/input #js {:className "new-todo"
+                        :placeholder "What needs to be done?"
+                        :onKeyDown #(handle-key-down this %)})
+        (apply dom/ul nil
+          (map todo-item todos))))))

 (def reconciler
-  (om/reconciler {:state app-state}))
+  (om/reconciler {:state app-state
+                  :parser (om/parser {:read read :mutate mutate})}))

 (om/add-root! reconciler TodoList (gdom/getElement "app"))


make git checkout-and-execute delete working directory after it finishes

--- src/clj/lambdacd/steps/git.clj
+++ src/clj/lambdacd/steps/git.clj
@@ -9,7 +9,8 @@
             [lambdacd.presentation.pipeline-state :as pipeline-state]
             [lambdacd.steps.support :as support]
             [clojure.string :as s]
-            [clojure.java.io :as io]))
+            [clojure.java.io :as io]
+            [lambdacd.util :as utils]))

 (defn- current-revision [repo-uri branch]
   (let [shell-output (util/bash "/"
@@ -85,16 +86,17 @@
   (let [checkout-result (checkout ctx repo-uri revision)
         repo-location (:cwd checkout-result)
         checkout-exit-code (:exit checkout-result)]
-    (if (= 0 checkout-exit-code)
-      (let [execute-steps-result (execution/execute-steps steps (assoc args :cwd repo-location) (execution/new-base-context-for ctx))
-            result-with-checkout-output (assoc execute-steps-result :out (:out checkout-result))
-            step-ids (keys (:outputs execute-steps-result))
-            last-step-id (last-step-id-of step-ids)
-            output-of-last-step (get-in execute-steps-result [:outputs last-step-id])]
-        (merge result-with-checkout-output output-of-last-step))
-      {:status :failure
-       :out (:out checkout-result)
-       :exit (:exit checkout-result)})))
+    (utils/with-temp repo-location
+      (if (= 0 checkout-exit-code)
+        (let [execute-steps-result (execution/execute-steps steps (assoc args :cwd repo-location) (execution/new-base-context-for ctx))
+              result-with-checkout-output (assoc execute-steps-result :out (:out checkout-result))
+              step-ids (keys (:outputs execute-steps-result))
+              last-step-id (last-step-id-of step-ids)
+              output-of-last-step (get-in execute-steps-result [:outputs last-step-id])]
+          (merge result-with-checkout-output output-of-last-step))
+        {:status :failure
+         :out (:out checkout-result)
+         :exit (:exit checkout-result)}))))

 (defn with-git
   "creates a container-step that checks out a given revision from a repository.


Extract fns for clarity.

Extract fns for clarity.

--- src/cljs_bach/synthesis.cljs
+++ src/cljs_bach/synthesis.cljs
@@ -272,17 +272,19 @@
                    :handler #(set! (.-data psuedo-promise) %)})
     (fn [context at duration]
       (source
-        (let [node (.createGain context)]
-          (when-let [data (.-data psuedo-promise)]
-            (let [buffer (.-buffer psuedo-promise)
-                  add-buffer #(doto (.createBufferSource context)
-                                (-> .-buffer (set! (.-buffer psuedo-promise)))
-                                (.start at)
-                                (.connect node))]
-              (if buffer
-                (add-buffer)
-                (.decodeAudioData context data #(do (set! (.-buffer psuedo-promise) %)
-                                                    (add-buffer))))))
+        (let [node (.createGain context)
+              play-buffer (fn [buffer]
+                            (doto (.createBufferSource context)
+                              (-> .-buffer (set! buffer))
+                              (.start at)
+                              (.connect node)))
+              set-and-play-buffer (fn [buffer]
+                                    (set! (.-buffer psuedo-promise) buffer)
+                                    (play-buffer buffer))]
+          (when-let [data (.-data psuedo-promise)] ; Has the ajax call returned?
+            (if-let [buffer (.-buffer psuedo-promise)] ; Has the buffer been decoded?
+              (play-buffer buffer)
+              (.decodeAudioData context data set-and-play-buffer)))
           node)))))

 (def ^:export sample (memoize raw-sample))


Badger badger badger badger

Badger badger badger badger

--- src/clj/mokkameister/train.clj
+++ src/clj/mokkameister/train.clj
@@ -47,6 +47,8 @@
    (train ":coffee:" ":jan-richter:")
    (train ":syringe:" ":hocho:")
    (train ":coffee:" ":heavy_heart_exclamation_mark_ornament:")
+   (train ":coffee:" ":badger:" ":mushroom:")
+   (train ":coffee:" ":coffeepot:" ":heart:")
    ":steam_locomotive::coffee::coffee::running::running::running::dash:"
    "All aboard the coffee train\n:steam_locomotive::coffee::coffee::running::running::running::dash:"
    "Det er kaffi å få på kjøken!"