Add dockerfile.clj now that gitignore rule is fixed

error: pathspec 'src/docker_clojure/dockerfile.clj' did not match any file(s) known to git

--- src/docker_clojure/dockerfile.clj
+++ src/docker_clojure/dockerfile.clj
@@ -0,0 +1,38 @@
+(ns docker-clojure.dockerfile
+  (:require
+   [clojure.java.shell :refer [sh]]
+   [clojure.string :as str]
+   [docker-clojure.dockerfile.boot :as boot]
+   [docker-clojure.dockerfile.lein :as lein]
+   [docker-clojure.dockerfile.tools-deps :as tools-deps]))
+
+(defn base-image-tag [{:keys [base-image distro]}]
+  (if (= "debian" distro)
+    base-image
+    (str base-image "-" distro)))
+
+(defn base-image-filename [variant]
+  (-> variant
+      base-image-tag
+      (str/replace ":" "-")))
+
+(defn filename [{:keys [build-tool] :as variant}]
+  (str/join "." ["Dockerfile"
+                 (base-image-filename variant)
+                 build-tool]))
+
+(defn contents [{:keys [maintainer build-tool] :as variant}]
+  (str/join "\n"
+            (concat [(format "FROM %s" (base-image-tag variant))
+                     (format "LABEL maintainer=\"%s\"" maintainer)
+                     ""]
+                    (case build-tool
+                      "boot" (boot/contents variant)
+                      "lein" (lein/contents variant)
+                      "tools-deps" (tools-deps/contents variant)))))
+
+(defn write-file [file variant]
+  (spit file (contents variant)))
+
+(defn clean-all []
+  (sh "sh" "-c" "rm Dockerfile.*"))


Name user routes w/ namespaced keywords

Name user routes w/ namespaced keywords

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/turbovote-http-api.git/'


default to :file for REPL ease

default to :file for REPL ease

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/scheduled-message-works.git/'


[EN] Add matching-division to searched electorate

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/electorate-works.git/'


Add step: personal/income

Add step: personal/income

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


ugly Clojure code

ugly Clojure code

error: pathspec 'downloadRandImage/Program.clj' did not match any file(s) known to git

--- downloadRandImage/Program.clj
+++ downloadRandImage/Program.clj
@@ -0,0 +1,27 @@
+(ns downloadRandImage
+ (:require [clojure.java.io :as io]))
+
+(def url "http://alpha.wallhaven.cc/random")
+(def userAgent "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1")
+
+(defn getWwwInputStream [url]
+  (-> (java.net.URL. url)
+      .openConnection
+      (doto (.setRequestProperty "User-Agent"
+                               userAgent))
+      .getInputStream))
+
+(def html (-> url getWwwInputStream slurp))
+
+(def *matcher* (re-matcher #"<img [^>]*? src=\".*?th-(\d+\..{3})\"[^>]*?>" html))
+
+(def imgName ((re-find *matcher*) 1))
+
+(def imgUrl (str "http://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-" imgName))
+
+(defn fetch-to-file [url file]
+                (with-open [in (io/input-stream url)
+                            out (io/output-stream file)]
+                  (io/copy in out)))
+
+(fetch-to-file (getInputStream imgUrl) imgName)


update environment name

update environment name

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/physion/ovation-webapi.git/'


Fix the time range selectors.

Fix the time range selectors.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cstorey/nrod.git/'


rewrite tasks tests

rewrite tasks tests

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/fhirbase/fhirterm.git/'


refactoring in progress

refactoring in progress

error: pathspec 'src/cljs/worktv/db.cljs' did not match any file(s) known to git

--- src/cljs/worktv/db.cljs
+++ src/cljs/worktv/db.cljs
@@ -0,0 +1,10 @@
+(ns worktv.db)
+
+(def content-types [{:type :image :label "Image" :icon "fa-image"}
+                    {:type :video :label "Video" :icon "fa-file-video"}
+                    {:type :custom :label "Custom" :icon "fa-code"}
+                    {:type :chart :label "Chart" :icon "fa-chart-bar"}
+                    {:type :page :label "Web Page" :icon "fa-newspaper"}
+                    {:type :slides :label "Slides" :icon "fa-film" }])
+
+(def blank-design {:layout {1 {:id 1 :type :content-pane}} :screen "1280x720"})


Clean up the embeddable latest version SVG colors

--- src/clojars/web/jar.clj
+++ src/clojars/web/jar.clj
@@ -195,12 +195,12 @@
                                       :version (:version v)))
                            (:version v))])]]]))

-(let [border-color "#9c92d9"
-      bg-color "#380036"
-      artifact-color  "#ffffff"
-      version-color "#27d3f1"
+(let [border-color "#e2e4e3"
+      bg-color "#fff"
+      artifact-color  "#4098cf"
+      version-color "#87cf29"
       bracket-color "#ffb338"
-      powered-by-color "#ffffff"
+      ampersand-color "#888"
       clojars-color "#ffb338"]
   (defn svg-template [jar-id version]
     (let [width-px (+ 138 (* (+ (count jar-id) (count version)) 6))]
@@ -235,7 +235,7 @@
                :y 14,
                :font-family "Verdana",
                :font-size 8,
-               :fill powered-by-color}
+               :fill ampersand-color}
         [:tspan "@"]
         [:tspan {:fill clojars-color} "clojars.org"]]])))


Add node definition for the artifacts server

error: pathspec 'src/circle/backend/nodes/circle_artifact.clj' did not match any file(s) known to git

--- src/circle/backend/nodes/circle_artifact.clj
+++ src/circle/backend/nodes/circle_artifact.clj
@@ -0,0 +1,26 @@
+(ns circle.backend.nodes.circle-artifact
+  (:require
+   pallet.core
+   pallet.phase
+   [pallet.action.user :as user]
+   [pallet.action.directory :as directory]
+   [pallet.action.package :as package]
+   [pallet.crate.java :as java]
+   [pallet.action.remote-file :as remote-file]
+   [pallet.action.service :as service]
+   [pallet.crate.automated-admin-user :as automated-admin-user]
+   [pallet.crate.git :as git]
+   [pallet.crate.ssh-key :as ssh-key]
+   [pallet.thread-expr :as thread-expr]))
+
+(def circle-artifact-group
+  (pallet.core/group-spec
+   "circle"
+   :circle-node-spec {:ami "ami-e913dd80"
+                      :availability-zone "us-east-1a"
+                      :instance-type "t1.micro"
+                      :keypair-name "www"
+                      :security-groups ["artifacts-server"]
+                      :username "ubuntu"
+                      :public-key (slurp "www.id_rsa.pub")
+                      :private-key (slurp "www.id_rsa")}))


nicer commenting for marginalia.

nicer commenting for marginalia.

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -19,8 +19,8 @@
   "Process and run a json based dataset query and return results.

    Takes 2 arguments:
-   1. the json query as a dictionary
-   2. query execution options specified in a dictionary
+   1.  the json query as a dictionary
+   2.  query execution options specified in a dictionary

    Depending on the database specified in the query this function will delegate to a driver specific implementation.
    For the purposes of tracking we record each call to this function as a QueryExecution in the database.


coins changes

coins changes

error: pathspec 'src/clj/xl/coin_changes.clj' did not match any file(s) known to git

--- src/clj/xl/coin_changes.clj
+++ src/clj/xl/coin_changes.clj
@@ -0,0 +1,54 @@
+(ns xl.coin-changes)
+"Given a total and a list of coins, returns number of combinations of coins for the change total"
+
+(defn changes-count
+  "Use dynamic programming. construct c[i, j] for count of total j and coins from 0 to i."
+  [coins total]
+  (let [n (count coins)
+        dp
+          (reduce
+            (fn [m t]
+              (reduce
+                (fn [m i]
+                  (if (zero? t)
+                    (assoc m [i t] 1)
+                    (let [ci (nth coins i)
+                          v-i1 (if (zero? i) 0 (m [(dec i) t]))]
+                      (assoc m [i t]
+                               (if (< t ci)
+                                 v-i1
+                                 (+ (m [i (- t ci)]) v-i1)
+                                 )
+                        )
+                      )
+                    )
+                  )
+                m
+                (range n)
+                )
+              )
+            {}
+            (range (inc total)))
+        ]
+    (dp [(dec n) total])
+    )
+  )
+
+(defn samples []
+  (doseq [[coins t]
+          [
+           [[1 2] 2]
+           [[1 2] 3]
+           [[1 2] 4]
+           [[1 2 5] 4]
+           [[1 2 5] 10]
+           [[2 5] 10]
+           [[2 4] 9]
+           ]
+          ]
+    (println "total: " t "coins: " coins)
+    (println "count: " (changes-count coins t))
+    )
+  )
+
+(samples)


Add more examples

Add more examples

error: pathspec 'src/clojure/misc/others.clj' did not match any file(s) known to git


solved

solved

error: pathspec 'src/4clojure/black-box-testing.clj' did not match any file(s) known to git

--- src/4clojure/black-box-testing.clj
+++ src/4clojure/black-box-testing.clj
@@ -0,0 +1,41 @@
+;; http://www.4clojure.com/problem/65
+;; Black Box Testing
+;; Difficulty:	Medium
+;; Topics:	seqs testing
+
+;; Clojure has many sequence types, which act in subtly different ways. The core functions typically convert them into a uniform "sequence" type and work with them that way, but it can be important to understand the behavioral and performance differences so that you know which kind is appropriate for your application.
+
+;; Write a function which takes a collection and returns one of :map, :set, :list, or :vector - describing the type of collection it was given.
+;; You won't be allowed to inspect their class or use the built-in predicates like list? - the point is to poke at them and understand their behavior.
+;; test not run
+
+;; Special Restrictions
+;; class
+;; type
+;; Class
+;; vector?
+;; sequential?
+;; list?
+;; seq?
+;; map?
+;; set?
+;; instance?
+;; getClass
+
+(defn __ [a]
+  (let [c (subs (str a) 0 1)]
+    (cond (= c "#") :set
+          (= c "{") :map
+          (= c "[") :vector
+          (= c "(") :list
+          :else :list)))
+
+(= :map (__ {:a 1, :b 2}))
+
+(= :list (__ (range (rand-int 20))))
+
+(= :vector (__ [1 2 3 4 5 6]))
+
+(= :set (__ #{10 (rand-int 5)}))
+
+(= [:map :set :vector :list] (map __ [{} #{} [] ()]))


recursively load shader files

recursively load shader files

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/aamedina/swg.git/'


Rough sketches of an implementation

Rough sketches of an implementation

error: pathspec 'src/clj_bots/pin_ctrl_bbb/implementation.clj' did not match any file(s) known to git

--- src/clj_bots/pin_ctrl_bbb/implementation.clj
+++ src/clj_bots/pin_ctrl_bbb/implementation.clj
@@ -0,0 +1,69 @@
+(ns clj-bots.pin-ctrl-bbb.implementation
+  (:require [gpio.core :as gpio]
+            [clj-bots.pin-ctrl
+             [protocols :as pcp]
+             [implementation :as impl]]
+            [clojure.java.io :as io]))
+
+
+(declare new-pin)
+
+
+(defrecord Board [pin-mapping config]
+  pcp/PBoard
+  (pin-modes [_]
+    {:todo :XXX})
+  (create-pin [this pin-n]
+    (new-pin this pin-n))
+  (get-config [this]
+    config)
+  ; XXX - Hmmm... do we actually need this?
+  (swap-config! [this f]
+    (swap! config f)))
+
+
+(let [inner-fn
+      (memoize
+        (fn []
+          (read-string (slurp (clojure.java.io/resource "bbb-pin-mappings.edn")))))]
+  ; XXX - Hmm; should call this something else either here or in the Implementation protocol
+  (defn- get-pin-mappings
+    "Get pin mappings from configuration edn file"
+    []
+    ((inner-fn))))
+
+
+(defn new-board
+  [config]
+  (Board. (get-pin-mappings) config))
+
+
+;(defrecord BBBPin
+  ;[board oin-n mode]
+  ;(
+
+(def implementation
+  (reify
+    Object
+    (toString [_]
+      "<BeagleBoneBlackImplementation>")
+    pcp/PPinCtrlImplementation
+    (create-board! [_ config]
+      (Board. (get-pin-mappings) config))
+    (default-config [_]
+      (get-pin-mappings))))
+
+;; This makes it possible to register the implementation by calling this function
+
+(defn register-implementation
+  ([impl-key]
+   (impl/register-implementation impl-key implementation))
+  ([]
+   (register-implementation :bbb)))
+
+;; Having this here means the implementation will get registered if this namespace is required
+
+(register-implementation)
+
+:OK
+


Split out the vault data layer into its own file.

error: pathspec 'metlog-vault/src-server/metlog_vault/data.clj' did not match any file(s) known to git

--- metlog-vault/src-server/metlog_vault/data.clj
+++ metlog-vault/src-server/metlog_vault/data.clj
@@ -0,0 +1,80 @@
+(ns metlog-vault.data
+  (:use metlog-common.core
+        compojure.core)
+  (:require [clojure.tools.logging :as log]
+            [clojure.java.jdbc :as jdbc]
+            [sql-file.core :as sql-file]))
+
+
+(def db-connection
+  (delay (sql-file/open-hsqldb-file-conn (config-property "db.subname" "metlog-db")  "metlog" 0)))
+
+(def ^:dynamic *db* nil)
+
+(defmacro with-db-connection [ & body ]
+  `(binding [ *db* @db-connection ]
+     ~@body))
+
+(defn wrap-db-connection [ app ]
+  (fn [ req ]
+    (with-db-connection
+      (app req))))
+
+
+(defmacro with-transaction [ & body ]
+  `(jdbc/with-db-transaction [ db-trans# *db* ]
+     (binding [ *db* db-trans# ]
+       ~@body)))
+
+(defn series-name-id [ series-name ]
+  (query-scalar *db* [(str "SELECT series_id "
+                           " FROM series "
+                           " WHERE series_name=?")
+                      series-name]))
+
+(defn- add-series-name [ series-name ]
+  (:series_id (first
+               (jdbc/insert! *db* :series
+                             {:series_name series-name}))))
+
+
+(defn intern-series-name [ series-name ]
+  (let [ series-name (.trim (or series-name "")) ]
+    (if (= 0 (.length series-name))
+      nil
+      (with-transaction
+        (or (series-name-id series-name)
+            (add-series-name series-name))))))
+
+(defn store-data-samples [ samples ]
+  (doseq [ sample samples ]
+    (log/debug "Inserting sample: " sample)
+    (jdbc/insert! *db* :sample
+                  {:series_id (intern-series-name (:series_name sample))
+                   :t (:t sample)
+                   :val (:val sample)})))
+
+
+(defn get-series-id [ series-name ]
+  (query-scalar *db* [(str "SELECT series_id"
+                           " FROM series"
+                           " WHERE series_name=?")
+                      series-name]))
+
+(defn get-series-names []
+  (map :series_name
+       (query-all *db* [(str "SELECT series_name"
+                             " FROM series")])))
+
+
+(defn get-data-for-series-name [ series-name window-size-secs ]
+  (query-all *db* [(str "SELECT sample.t, sample.val"
+                        " FROM sample, series"
+                        " WHERE sample.series_id = series.series_id"
+                        "   AND series.series_name=?"
+                        "   AND t > TIMESTAMPADD(SQL_TSI_SECOND, ?, CURRENT_TIMESTAMP)"
+                        " ORDER BY t")
+                   series-name
+                   (- window-size-secs)]))
+
+


Avoid div by 0.

Avoid div by 0.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/inchingforward/eon.git/'


Correct throw 422 for /teams

Correct throw 422 for /teams


duplicating change made in master for easy testing

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


add config test

add config test

error: pathspec 'test/misaki/test/config.clj' did not match any file(s) known to git

--- test/misaki/test/config.clj
+++ test/misaki/test/config.clj
@@ -0,0 +1,12 @@
+(ns misaki.test.config
+  (:use [misaki config]
+        misaki.test.common
+        clojure.test)
+  (:require [clojure.java.io :as io]))
+
+(deftest* make-template-output-filename-test
+  (let [tmpl-name "template.test.html.clj"
+        file (io/file (str *template-dir* tmpl-name))
+        name1 (make-template-output-filename file)
+        name2 (make-template-output-filename tmpl-name)]
+    (is (= name1 name2))))


Updates test for transformed team

Updates test for transformed team


Micro-optimize header-allowed?

Micro-optimize header-allowed?

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-BIT/restQL-server.git/'


Dubious approach to instanceof.

Dubious approach to instanceof.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/shaunstanislaus/cljs2go.git/'


Commenting out protocol invoke as protocols are yet to come.


Saioena gora pasa, tokena behar den probak baino lehenago

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lnmnd/magnet.zer.git/'


'undefined' placeholder file for version.clj

--- src/metabase/version.clj
+++ src/metabase/version.clj
@@ -11,4 +11,4 @@

 (def ^:const tag
   "Git tag for this version of Metabase."
-  "v0.11.1")
+  "[UNDEFINED]") ; set version by running ./build-uberjar generate_version_info


Use config properly

Use config properly

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/form-works.git/'


Use failover transport.

Use failover transport.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cstorey/nrod.git/'


Default log file size should be 10MiB, not 10MB. That's just weird.


Add unit test for util.clj

Add unit test for util.clj

error: pathspec 'test/ruuvi/util_test.clj' did not match any file(s) known to git

--- test/ruuvi/util_test.clj
+++ test/ruuvi/util_test.clj
@@ -0,0 +1,22 @@
+(ns ruuvi.util-test
+  (:require
+    [ruuvi.util :refer :all]
+    [midje.sweet :refer :all]
+    )
+  )
+
+(fact
+  "process-id returns process id"
+  (let [pid (process-id)]
+    pid => #(> % 0)
+    ))
+
+
+
+
+
+
+
+
+
+


add lein-marginalia

add lein-marginalia

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/sw1nn/dotfiles.git/'


TODO's

TODO's

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/mstang/pathdatabase.git/'


focus explicitly on exact duplicates, ignoring phantom elections for now

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/scheduled-message-works.git/'


lux example added for presentation

lux example added for presentation

error: pathspec 'src/examples/luxemburg.clj' did not match any file(s) known to git

--- src/examples/luxemburg.clj
+++ src/examples/luxemburg.clj
@@ -0,0 +1,32 @@
+(ns examples.luxemburg
+  (require [logic.util :refer :all]))
+
+(def colors '[red green blue])
+
+(def countries '[lu de fr be])
+
+(defn one-color [country]
+  (oneof (map #(combine-syms country %) colors)))
+
+(def countries-one-color
+  (apply list 'and (map #(one-color %) countries)))
+￼￼￼
+(defn adjacent [c1 c2]
+  (apply list 'and
+    (map #(list 'or
+            (list 'not %1)
+            (list 'not %2))
+      (map #(combine-syms c1 %) colors)
+      (map #(combine-syms c2 %) colors))))
+
+(def fml
+  (list 'and
+    countries-one-color
+    (adjacent 'lu 'de)
+    (adjacent 'lu 'fr)
+    (adjacent 'lu 'be)
+    (adjacent 'de 'fr)
+    (adjacent 'fr 'be)
+    (adjacent 'be 'de)))
+
+(-> fml transform-cnf generate-dimacs-clauses sat-solve)


delete unused parameters from build-url; add arities to main methods

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/max-neverov/ads-client.git/'


add plan-name

add plan-name

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


Email sending ns

Email sending ns

error: pathspec 'src/sdos_site/email.clj' did not match any file(s) known to git

--- src/sdos_site/email.clj
+++ src/sdos_site/email.clj
@@ -0,0 +1,13 @@
+(ns sdos-site.email
+  (:require [postal.core :refer (send-message)]
+            [clojure.tools.logging :refer (error)]))
+
+(defn send
+  [server message]
+  (let [result (send-message server message)
+        code (:code result)]
+    (if (zero? code)
+      true
+      (do
+        (error {:result result :server server :message message})
+        false))))


Start translating the Steal This Sound synths - first synth: Prophet

fatal: unable to access 'https://github.com/mcanthony/overtone.git/': The requested URL returned error: 403


Use a promise to make sure the function doesn't return too early

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/bsmr-clojure/Nightcode.git/'


Recursion

Recursion

error: pathspec 'src/mark-volkmann-tutorial/recursion.clj' did not match any file(s) known to git

--- src/mark-volkmann-tutorial/recursion.clj
+++ src/mark-volkmann-tutorial/recursion.clj
@@ -0,0 +1,25 @@
+;; Recursion
+;; http://java.ociweb.com/mark/clojure/article.html#Recursion
+
+; tail call optimalization: Java doesn't support & neither Clojure
+; one way: loop, recur
+; another way: trampoline - supports mutual recursion which dont support recur (fun call another fun which call back to the original one)
+
+; loop, recur
+(defn factorial-1 [number]
+  "computes the factorial of a positive integer
+  in a way that doesn't consume stack space"
+  (loop [n number
+         factorial 1]
+    (if (zero? n)
+      factorial
+      (recur (dec n)
+             (* factorial n)))))
+
+(println (time (factorial-1 5)))
+
+; another way of factorial - by reduce or apply (but it's even longer) - but its less effective
+(defn factorial-2 [number]
+  (reduce * (range 2 (inc number))))
+
+(println (time (factorial-2 5)))


Show/hide child dropdown based on parent selection

error: pathspec 'src-cljs/acfe/dropdown.cljs' did not match any file(s) known to git

--- src-cljs/acfe/dropdown.cljs
+++ src-cljs/acfe/dropdown.cljs
@@ -0,0 +1,28 @@
+(ns acfe.dropdown
+  "Unobtrusively handle parent/child dropdowns."
+  (:require
+   [dommy.core :refer-macros [sel sel1] :as d]))
+
+
+(defn- on-parent-select-change
+  [e]
+  (let [text (-> e .-target .-value)]
+	(doseq [o (sel [:select.child])]
+	  (if
+		(= text (d/attr o "data-parent"))
+		(d/remove-class! o "hidden")
+		(d/add-class! o "hidden"))
+	  )))
+
+
+(defn- on-child-select-change
+  [e]
+  (this-as this (.log js/console this)))
+
+
+(defn create-listeners
+  []
+  (doseq [o (sel [:select.parent])] (d/listen! o :change on-parent-select-change))
+  (doseq [o (sel [:select.child])] (d/listen! o :change on-child-select-change))
+  )
+


Playing better with clojure.test

Playing better with clojure.test

fatal: unable to access 'https://github.com/michaelsbradleyjr/shen.clj.git/': The requested URL returned error: 403


Added missing (wrap-request-logging)

Added missing (wrap-request-logging)

--- 2-collectors/clojure-collector/src/snowplow/clojure_collector/middleware.clj
+++ 2-collectors/clojure-collector/src/snowplow/clojure_collector/middleware.clj
@@ -29,6 +29,15 @@
     (apply wrapper handler args)
     handler))

+(defn wrap-request-logging [handler]
+  (fn [{:keys [request-method uri] :as req}]
+    (let [start  (System/currentTimeMillis)
+          resp   (handler req)
+          finish (System/currentTimeMillis)
+          total  (- finish start)]
+      (log "request %s %s (%dms)" request-method uri total)
+      resp)))
+
 (defn wrap-exception-logging [handler]
   (fn [req]
     (try


Version 1.12.2

Version 1.12.2


Add `midje-gen-test`

Add `midje-gen-test`

error: pathspec 'test/com/nomistech/clojure_the_language/c_800_libraries/s_105_generative_testing/midje_gen_test.clj' did not match any file(s) known to git

--- test/com/nomistech/clojure_the_language/c_800_libraries/s_105_generative_testing/midje_gen_test.clj
+++ test/com/nomistech/clojure_the_language/c_800_libraries/s_105_generative_testing/midje_gen_test.clj
@@ -0,0 +1,30 @@
+(ns com.nomistech.clojure-the-language.c-800-libraries.s-105-generative-testing.midje-gen-test
+  (:require [clojure.test.check.generators :as gen]
+            [midje.experimental :refer [for-all]]
+            [midje.sweet :refer :all]))
+
+(for-all
+ ;; 'the-name
+ "A doc string"
+ [positive-num gen/s-pos-int
+  int          gen/int]
+ {:max-size 10
+  :num-tests 15
+  :seed 1510160943861}
+ (fact "An integer added to a positive number is always a number?"
+   (+ positive-num int) => integer?)
+ #_(fact "An integer added to a positive number is always positive?"
+   (+ positive-num int) => pos?))
+
+(defn my-vals [a-map] (map second a-map))
+
+(for-all
+ [str-map (gen/map gen/keyword gen/string)]
+ {:max-size 10
+  :num-tests 15
+  :seed 1510160943861}
+ (fact "extracted keys are strings"
+   (my-vals str-map) => (has every? string?))
+ (when-not (empty? str-map)
+   (fact "my-vals matches keys behavior"
+     (my-vals str-map) => (vals str-map))))


Added pahrmgkb drug-gene relation rule

Added pahrmgkb drug-gene relation rule

Removed original pharmgkb relations rules file. Added variables for use
with ccp ext ontology and formatted file

error: pathspec 'resources/rules/post_identifier_merge/temp/pharmgkb/pharmgkb_drug_gene_relation.clj' did not match any file(s) known to git

--- resources/rules/post_identifier_merge/temp/pharmgkb/pharmgkb_drug_gene_relation.clj
+++ resources/rules/post_identifier_merge/temp/pharmgkb/pharmgkb_drug_gene_relation.clj
@@ -0,0 +1,85 @@
+;; -----------------------------------------------
+;; --------- PharmGKB Drug Gene Relation ---------
+;; -----------------------------------------------
+`{:name "pharmgkb-drug-gene-relation"
+  :description "This rule assigns relations between drugs and genes"
+  :head (
+
+         (?/interaction rdfs/subClassOf obo/MI_0000) ;interaction
+
+         ;; create a subclass of the gene that will participate in the interaction
+         (?/gene_or_gene_product_sc rdfs/subClassOf ?/gene_or_gene_product)
+
+         ;; link the interaction to the protein target participant
+         (?/gene_or_gene_product_participant_restriction rdf/type owl/Restriction)
+         (?/gene_or_gene_product_participant_restriction owl/onProperty obo/RO_0000057) ; RO:has_participant
+         (?/gene_or_gene_product_participant_restriction owl/someValuesFrom ?/gene_or_gene_product_sc)
+
+         ;; create a subclass of the drug that will participate in the interaction
+         (?/drug_sc rdfs/subClassOf ?/drug)
+
+         ;; link the interaction to the drug participant
+         (?/drug_participant_restriction rdf/type owl/Restriction)
+         (?/drug_participant_restriction owl/onProperty obo/RO_0000057) ; RO:has_participant
+         (?/drug_participant_restriction owl/someValuesFrom ?/drug_sc)
+
+         ;; this interaction realizes the drug_role that inheres_in the drug
+         (?/realizes_drug_role_restriction rdf/type owl/Restriction)
+         (?/realizes_drug_role_restriction owl/onProperty obo/BFO_0000055) ; BFO:realizes
+         (?/realizes_drug_role_restriction owl/someValuesFrom ?/inheres)
+
+         ;; create a new anonymous class (CHEBI drug role) that inheres_in in this specific drug so that it can be realized by the restriction above
+         (?/inheres_restriction rdf/type owl/Restriction)
+         (?/inheres_restriction owl/onProperty obo/RO_0000052) ; RO:inheres_in
+         (?/inheres_restriction owl/someValuesFrom ?/drug_sc)
+         (?/inheres rdfs/subClassOf obo/CHEBI_23888) ; CHEBI:drug
+         (?/inheres rdfs/subClassOf ?/inheres_restriction)
+
+         ;; make the interaction be part of these 3 restrictions
+         (?/interaction rdfs/subClassOf ?/gene_or_gene_product_participant_restriction)
+         (?/interaction rdfs/subClassOf ?/drug_participant_restriction)
+         (?/interaction rdfs/subClassOf ?/realizes_drug_role_restriction))
+
+  :body ((?/record rdf/type ccp/IAO_EXT_0000823) ; ccp:PharmGKB_relation_record
+
+         ;; retrieve entity type data field 1 - drug
+         (?/record obo/BFO_0000051 ?/type_1_field_value) ; BFO:has_part
+         (?/type_1_field_value rdf/type ccp/IAO_EXT_0001038) ; ccp:PharmGKB_relation_record__entity_1_type_field_value
+         (?/type_1_field_value rdf/type ?/type_1_type_id)
+         (?/type_1_id obo/IAO_0000219 ?/drug_sc) ; IAO:denotes
+
+         ;; retrieve entity data identifier field 1 - drug
+         (?/record obo/BFO_0000051 ?/identifier_1_field_value) ; BFO:has_part
+         (?/identifier_1_field_value rdf/type ccp/IAO_EXT_0001036) ; ccp:PharmGKB_relation_record__entity_1_identifier_field_value
+         (?/identifier_1_field_value rdf/type ?/identifier_1_ice_id)
+         (?/identifier_1_ice_id obo/IAO_0000219 ?/drug_sc) ; IAO:denotes
+
+         ;; retrieve entity type data field 2 - gene
+         (?/record obo/BFO_0000051 ?/type_2_field_value) ; BFO:has_part
+         (?/type_2_field_value rdf/type ccp/IAO_EXT_0001040) ; ccp:PharmGKB_relation_record__entity_2_type_field_value
+         (?/type_2_field_value rdf/type ?/type_2_id)
+         (?/type_2_id obo/IAO_0000219 ?/gene_or_gene_product_sc) ; IAO:denotes
+
+         ;; retrieve entity data identifier field 2 - gene
+         (?/record obo/BFO_0000051 ?/identifier_2_field_value) ; BFO:has_part
+         (?/identifier_2_field_value rdf/type ccp/IAO_EXT_0001041) ; ccp:PharmGKB_relation_record__entity_2_identifier_field_value
+         (?/identifier_2_field_value rdf/type ?/identifier_2_ice_id)
+         (?/identifier_2_ice_id obo/IAO_0000219 ?/gene_or_gene_product_sc)) ; IAO:denotes
+
+  :reify ([?/interaction {:ln (:sha-1 "interaction" ?/gene_or_gene_product ?/drug)
+                          :ns "ccp" :prefix "I_"}]
+          [?/gene_or_gene_product_sc {:ln (:sha-1 ?/gene_or_gene_product ?/drug)
+                       :ns "ccp" :prefix "B_"}]
+          [?/drug_sc {:ln (:sha-1 ?/gene_or_gene_product ?/drug)
+                         :ns "ccp" :prefix "D_"}]
+          [?/gene_or_gene_product_participant_restriction {:ln (:restriction)
+                 :ns "ccp" :prefix "R_"}]
+          [?/drug_participant_restriction {:ln (:restriction)
+                 :ns "ccp" :prefix "R_"}]
+          [?/realizes_drug_role_restriction {:ln (:restriction)
+                 :ns "ccp" :prefix "R_"}]
+          [?/inheres_restriction {:ln (:restriction)
+                 :ns "ccp" :prefix "R_"}]
+          [?/inheres {:ln (:sha-1 "drugrole" ?/drug)
+                          :ns "ccp" :prefix "D_"}])
+  }


Add action handlers

Add action handlers

error: pathspec 'src/trak/action-handlers.cljs' did not match any file(s) known to git

--- src/trak/action-handlers.cljs
+++ src/trak/action-handlers.cljs
@@ -0,0 +1,44 @@
+(ns trak.action-handlers
+  (:require [datascript.core :as d]
+            [trak.utils :as utils]
+            [trak.api :as api]))
+
+
+(def api-result-handler)
+
+(defmulti handler (fn [action params *db] action))
+
+(defmethod handler :find-albums [_ _ _]
+
+  (api/find-albums "blues"))
+
+(defmethod handler :api-call-result [_ params db]
+  (utils/info "Api call result " params)
+  (api-result-handler (:call params) (:response params) db))
+
+
+;; Utitlity. Convert prefix and key to :prefix/key to use with Datascript
+(defn to-prefixed-keyword [prefix key]
+  (cond
+    (= key :db/id) key
+    :else (keyword (name prefix) (name key))))
+
+;; Convert {:name "event" :startTime "1234"} to
+;;         {:event/name "event" :event/startTime "1234}
+;; etc.
+
+(defn- convert-atrrs-to-datascript [attrs keyword-prefix]
+  (reduce #(assoc %1 (to-prefixed-keyword keyword-prefix (first %2)) (second %2)) {} attrs))
+
+(defn json-to-datascript [collection-of-entities keyword-prefix]
+  (map (fn [entity]
+         (convert-atrrs-to-datascript entity keyword-prefix))
+       collection-of-entities))
+
+
+(defmulti api-result-handler (fn [api result *db] api))
+
+(defmethod api-result-handler :find-albums [action response *db]
+  (utils/info "Action received " action response)
+  (when-let [{{{albums :items} :albums} :body} response]
+    (d/transact! *db (json-to-datascript albums :album))))


Added simple example (high load tests).

Added simple example (high load tests).

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/acessocard/microscope.git/'


Revert "Consistent naming"

Revert "Consistent naming"

This reverts commit 956f9903672b2d89cec53b5d95ae20421c131f64.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/zuwiki/tiem.git/'


Add prime-factors stub

Add prime-factors stub

error: pathspec 'exercises/prime-factors/src/prime_factors.clj' did not match any file(s) known to git

--- exercises/prime-factors/src/prime_factors.clj
+++ exercises/prime-factors/src/prime_factors.clj
@@ -0,0 +1,5 @@
+(ns prime-factors)
+
+(defn of [] ;; <- Arglist goes here
+      ;; your code goes here
+      )


add tracing to scheduler processes

add tracing to scheduler processes


add user.clj for better developer workflow using tools.namespace

fatal: unable to access 'https://github.com/vlacs/navigator-archive.git/': The requested URL returned error: 403


Add Nodejs Filesystem.

Add Nodejs Filesystem.

error: pathspec 'src/konserve/nodejs.cljs' did not match any file(s) known to git

--- src/konserve/nodejs.cljs
+++ src/konserve/nodejs.cljs
@@ -0,0 +1,160 @@
+(ns konserve.nodejs
+  (:require [cljs.nodejs :as node]
+            [konserve.core :as k]
+            [hasch.core :refer [uuid]]
+            [konserve.serializers :as ser]
+            [konserve.protocols :refer [PEDNAsyncKeyValueStore -exists?
+-get-in -update-in
+                                        PJSONAsyncKeyValueStore
+-jget-in -jassoc-in -jupdate-in
+                                        PBinaryAsyncKeyValueStore -bget
+-bassoc
+                                        -serialize -deserialize]]
+            [cljs.core.async :as async :refer (take! <! >! put! close!
+chan poll!)])
+  (:require-macros [cljs.core.async.macros :refer [go go-loop]]))
+
+(defonce fs (node/require "fs"))
+
+(defonce stream (node/require "stream"))
+
+(defn delete-store
+  "Permanently deletes the folder of the store with all files."
+  [folder]
+  (if (fs.existsSync folder)
+    (try
+      (doseq [path [(str folder "/meta") (str folder "/data") folder]]
+        (when (fs.existsSync path)
+          (doseq [file (fs.readdirSync path)]
+            (let [file-path (str path "/" file)]
+              (when (fs.existsSync file-path)
+                (if (.isDirectory (fs.statSync file-path))
+                  (fs.rmdirSync file-path)
+                  (fs.unlinkSync file-path)))))))
+      (catch js/Object err
+        (println err))
+      (finally
+        (fs.rmdirSync folder)))
+    "folder not exists"))
+
+(defn check-and-create-folder
+  "Creates Folder with given path."
+  [path]
+  (let [test-file (str path "/" (random-uuid))]
+    (try
+      (when-not (fs.existsSync path)
+        (fs.mkdirSync path))
+      (fs.writeFileSync test-file "test-data")
+      (fs.unlinkSync test-file)
+      (catch js/Object err
+        (println err)))))
+
+(defrecord FileSystemNodejsStore
+    [folder serializer read-handlers write-handlers locks config]
+  PEDNAsyncKeyValueStore
+  (-exists? [this key]
+    (let [fn  (uuid key)
+          f   (str folder "/data/" key)
+          res (chan)]
+      (put! res (fs.existsSync f))
+      (close! res)
+      res)))
+
+(defn new-fs-store
+  "Filestore contains a Key and a Data Folder"
+  [path & {:keys  [read-handlers write-handlers serializer config]
+           :or    {read-handlers  (atom {})
+                   write-handlers (atom {})
+                   serializer     (ser/string-serializer)
+                   config {:fsync true}}}]
+  (let [_         (check-and-create-folder path)
+        _         (check-and-create-folder (str path "/meta"))
+        _         (check-and-create-folder (str path "/data"))]
+    (go (map->FileSystemNodejsStore {:folder         path
+                                     :serializer     serializer
+                                     :read-handlers  read-handlers
+                                     :write-handlers write-handlers
+                                     :locks          (atom {})
+                                     :config         config}))))
+
+(comment
+  ;create store
+  (go (def store (<! (new-fs-store "mystore"))))
+  ;delete store
+  (delete-store "mystore")
+  ;exists?
+  (go (println (<! (-exists? store "ne1w.txt"))))
+;;Input, Outputstream
+
+(def my-obj (clj->js {:key "123" :format :edn}))
+
+(defn- read-key
+  [filename key]
+  (when (fs.existsSync path)
+    (let [rs (fs.createReadStream path)]
+      (.on rs "data" (fn [chunk] (set! scope (.toString chunk))))
+      (.on rs "close" #(println "Reading done"))
+      (.on rs "error" (fn [err] (println "error: " err))))))
+
+
+(defn write-edn-key [folder {:keys [key] :as meta}]
+  (let [key       (uuid key)
+        temp-file (str folder "/meta/" key ".new")
+        new-file  (str folder "/meta/" key)
+        fd        (fs.openSync new-file "w+")
+        _         (fs.closeSync fd)
+        ws        (fs.createWriteStream temp-file)]
+    (.on ws "close" #(try (fs.renameSync temp-file new-file) (catch js/Object err (println err))))
+    (.write ws (prn-str meta))
+    (.end ws)))
+
+(defn write-edn [folder key value]
+  (let [key       (uuid key)
+        temp-file (str folder "/data/" key ".new")
+        new-file  (str folder "/data/" key)
+        old       (read-key new-file key)
+        fd        (fs.openSync new-file "w+")
+        _         (fs.closeSync fd)
+        ws        (fs.createWriteStream temp-file)]
+    (.on ws "close" #(try
+                       (fs.renameSync temp-file new-file)
+                       (catch js/Object err (println err))))
+    (.write ws (prn-str value))
+    (.end ws)))
+
+(defn read-edn [path key]
+  (let [file-name (str path "/meta/" (uuid key))
+        res-ch    (chan)]
+    (when (fs.existsSync file-name)
+      (let [rs      (fs.createReadStream file-name)]
+        (.on rs "data" (fn [chunk] (put! res-ch  (cljs.reader/read-string (.toString chunk)))))
+        (.on rs "close" #(close! res-ch))
+        (.on rs "error" (fn [err] (close! res-ch) (println "error: " err)))
+        res-ch))))
+
+(write-edn-key "/tmp" {:key "123" :format :edn})
+
+(def rc (chan))
+
+(go (println (<! (read-edn "/tmp" "123"))))
+
+(defn read-my-key []
+  (let [value (js-obj)]
+    (go (set! (.-var value) (<! (read-edn "/tmp" "123"))))
+    value))
+
+(read-my-key)
+
+(write-edn "myfile.txt" "Hello World")
+
+(take! (read-edn "/tmp" "123") #(println %))
+
+(def myatom (atom {}))
+
+(poll! (read-edn "/tmp" "123"))
+
+(async/reduce (<! (read-edn "/tmp" "123")))
+
+;read back use -> cljs.reader/read-string
+(cljs.reader/read-string (prn-str {:x "123" :y "123"}))
+


Macros to construct measures

Macros to construct measures

error: pathspec 'src/tenor/construct.clj' did not match any file(s) known to git

--- src/tenor/construct.clj
+++ src/tenor/construct.clj
@@ -0,0 +1,23 @@
+(ns tenor.construct)
+
+(defonce ninth-octave-count 131)
+
+(defn generate-random-scale []
+  (let [scale-type (rand-nth (keys SCALE))
+        note-name (find-note-name (rand-int ninth-octave-count))]
+    (scale note-name scale-type)))
+
+(defn map-measure [measure scale]
+  (map #(hash-map :pos %, :note (rand-nth scale)) measure))
+
+(defmacro construct-note [time player entity]
+  `(list 'at ~time (list ~player ~entity)))
+
+(defmacro construct-measure [measure-maps
+                             & {:keys [base-time player]
+                                :or {base-time 1000 player piano}}]
+  (let [measure-seq '()]
+    (doseq [measure-map measure-maps]
+      (conj measure-seq
+            `(construct-note (* (:pos ~measure-map) ~base-time)
+                             player (:note ~measure-map))))))


Beginning to translate Chapter 3, Composition with SuperCollider

error: pathspec 'docs/sc-book/sc-three.clj' did not match any file(s) known to git

--- docs/sc-book/sc-three.clj
+++ docs/sc-book/sc-three.clj
@@ -0,0 +1,71 @@
+(ns sc-three
+  (:use [overtone.live]))
+
+;; Page 83
+;; "foo" repeats every second
+;; SystemClock.sched(0, {"foo".postln; 1.0});
+(periodic 1000 #(println "foo"))
+;; "bar" repeats at a random delay
+;; SystemClock.sched(0, {"bar".postln; 1.0.rand});
+(defn bar []
+  (println "bar")
+  (after-delay (rand-int 1000) #'bar))
+(bar)
+;; clear all scheduled events
+;; SystemClock.clear;
+(stop)
+
+;; Page 85
+(comment
+  // Fermata
+  (
+   r = Routine ({
+                 x = Synth(\default, [freq: 76.midicps]);
+                 1.wait;
+
+                 x.release(0.1);
+                 y = Synth(\default, [freq: 73.midicps]);
+                 "Waiting...".postln;
+                 nil.yield; // fermata
+
+                 y.release(0.1);
+                 z = Synth(\default, [freq: 69.midicps]);
+                 2.wait;
+                 z.release();
+                 });
+   // do this then wait for the fermata
+   r.play;
+   // feel the sweet tonic...
+   r.play;
+  )
+)
+
+;; Is there a \default synthesizer in Overtone?
+(defsynth s [freq 440]
+  (let [src (* 0.3 (sin-osc freq))]
+    (out 0 src)))
+
+;; Is there a better way?
+(do
+  (def cont (atom 0))
+  (defn go []
+    (swap! cont inc))
+  (loop []
+    (case @cont
+      0 (recur)
+      1 (do
+          (s :freq (midi->hz 76))
+          (Thread/sleep 1000)
+          (stop)
+          (s :freq (midi->hz 73))
+          (go)
+          (recur))
+      2 (recur)
+      3 (do
+          (stop)
+          (s :freq (midi->hz 69))
+          (Thread/sleep 2000)
+          (stop)))))
+
+(go)
+(go)


Utility methods to work with UUID.

Utility methods to work with UUID.

fatal: unable to access 'https://github.com/sougatabh/cassaforte.git/': The requested URL returned error: 403


missing examples for overlays

missing examples for overlays

error: pathspec 'example/clojure2d/extra/overlays_example.clj' did not match any file(s) known to git

--- example/clojure2d/extra/overlays_example.clj
+++ example/clojure2d/extra/overlays_example.clj
@@ -0,0 +1,39 @@
+(ns clojure2d.extra.overlays-example
+  (:require [clojure2d.core :refer :all]
+            [clojure2d.extra.overlays :refer :all]
+            [metadoc.examples :refer :all]
+            [clojure2d.color :as c]))
+
+(defsnippet clojure2d.extra.overlays save-result "Save overlays"
+  (let [n (str "images/overlays/" (first opts) ".jpg")
+        c (canvas 600 800)
+        i (load-image "docs/samurai.jpg")]
+    (with-canvas-> c
+      (set-color (c/gray 50))
+      (rect 0 0 600 400)
+      (set-color (c/gray 205))
+      (rect 0 400 600 400)
+      (image i 50 100))
+    (save (apply f c params) (str "docs/" n))
+    (str "../" n)))
+
+(add-examples render-rgb-scanlines
+  (example-snippet "Render RGB scanlines" save-result :image render-rgb-scanlines {:scale 1.8}))
+
+(add-examples render-crt-scanlines
+  (example-snippet "Render CRT scanlines" save-result :image render-crt-scanlines {:resolution 24.0 :mask-dark 0.7 :mask-light 1.3 :hardscan -8.0}))
+
+(add-examples render-noise
+  (example-snippet "Render noise overlay" save-result :image render-noise)
+  (example-snippet "Render noise overlay, dark" save-result :image render-noise (noise-overlay 600 800 {:alpha 200})))
+
+(save (noise-overlay 300 300 {:alpha 200}) "docs/images/overlays/noise.png")
+
+(add-examples noise-overlay
+  (example-image "Overlay image" "../images/overlays/noise.png"))
+
+(add-examples spots-overlay
+  (example "Generate spots overlay (it's a list of images)" (count (spots-overlay 300 300 {:alpha 80 :intensities [10 100 200]}))))
+
+(add-examples render-spots
+  (example-snippet "Render spots overlay" save-result :image render-spots (spots-overlay 600 800  {:alpha 128 :intensities [10 50 100 150 200 250]})))


AMBLY-19: Stackframes for REPL-defined functions

if line fails to parse with RegEx but is not blank
means it was an eval'ed fn. supply stack element.

tweak stacktrace element printing to be nicer in
the face of nil values.

fatal: unable to access 'https://github.com/jobez/ambly.git/': The requested URL returned error: 403


RR: add account view tests

RR: add account view tests

error: pathspec 'tests/clj/ona/viewer/views/accounts_test.clj' did not match any file(s) known to git

--- tests/clj/ona/viewer/views/accounts_test.clj
+++ tests/clj/ona/viewer/views/accounts_test.clj
@@ -0,0 +1,46 @@
+(ns ona.viewer.views.accounts-test
+  (:require [midje.sweet :refer :all]
+            [clojure.string :as string]
+            [ona.viewer.views.accounts :refer :all]
+            [ona.viewer.helpers.accounts :refer [get-account-credentials]]
+            [ona.api.user :as user-api]
+            [ona.api.http :refer [parse-http]]
+            [ona.api.io :refer [make-url]]
+            [ona.utils.remote :refer [protocol]]))
+
+
+(def username "testusername")
+(def account {:username username})
+(def temp-token "a1b2c3")
+(def invalid-token "Invalid token")
+(def token-expired "Token expired")
+
+
+(facts "About get-token token"
+       (get-token account username) => (contains [[:body temp-token]]);
+       (provided
+         (user-api/user account) => {:temp_token temp-token}))
+
+(facts "About validate invalid token"
+       (validate-token account username) => {:status 403 :body invalid-token}
+       (provided
+         (user-api/user account true true) => {:detail invalid-token}))
+
+(facts "About validate token expired"
+       (validate-token account username) => {:status 403 :body token-expired}
+       (provided
+         (user-api/user account true true) => {:detail token-expired}))
+
+;TODO Fix failing logout test
+; (facts "about logout"
+;       (fact "should set session to nil"
+;             (:session (logout account false)) => nil
+;             (provided
+;              (user-api/expire-temp-token account) => nil)))
+
+(facts "about login"
+       (fact "should show message correct message when credentials are incorrect"
+         (string/join (submit-login :username :password))
+         => (contains "Invalid Username or Password")
+         (provided
+          (get-account-credentials :username :password) => nil)))


Include links to the FAQ in error messages (#367)

--- src/clojars/event.clj
+++ src/clojars/event.clj
@@ -11,9 +11,8 @@

 (defn- validate-regex [x re message]
   (when-not (re-matches re x)
-    (throw (ex-info (str message " (" re ")")
-             {:value x
-              :regex re}))))
+    (throw (ex-info message {:value x
+                             :regex re}))))

 (defn snapshot-version? [version]
   (.endsWith version "-SNAPSHOT"))
@@ -22,7 +21,8 @@
   (when (and (not (snapshot-version? version))
           (.exists (io/file (config :repo) (string/replace group-id "." "/")
                      artifact-id version filename)))
-    (throw (ex-info "redeploying non-snapshots is not allowed" {}))))
+    (throw (ex-info "redeploying non-snapshots is not allowed (see http://git.io/vO2Tg)"
+             {}))))

 (defn validate-deploy [group-id artifact-id version filename]
   (try
@@ -33,10 +33,10 @@
     ;; OSes, URLs and tools.
     (validate-regex artifact-id #"^[a-z0-9_.-]+$"
       (str "project names must consist solely of lowercase "
-        "letters, numbers, hyphens and underscores"))
+        "letters, numbers, hyphens and underscores (see http://git.io/vO2Uy)"))
     (validate-regex group-id #"^[a-z0-9_.-]+$"
       (str "group names must consist solely of lowercase "
-        "letters, numbers, hyphens and underscores"))
+        "letters, numbers, hyphens and underscores (see http://git.io/vO2Uy)"))
     ;; Maven's pretty accepting of version numbers, but so far in 2.5 years
     ;; bar one broken non-ascii exception only these characters have been used.
     ;; Even if we manage to support obscure characters some filesystems do not
@@ -44,17 +44,18 @@
     ;; compatible for everyone let's lock it down.
     (validate-regex version #"^[a-zA-Z0-9_.+-]+$"
       (str "version strings must consist solely of letters, "
-        "numbers, dots, pluses, hyphens and underscores"))
+        "numbers, dots, pluses, hyphens and underscores (see http://git.io/vO2TO)"))
     (assert-non-redeploy group-id artifact-id version filename)
     (catch Exception e
       (throw (ex-info (.getMessage e)
-               (assoc (ex-data e)
-                 :status 403
-                 :status-message (str "Forbidden - " (.getMessage e))
-                 :group-id group-id
-                 :artifact-id artifact-id
-                 :version version
-                 :file filename))))))
+               (merge
+                 {:status 403
+                  :status-message (str "Forbidden - " (.getMessage e))
+                  :group-id group-id
+                  :artifact-id artifact-id
+                  :version version
+                  :file filename}
+                 (ex-data e)))))))

 (defn event-log-file [type]
   (io/file (config :event-dir) (str (name type) ".clj")))


uncommented teardown function

uncommented teardown function

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/jchli/jepsen-aurora.git/'


we don't use the response, and it doesn't have body anyway

fatal: unable to access 'https://github.com/democracyworks/election-notification-http-api.git/': The requested URL returned error: 403


Note about env and setup

Note about env and setup

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/shaunstanislaus/cljs2go.git/'


trivial leiningen plugin

trivial leiningen plugin

error: pathspec 'leiningen/midje.clj' did not match any file(s) known to git

--- leiningen/midje.clj
+++ leiningen/midje.clj
@@ -0,0 +1,5 @@
+(ns leiningen.midje
+  (:require [leiningen.test :as lein]))
+
+(defn midje [project]
+  (lein/test project))


Attempt to implement hiccup parser.

Attempt to implement hiccup parser.

error: pathspec 'src/incise/parsers/impl/hiccup.clj' did not match any file(s) known to git

--- src/incise/parsers/impl/hiccup.clj
+++ src/incise/parsers/impl/hiccup.clj
@@ -0,0 +1,6 @@
+(ns incise.parsers.impl.hiccup
+  (:require (incise.parsers [core :refer [register]]
+                            [html :refer [html-parser]])
+            [hiccup.compiler :refer [compile-html]]))
+
+(register [:hiccup] (html-parser compile-html))


Let's move player stuff into a seperate file

error: pathspec 'src/cljs/game/player.cljs' did not match any file(s) known to git

--- src/cljs/game/player.cljs
+++ src/cljs/game/player.cljs
@@ -0,0 +1,37 @@
+(ns game.player
+  (:require
+    [cloj.math.vec2         :as v2 :refer [vec2 vec2-s]]
+    [cloj.utils             :refer [format map-difference] ]
+    ))
+
+(defprotocol IPlayer
+  (get-pos [this t])
+  )
+
+(defrecord Player [intention]
+  IPlayer
+  (get-pos [ _ t]
+    )
+  )
+
+(defn mk-player [t p]
+  (->Player (->EaserV2 t p v2/zero v2/zero)))
+
+
+; (def old-map {:proc-1 6502
+;               :proc-2 68040
+;               :proc-3 32016})
+
+(def old-map {:proc-1 6510
+              :proc-2 68040
+              :proc-3 32016})
+
+(def new-map {:proc-1 6502
+              :proc-2 68040
+              :proc-3 32016})
+
+
+(println
+  (map-difference old-map new-map )
+
+  )


Add controller component to bind with root

This will handle events passed to comms channels. This allows an easy
way to access the app-state at the root as a cursor and saves having
to put the handler logic on separate from om.

error: pathspec 'src/cljs/gtfve/components/controller.cljs' did not match any file(s) known to git

--- src/cljs/gtfve/components/controller.cljs
+++ src/cljs/gtfve/components/controller.cljs
@@ -0,0 +1,41 @@
+(ns gtfve.components.controller
+  (:require-macros [cljs.core.async.macros :refer [go go-loop]]
+                   [gtfve.macros :refer [<?]])
+  (:require [om.core :as om]
+            [sablono.core :as html :refer-macros [html]]
+            [cljs.core.async :as async :refer [put! chan <! close!]]
+            [gtfve.controllers.controls :as controls-con]))
+
+(defn- control-handler [v app]
+  (controls-con/control-event (first v) (rest v) app))
+
+(defn controller [app owner]
+  (reify
+    om/IDisplayName (display-name [_] "Controller")
+    om/IInitState
+    (init-state [_]
+      {:kill-ch (chan)})
+    om/IWillMount
+    (will-mount [_]
+      (let [kill-ch (om/get-state owner :kill-ch)
+            comms (om/get-shared owner [:comms])
+            controls-mult (:controls-mult comms)
+            controls-tap (chan)]
+        (async/tap controls-mult controls-tap)
+        (om/set-state! owner :controls-tap controls-tap)
+        (go-loop []
+          (let [[v c] (alts! [kill-ch controls-tap])]
+            (if (= c kill-ch)
+              :done
+              (do
+                (condp = c
+                  controls-tap (control-handler v app))
+                (recur))))
+          (async/untap controls-mult controls-tap))))
+    om/IWillUnmount
+    (will-unmount [_]
+      (let [{:keys [kill-ch controls-tap]} (om/get-state owner)]
+        (when kill-ch (put! kill-ch (js/Date.)))))
+    om/IRender
+    (render [_]
+      (html [:noscript]))))


masking ip

masking ip

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/narkisr/cloujsearch.git/'


remove redundant doc.close

remove redundant doc.close

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/form-works.git/'


Remove :data from schema validation errors

fatal: unable to access 'https://github.com/democracyworks/election-authority-works.git/': The requested URL returned error: 403


Version 0.2.0

Version 0.2.0

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Yleisradio/rabid.git/'


Added AOT to uberjar

Added AOT to uberjar

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/CraZySacX/swarmhandler.git/'


:arrow_up: Update dependencies

:arrow_up: Update dependencies

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/maoo/bot-unfurl.git/'


Version bump

Version bump

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/xcthulhu/clj-bitauth.git/'


Upgrade

Upgrade

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/couragelabs/freefrog.git/'


bump ver info, clojure dep in project.clj

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/michaelsbradleyjr/shen.clj.git/'


[EN] Upgrade to lein-immutant 2.0.0.

[EN] Upgrade to lein-immutant 2.0.0.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/sendgrid-monitor.git/'


bump version to 3.5.6

bump version to 3.5.6

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-Digital/pdg-core.git/'


Release 0.12.11.

Release 0.12.11.

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject clojars-web "0.12.11-SNAPSHOT"
+(defproject clojars-web "0.12.11"
   :dependencies [[org.clojure/clojure "1.4.0"]
                  [org.clojure/tools.cli "0.2.1"]
                  [org.apache.maven/maven-model "3.0.4"


:arrow_up: Upgrade dependencies

:arrow_up: Upgrade dependencies


Upgrade datomic to 0.9.5394

Upgrade datomic to 0.9.5394

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/election-notification-works.git/'


Using lein-elastic-beanstalk again

Using lein-elastic-beanstalk again

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/physion/ovation-webapi.git/'


Upgrade cheshire

Upgrade cheshire


Upgrade kehaar to 0.10.3

Upgrade kehaar to 0.10.3

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/democracyworks/partner-works.git/'


Releasing v0.9.2

Releasing v0.9.2

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/hudren/ebook-novel.git/'


:new: Add licenses plugin

:new: Add licenses plugin


Add github link to project.clj

Add github link to project.clj

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/jtbeckha/alda.git/'


bump version to 2.8.23

bump version to 2.8.23

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B2W-BIT/restQL-server.git/'


Version 53

Version 53

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject clojars-web "53-SNAPSHOT"
+(defproject clojars-web "53"
   :min-lein-version "2.0.0"
   :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/tools.cli "0.2.1"]


Remove two 'prn' statements.

Remove two 'prn' statements.

--- src/pepa/web/handlers.clj
+++ src/pepa/web/handlers.clj
@@ -151,8 +151,6 @@
                  {added-tags :added, removed-tags :removed} (:tags params)]
              (assert (every? string? added-tags))
              (assert (every? string? removed-tags))
-             (prn "Attributes" (select-keys params [:title :document-date]))
-             (prn "Attributes" attrs)
              (db/with-transaction [db (:pepa/db req)]
                (m/update-document! db id attrs added-tags removed-tags)
                {::document (m/get-document db id)})))


optimized attributes rendering (2x-3x faster than Hiccup)

--- src/rum/server_render.clj
+++ src/rum/server_render.clj
@@ -46,26 +46,21 @@
     "meta" "param" "source" "track" "wbr"})

-(defn container-tag? [tag content]
-  (or content
-      (not (contains? void-tags tag))))
-
-
 (def attr-mapping
-  {:class-name "class"
-   :className  "class"
-   :html-for   "for"
-   :htmlFor    "for"})
-
-
-(defn react-attr->html ^String [attr]
-  (let [^String attr-str (or (attr-mapping attr)
-                             (str/lower-case (to-str attr)))]
-    (if (or (.startsWith attr-str "data-")
-            (.startsWith attr-str "aria-")
-            (.startsWith attr-str "-"))
-      attr-str
-      (str/replace attr-str "-" ""))))
+  { :class-name "class"
+    :className  "class"
+    :html-for   "for"
+    :htmlFor    "for" })
+
+
+(defn normalize-attr-key ^String [key]
+  (let [^String str (or (attr-mapping key)
+                        (str/lower-case (to-str key)))]
+    (if (or (.startsWith str "data-")
+            (.startsWith str "aria-")
+            (.startsWith str "-"))
+      str
+      (str/replace str "-" ""))))

 (defn escape-html [^String s]
@@ -98,65 +93,36 @@
         (if (nil? sb) s (str sb))))))

-(defn normalize-attrs [attrs]
-  (->> (for [[k v] attrs
-             :let [k (react-attr->html k)]
-             :when (not (.startsWith k "on"))]
-         [(keyword k) v])
-       (into {})))
-
-
-(defn merge-attrs
-  [tag-attrs attrs]
-  (let [attrs       (normalize-attrs attrs)
-        tag-class   (:class tag-attrs)
-        attrs-class (:class attrs)
-        class       (if (and tag-class attrs-class)
-                      [tag-class attrs-class]
-                      (or tag-class attrs-class))]
-    (-> (into (dissoc tag-attrs :class)
-              (dissoc attrs :class))
-        (assoc :class class))))
-
-
-(defn match-tag
-  "Match `s` as a CSS tag and return a vector of tag name, CSS id and
-  CSS classes."
-  [s]
-  (let [matches (re-seq #"[#.]?[^#.]+" (name s))
-        [tag-name names] (cond
-                           (empty? matches)
-                             (throw (ex-info (str "Can't match CSS tag: " s) {:tag s}))
-                           (#{\# \.} (ffirst matches)) ;; shorthand for div
-                             ["div" matches]
-                           :default
-                             [(first matches) (rest matches)])]
-    [tag-name
-     (->> names
-          (filter #(.startsWith ^String % "#"))
-          (map #(subs % 1))
-          first)
-     (->> names
-          (filter #(.startsWith ^String % "."))
-          (mapv #(subs % 1)))]))
-
-
-(defn normalize-element
-  "Ensure an element vector is of the form [tag-name attrs content]."
-  [[tag & content]]
-  (when (not (or (keyword? tag) (symbol? tag) (string? tag)))
-    (throw (IllegalArgumentException. (str tag " is not a valid element name."))))
-  (let [[tag id classes] (match-tag tag)
-        tag-attrs        { :id id
-                           :class classes }
-        map-attrs        (first content)]
-    (cond
-      (map? map-attrs)
-        [tag (merge-attrs tag-attrs map-attrs) (next content)]
-      (nil? map-attrs)
-        [tag tag-attrs (next content)]
-      :else
-        [tag tag-attrs content])))
+(defn parse-selector [s]
+  (loop [matches (re-seq #"([#.])?([^#.]+)" (name s))
+         tag     "div"
+         id      nil
+         classes nil]
+    (if-let [[_ prefix val] (first matches)]
+      (case prefix
+        nil (recur (next matches) val id classes)
+        "#" (recur (next matches) tag val classes)
+        "." (recur (next matches) tag id (conj (or classes []) val)))
+      [tag id classes])))
+
+
+(defn normalize-element [[first second & rest]]
+  (when-not (or (keyword? first)
+                (symbol? first)
+                (string? first))
+    (throw (ex-info "Expected a keyword as a tag" { :tag first })))
+  (let [[tag tag-id tag-classes] (parse-selector first)
+        [attrs children] (if (or (map? second)
+                                 (nil? second))
+                           [second rest]
+                           [nil    (cons second rest)])
+        attrs-classes    (or (:class attrs)
+                             (:class-name attrs)
+                             (:className attrs))
+        classes          (if (and tag-classes attrs-classes)
+                           [tag-classes attrs-classes]
+                           (or tag-classes attrs-classes))]
+    [tag tag-id classes attrs children]))

 ;;; render attributes
@@ -183,7 +149,7 @@
     (number? value)
       (str value (when (not= 0 value) "px"))
     (and (string? value)
-         (re-matches #"\s*\d+\s*" value))
+         (re-matches #"\s*\d+\s*" value)) ;; FIXME floats?
       (recur key (-> value str/trim Long/parseLong))
     :else
       (escape-html (to-str value))))
@@ -223,19 +189,23 @@

 (defn render-classes! [classes sb]
-  (let [empty? (render-class! sb true classes)]
-    (when-not empty?
-      (append! sb "\""))))
-
-
-(defn render-attr! [name value sb]
-  (let [name (to-str name)]
+  (when classes
+    (let [empty? (render-class! sb true classes)]
+      (when-not empty?
+        (append! sb "\"")))))
+
+
+(defn render-attr! [key value sb]
+  (let [attr (normalize-attr-key key)]
     (cond
-      (true? value)    (append! sb " " name "=\"\"")
+      (= "style" attr) (render-style! value sb)
+      (= "key" attr)   :nop
+      (= "class" attr) :nop
       (not value)      :nop
-      (= "style" name) (render-style! value sb)
-      (= "class" name) (render-classes! value sb)
-      :else            (append! sb " " name "=\"" (to-str value) "\""))))
+      (true? value)    (append! sb " " attr "=\"\"")
+      (.startsWith attr "on")            :nop
+      (= "dangerouslysetinnerhtml" attr) :nop
+      :else            (append! sb " " attr "=\"" (to-str value) "\""))))

 (defn render-attrs! [attrs sb]
@@ -250,49 +220,60 @@
     "Turn a Clojure data type into a string of HTML with react ids."))

-(defn -render-element
+(defn render-inner-html! [attrs children sb]
+  (when-let [inner-html (:dangerouslySetInnerHTML attrs)]
+    (when-not (empty? children)
+      (throw (Exception. "Invariant Violation: Can only set one of `children` or `props.dangerouslySetInnerHTML`.")))
+    (when-not (:__html inner-html)
+      (throw (Exception. "Invariant Violation: `props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.")))
+    (append! sb (:__html inner-html))
+    true))
+
+
+(defn render-content! [tag attrs children *key sb]
+  (if (and (nil? children)
+           (contains? void-tags tag))
+    (append! sb "/>")
+    (do
+      (append! sb ">")
+      (or (render-inner-html! attrs children sb)
+          (doseq [element children]
+            (-render-html element children *key sb)))
+      (append! sb "</" tag ">"))))
+
+
+(defn render-element!
   "Render an element vector as a HTML element."
   [element *key sb]
-  (let [[tag attrs content] (normalize-element element)
-        key                 @*key
-        _                   (vswap! *key inc)
-        attrs               (cond-> attrs
-                              true       (dissoc :key)
-                              (== key 1) (assoc  :data-reactroot "")
-                              true       (assoc  :data-reactid key))
-        inner-html          (:dangerouslysetinnerhtml attrs)
-        attrs               (if inner-html
-                              (dissoc attrs :dangerouslysetinnerhtml)
-                              attrs)]
-
-    (when inner-html
-      (when-not (empty? content)
-        (throw (Exception. "Invariant Violation: Can only set one of `children` or `props.dangerouslySetInnerHTML`.")))
-      (when-not (:__html inner-html)
-        (throw (Exception. "Invariant Violation: `props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information."))))
-
+  (let [[tag id classes attrs children] (normalize-element element)]
+
     (append! sb "<" tag)
+
+    (when id
+      (append! sb " id=\"" id "\""))
+
     (render-attrs! attrs sb)

-    (if (container-tag? tag content)
-      (do
-        (append! sb ">")
-        (if inner-html
-          (append! sb (:__html inner-html))
-          (-render-html content element *key sb))
-        (append! sb "</" tag ">"))
-      (append! sb "/>"))))
+    (render-classes! classes sb)
+
+    (when (== @*key 1)
+      (append! sb " data-reactroot=\"\""))
+
+    (append! sb " data-reactid=\"" @*key "\"")
+    (vswap! *key inc)
+
+    (render-content! tag attrs children *key sb)))

 (extend-protocol HtmlRenderer
   IPersistentVector
   (-render-html [this parent *key sb]
-    (-render-element this *key sb))
+    (render-element! this *key sb))

   ISeq
   (-render-html [this parent *key sb]
     (doseq [element this]
-      (-render-html element this *key sb)))
+      (-render-html element parent *key sb)))

   Named
   (-render-html [this parent *key sb]
@@ -356,5 +337,3 @@
       (-render-html src nil (volatile! 1) sb)
       (.insert sb (.indexOf sb ">") (str " data-react-checksum=\"" (adler32 sb) "\""))
       (str sb))))
-
-(render-html [:div { :class [nil] }])


Get rid of $ from names

Get rid of $ from names

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/shaunstanislaus/cljs2go.git/'


Replaced SQLITE with HSQLDB

Replaced SQLITE with HSQLDB

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/acessocard/microscope.git/'


Add test for appropriate spread on balanced scheduler

error: pathspec 'test/onyx/scheduler/balanced_generative_test.clj' did not match any file(s) known to git

--- test/onyx/scheduler/balanced_generative_test.clj
+++ test/onyx/scheduler/balanced_generative_test.clj
@@ -0,0 +1,91 @@
+(ns onyx.scheduler.balanced-generative-test
+  (:require [onyx.messaging.dummy-messenger :refer [dummy-messenger]]
+            [onyx.log.generators :as log-gen]
+            [onyx.extensions :as extensions]
+            [onyx.system]
+            [onyx.api :as api]
+            [onyx.static.planning :as planning]
+            [onyx.test-helper :refer [job-allocation-counts]]
+            [clojure.set :refer [intersection]]
+            [clojure.test.check :as tc]
+            [clojure.test.check.generators :as gen]
+            [clojure.test.check.properties :as prop]
+            [clojure.test :refer :all]
+            [onyx.log.replica :as replica]
+            [onyx.log.commands.common :as common]
+            [com.gfredericks.test.chuck :refer [times]]
+            [com.gfredericks.test.chuck.clojure-test :refer [checking]]
+            [taoensso.timbre :refer [info]]))
+
+(def onyx-id (java.util.UUID/randomUUID))
+
+(def peer-config
+  {:onyx/tenancy-id onyx-id
+   :onyx.messaging/impl :dummy-messenger
+   :onyx.peer/try-join-once? true})
+
+(def base-replica
+  (merge replica/base-replica
+         {:job-scheduler :onyx.job-scheduler/balanced
+          :messaging {:onyx.messaging/impl :dummy-messenger}}))
+
+(def messenger (dummy-messenger {}))
+
+(def job
+  {:workflow [[:a :b] [:b :c]]
+   :catalog [{:onyx/name :a
+              :onyx/plugin :onyx.test-helper/dummy-input
+              :onyx/type :input
+              :onyx/medium :dummy
+              :onyx/batch-size 20}
+
+             {:onyx/name :b
+              :onyx/fn :mock/fn
+              :onyx/type :function
+              :onyx/min-peers 4
+              :onyx/max-peers 4
+              :onyx/batch-size 20}
+
+             {:onyx/name :c
+              :onyx/plugin :onyx.test-helper/dummy-output
+              :onyx/type :output
+              :onyx/medium :dummy
+              :onyx/batch-size 20}]
+   :task-scheduler :onyx.task-scheduler/balanced})
+
+(deftest combined-jobs
+  (let [n-jobs 4
+        n-peers 21
+        job-ids (repeatedly n-jobs #(java.util.UUID/randomUUID))
+        jobs-rets (map (fn [job-id]
+                         (api/create-submit-job-entry job-id
+                                                      peer-config
+                                                      job
+                                                      (planning/discover-tasks (:catalog job) (:workflow job))))
+                       job-ids)]
+    (checking
+     "Checking peers are allocated to job 1 even though job 2 is submitted and can't start."
+     (times 50)
+     [{:keys [replica log peer-choices]}
+      (log-gen/apply-entries-gen
+       (gen/return
+        {:replica base-replica
+         :message-id 0
+         :entries (assoc (log-gen/generate-join-queues (log-gen/generate-group-and-peer-ids 1 n-peers))
+                         :jobs {:queue jobs-rets})
+         :log []
+         :peer-choices []}))]
+     (is (= 3 (count (:jobs replica))))
+     (println "Jobs" (:jobs replica))
+     (println "Allocatios" (:allocations replica))
+     #_(let [[t1 t2 t3] (:tasks (:args job-1-rets))
+           [t4 t5 t6] (:tasks (:args job-2-rets))]
+       (is (= 3 (count (get (get (:allocations replica) job-1-id) t1))))
+       (is (= 4 (count (get (get (:allocations replica) job-1-id) t2))))
+       (is (= 3 (count (get (get (:allocations replica) job-1-id) t3))))
+
+       (is (= 0 (count (get (get (:allocations replica) job-2-id) t4))))
+       (is (= 0 (count (get (get (:allocations replica) job-2-id) t5))))
+       (is (= 0 (count (get (get (:allocations replica) job-2-id) t6)))))
+
+     )))


Added norther tribes language compositions.

error: pathspec 'src/hxgm30/language/gen/assembled/ilunao.clj' did not match any file(s) known to git

--- src/hxgm30/language/gen/assembled/ilunao.clj
+++ src/hxgm30/language/gen/assembled/ilunao.clj
@@ -0,0 +1,103 @@
+(ns hxgm30.language.gen.assembled.ilunao
+  "To use the languages defined here, you can do the following (see the `clj`
+  namespace or the `repl` namespace in `dev-system` for how to create a system):
+  ```
+    (require '[hxgm30.language.gen.core :as gen]
+             '[hxgm30.language.gen.assembled.core :as lang]
+             '[hxgm30.language.gen.assembled.ilunao :as ilunao])
+    (lang/paragraph (gen/create-content-generator system) ilunao/othtunwwa)
+  ```
+  Which will give output along the lines of the following:
+  ```
+    Whizz ji reira nou pebodana suran yabisebt. Dan
+    aravan curassouronan mume potikertarp gun kerr
+    aruppitten dep bem. Lu whoom ido ong sluckoo. Lue
+    oya nyaazz hesh kedirayo. Pum settewaxth lias.
+    Phes gegigupe whistramew losomepe irstendeng
+    gesiweck wegetiop boo bur.
+  ```")
+
+(def supported-languages
+  [;; Northern Tribes
+   :nwanitui
+   :othitwa
+   :othtunwwa
+   :zatunun
+   :othne
+   :wituwi
+   :wothniwi
+   :unpoiwe
+   ;; Land-bridge Culture
+   ;; Southern Plateau Nomads
+   ;; Large Island Culture
+   ;; Central Mountain Culture
+   ;; Southern Hemisphere Coastal Cultures
+   ])
+
+;; n'Wanitui (Tundra)
+(def nwanitui
+  {:lakota 50
+   :inuit 30
+   :finnish 15
+   :dwarvish 5})
+
+(def tundra nwanitui)
+
+;; Óðitwa (Boreal Forests)
+(def othitwa
+  {:lakota 50
+   :quenya 5
+   :oldnorse 45})
+
+(def boreal-forests othitwa)
+
+;; Óðtunwwa (Plains)
+(def othtunwwa
+  {:lakota 50
+   :mongolian 40
+   :oldnorse 10})
+
+(def plains othtunwwa)
+
+;; Zâtunun (Hills)
+(def zatunun
+  {:lakota 50
+   :tibetan 40
+   :dwarvish 10})
+
+(def hills zatunun)
+
+;; Óðne (Western Coast)
+(def othne
+  {:lakota 50
+   :gaelic 25
+   :oldnorse 25})
+
+(def western-coast othne)
+
+;; Wituwi (Southern Coast)
+(def wituwi
+  {:lakota 50
+   :maori 45
+   :oldnorse 5})
+
+(def southern-coast wituwi)
+
+;; Wóðniwi (Eastern Bay)
+(def wothniwi
+  {:lakota 50
+   :maori 40
+   :dwarvish 5
+   :oldnorse 5})
+
+(def eastern-bay wothniwi)
+
+;; Unpoiwʻe (Southern Islands)
+(def unpoiwe
+  {:lakota 50
+   :maori 20
+   :hawaiian 25
+   :oldnorse 2.5
+   :dwarvish 2.5})
+
+(def southern-islands unpoiwe)


remove clojure file

remove clojure file

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/bakyeono/retro-typing-tutor.git/'


Add DataScript schema generation for entities

error: pathspec 'src/main/workflo/macros/entity/datascript.cljc' did not match any file(s) known to git

--- src/main/workflo/macros/entity/datascript.cljc
+++ src/main/workflo/macros/entity/datascript.cljc
@@ -0,0 +1,28 @@
+(ns workflo.macros.entity.datascript
+  (:require [datascript.core :as d]
+            [workflo.macros.entity.schema :as es]))
+
+(defn attr-schema
+  [attr-opts]
+  (reduce (fn [opts opt]
+            (cond-> opts
+              (= :ref opt)
+              (assoc :db/valueType :db.type/ref)
+              (= :many opt)
+              (assoc :db/cardinality :db.cardinality/many)
+              (= :unique-value opt)
+              (assoc :db/unique :db.unique/value)
+              (= :unique-identity opt)
+              (assoc :db/unique :db.unique/identity)))
+          {} attr-opts))
+
+(defn entity-schema
+  "Returns the DataScript schema for an entity."
+  [entity]
+  (reduce (fn [schema [attr-name attr-opts]]
+            (let [aschema (attr-schema attr-opts)]
+              (cond-> schema
+                (not (empty? aschema))
+                (assoc attr-name aschema))))
+          {}
+          (es/entity-schema entity)))


Changing run-query endpoint url

Changing run-query endpoint url


New file for defining schemas to be used elsewhere.

error: pathspec 'src/chessground/schemas.cljs' did not match any file(s) known to git

--- src/chessground/schemas.cljs
+++ src/chessground/schemas.cljs
@@ -0,0 +1,34 @@
+(ns chessground.schemas
+  (:require [schema.core :as s :refer [Any Str Bool]])
+  (:require-macros [schema.macros :as sm :refer [defschema]]))
+
+(defschema AnyMap {Any Any})
+
+(defschema Square
+  (s/both
+    (s/pred #(contains? (set (seq "abcdefgh")) (first %)) 'proper-file)
+    (s/pred #(contains? (set (seq "12345678")) (second %)) 'proper-rank)))
+
+(defschema ChessPiece
+  {:role  (s/enum "pawn" "rook" "knight" "bishop" "queen" "king")
+   :color (s/enum "black" "white")})
+
+(defschema BoardState {Square ChessPiece})
+
+(defschema PiecesMap {:pieces BoardState})
+
+(defschema MoveMap {Square [Square]})
+
+(defschema ChessState
+  {:fen   (s/maybe Str)
+   :chess (s/either PiecesMap {})
+   :orientation (s/enum "white" "black")
+   :movable {:free Bool
+             :color (s/enum "white" "black" "both")
+             :dests (s/maybe MoveMap)
+             :drop-off (s/enum "revert" "trash")
+             :drag-center Bool
+             :events {Keyword js/Function}}
+   :selected (s/maybe Str)
+   :dragging Bool
+   :spare-pieces Bool})


define gen-inline-llvm-c-types macro

define gen-inline-llvm-c-types macro

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/aamedina/clojure.llvm.git/'


formatting

formatting

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/shaunlebron/atom-parinfer.git/'


actually add util

actually add util

error: pathspec 'src/gh_waiting_room/util.clj' did not match any file(s) known to git

--- src/gh_waiting_room/util.clj
+++ src/gh_waiting_room/util.clj
@@ -0,0 +1,20 @@
+(ns gh-waiting-room.util)
+
+(defn hex-hmac-sha1
+  "Generate hex for a given secret key and string. From https://gist.github.com/visibletrap/4571244"
+  [key input]
+  (let [secret (javax.crypto.spec.SecretKeySpec. (. key getBytes "UTF-8") "HmacSHA1")
+        hmac-sha1 (doto (javax.crypto.Mac/getInstance "HmacSHA1") (.init secret))
+        bytes (. hmac-sha1 doFinal (. input getBytes "UTF-8"))
+        hex (apply str (map (partial format "%02x") bytes))]
+    hex))
+
+(defn get-in!
+  "Fail fast if no truish value for get-in"
+  [m ks]
+  (or (get-in m ks) (throw (ex-info "No value found for nested keys in map" {:map m :keys ks}))))
+
+(defn get!
+  "Fail fast if no truish value for get"
+  [m k]
+  (or (get m k) (throw (ex-info "No value found for key in map" {:map m :key k}))))


add subscriptions migrations

add subscriptions migrations

Co-authored-by: humbamp123 <65d95376b628b531e429c2ca1f9be9019b5406a1@student.42.us.org>
Co-authored-by: tdiede <ef65042b5cd8cc926c830b14296fb6da2c648f70@gmail.com>

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/starcity-properties/odin.git/'


Notional "surface" widget controls three params.

error: pathspec 'src/overtone/gui/surface.clj' did not match any file(s) known to git

--- src/overtone/gui/surface.clj
+++ src/overtone/gui/surface.clj
@@ -0,0 +1,167 @@
+(ns overtone.gui.surface
+  (:use [seesaw.core]
+        [seesaw.graphics :only [draw circle style string-shape]]
+        [seesaw.color :only [color]]))
+
+; TODO move to Seesaw.
+(def ^ {:private true} input-modifier-table
+  {:left java.awt.event.InputEvent/BUTTON1_DOWN_MASK
+    :center java.awt.event.InputEvent/BUTTON2_DOWN_MASK
+   :right java.awt.event.InputEvent/BUTTON3_DOWN_MASK})
+
+(def ^ {:private true} mouse-button-table
+  {java.awt.event.MouseEvent/BUTTON1 :left
+   java.awt.event.MouseEvent/BUTTON2 :center
+   java.awt.event.MouseEvent/BUTTON3 :right
+   java.awt.event.MouseEvent/NOBUTTON :none })
+
+(defn- mouse-button-down?
+  [^java.awt.event.InputEvent e btn]
+  (let [mask (input-modifier-table btn 0)]
+    (not= 0 (bit-and mask (.getModifiersEx e)))))
+
+(defn- mouse-button [^java.awt.event.MouseEvent e]
+  (mouse-button-table (.getButton e)))
+
+;;;
+
+(defn- scale-val [[from-min from-max] [to-min to-max] v]
+  (let [from-min (double from-min)
+        from-max (double from-max)
+        to-min   (double to-min)
+        to-max   (double to-max)
+        v        (double v)]
+    (+ to-min
+     (* (/ (- v from-min)
+           (- from-max from-min))
+        (- to-max to-min)))))
+
+(defn- to-screen [dim {:keys [get-value min max]}]
+  (scale-val [min max]
+             (if (vector? dim) dim [0 dim])
+             (get-value)))
+(defn- to-model [{:keys [min max]} dim v]
+  (scale-val (if (vector? dim) dim [0 dim])
+             [min max] v))
+
+(defn- paint-point
+  [point c g]
+  (let [x (to-screen (width c) (:x point))
+        y (to-screen (height c) (:y point))
+        z (to-screen [50 255] (:z point))
+        r (to-screen [15 35] (:z point))]
+    (draw g
+        (circle x y r)
+        (style :background (color (:color point) (max 40 (int z)))))))
+
+(defn- paint-surface
+  [state c g]
+  (paint-point state c g)
+  (draw g
+    (string-shape 5 15 (str "x: " (get-in state [:x :name])))
+    (style :foreground :darkgrey)
+
+    (string-shape 5 30 (str "y: " (get-in state [:y :name])))
+    (style :foreground :darkgrey)
+
+    (string-shape 5 45 (str "z: " (get-in state [:z :name])))
+    (style :foreground :darkgrey)))
+
+(defn- handle-move-event [state e]
+  (if (or (mouse-button-down? e :left)
+          (mouse-button-down? e :right))
+    (let [x (min (max (.getX e) 0) (width e))
+          y (min (max (.getY e) 0) (height e))]
+      ((get-in state [:x :set-value]) (to-model (:x state) (width e) x))
+      ((get-in state [:y :set-value]) (to-model (:y state) (height e) y))
+      (repaint! e))))
+
+(defn- handle-press-event [state timer e]
+  (handle-move-event state e)
+  (if (= :right (mouse-button e))
+    (reset! (:dir state) +)
+    (repaint! e)))
+
+(defn- handle-release-event [state timer e]
+  (if (= :right (mouse-button e))
+    (reset! (:dir state) -)
+    (repaint! e)))
+
+(defn- handle-timer [state c]
+  (if-let [dir @(:dir state)]
+    (let [{min-val :min max-val :max
+           set-value :set-value get-value :get-value} (:z state)
+          v (get-value)]
+      (set-value (max min-val
+                      (min max-val
+                           (dir v
+                                (/ (- max-val min-val) 20.0)))))
+      (repaint! c)))
+  c)
+
+(defn surface-panel [x y z]
+  (let [state {:color :blue
+               :x x :y y :z z :dir (atom nil)}
+        c (canvas :preferred-size [480 :by 480]
+                  :cursor :crosshair
+                  :paint (fn [c g] (paint-surface state c g)))
+        t (timer (partial handle-timer state)
+                 :initial-value c
+                 :start? true :delay 100 :initial-delay 1)]
+    (listen c
+      #{:mouse-moved :mouse-dragged}  (partial handle-move-event state)
+      :mouse-pressed  (partial handle-press-event state t)
+      :mouse-released (partial handle-release-event state t))
+    [c t]))
+
+(defn surface
+  [x y z]
+  (invoke-now
+    (let [[panel timer] (surface-panel x y z)
+          f (frame :title "Surface"
+                   :content panel
+                   :on-close :dispose)]
+      (listen f :window-closed (fn [_] (.stop timer)))
+      (-> f pack! show!))))
+
+(defn- synth-param [synth name]
+  (let [param (some #(if (= name (:name %)) %) (:params synth))]
+    { :name (str (:name synth) "/" name)
+      :get-value (fn []  @(:value param))
+      :set-value #(reset! (:value param) %)
+      :min (:min param)
+      :max (:max param)}))
+
+(def ^ {:private true} nil-param {:name ""
+                                  :get-value (fn [] 0)
+                                  :set-value (fn [_])
+                                  :min 0.0
+                                  :max 1.0})
+
+(defn synth-surface
+  "Create a 'surface' for controlling synth params. Takes three
+  synth/param-name pairs for x, y, and z.
+
+  Mouse controls are as follows:
+
+    x - left-drag left to right
+    y - left-drag top to bottom
+    z - hold down right mouse button
+
+  "
+  [[x-synth x-name] [y-synth y-name] [z-synth z-name]]
+  (surface
+    (if x-synth (synth-param x-synth x-name) nil-param)
+    (if y-synth (synth-param y-synth y-name) nil-param)
+    (if z-synth (synth-param z-synth z-name) nil-param)))
+
+(comment
+  (do
+    (use 'overtone.live)
+    (use 'overtone.gui.sequencer)
+    (use 'overtone.gui.surface)
+    (use 'overtone.inst.drum)
+    (def m (metronome 128))
+    (step-sequencer m 11 kick closed-hat snare)
+    (synth-surface [snare "freq"] [kick "freq"] [snare "sustain"])))
+