power

power

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

--- src/maths/power.clj
+++ src/maths/power.clj
@@ -0,0 +1,46 @@
+(ns maths.power)
+
+; bad, blows stack
+(defn exp0 [x n]
+     (if (zero? n) 1
+         (* x (exp0 x (dec n)))))
+
+(defn exp1 [x n]
+  (loop [acc 1 n n]
+    (if (zero? n) acc
+        (recur (* x acc) (dec n)))))
+
+(defn exp2 [x n]
+  (reduce * (repeat n x)))
+
+(defn exp3 [x n]
+  (loop [x x n n r 1]
+    (cond
+      (= n 0) r
+      (even? n) (recur (* x x) (/ n 2) r)
+      :else (recur x (dec n) (* r x)))))
+
+(defn exp4 [x pow]
+  (apply * (repeat pow x)))
+
+; sneaky-impl, fast
+(defn exp5 [b n]
+  (let [inner (fn [a b n]
+                (cond
+                  (= n 0) a
+                  (even? n) (recur a (* b b) (bit-shift-right n 1))
+                  :else (recur (* a b) b (dec n))))
+        ]
+    (inner 1 b n)))
+
+; handles negative
+(defn abs [p]
+  (if (pos? p) p (- p)))
+
+(defn pow [n p]
+  (let [result (apply * (take (abs p) (cycle [n])))]
+    (if (neg? p) (/ 1 result) result)))
+
+(doseq [ func [exp0 exp1 exp2 exp3 exp4 exp5] ]
+  (println "-- " func " --")
+  (time (dotimes [i 10000]  (func 23 10) )))


stack

stack

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/tiagoantao/turtle.git/'


get-info-user works for linux

get-info-user works for linux

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/colophon/clarango.git/'


lein-swank 1.4.5

lein-swank 1.4.5

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/'


Update dependency to resolve https://github.com/clj-commons/ordered/issues/40

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/HealthUnlocked/lein-docker-compose.git/'


Version 1.7.3-SNAPSHOT

Version 1.7.3-SNAPSHOT

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/'


rollback postgres driver - new version breaks under openjdk7

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/vincentstorme/clojureme.git/'


Version 1.5.2-SNAPSHOT

Version 1.5.2-SNAPSHOT


Fixed

Fixed

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/'


Version 1.12.3-SNAPSHOT

Version 1.12.3-SNAPSHOT


fix typo

fix typo

--- src-clj/acha/dispatcher.clj
+++ src-clj/acha/dispatcher.clj
@@ -13,4 +13,5 @@
         (catch Exception e
           (logging/error e "Unable to parse commit"))
         (finally
-          ;; mark this tweets as viewed)))))
+          ;; mark this tweets as viewed
+          )))))


Day 2 part 1

Day 2 part 1

error: pathspec 'src/advent_2016/day_02/part_1.cljs' did not match any file(s) known to git


Fix min-inputs typo; remove unused code

Fix min-inputs typo; remove unused code

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/kkroening/jackal.git/'


No longer do I/O inside a `swap!` transaction

H/T Chris for the push to do this correctly.

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/voter-registration-works.git/'


Prepare new namespace for handling clicks on references

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

--- src/discuss/references.cljs
+++ src/discuss/references.cljs
@@ -0,0 +1,18 @@
+(ns discuss.references
+  "Handle interaction with already existing references, for example showing usages in other statements / arguments
+   or providing a form to use it in the own statement."
+  (:require [om.core :as om]
+            [om.dom :as dom]))
+
+(defn dialog
+  "Show a dialog to give the user the option to choose, whether she wants to get some information about the statement
+   or just wants to construct a new statement."
+  []
+  (reify om/IRender
+    (render [_]
+      (dom/div #js {:className "text-center"}
+               (dom/button #js {:className "btn btn-primary"}
+                           "Find usages of this reference")
+               " "
+               (dom/button #js {:className "btn btn-primary"}
+                           "Create new Statement with this reference")))))


n bat soberan

n bat soberan

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/'


update for future migrations

update for future migrations


add fn to handle --verbose (or not) output

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

--- src/aspire/util.clj
+++ src/aspire/util.clj
@@ -0,0 +1,7 @@
+(ns aspire.util)
+
+(def ^:dynamic *isverbose* false)
+(defn output!
+  "Call output! instead of using prn. Respects --verbose. Returns nil."
+  [& msgs] (when *isverbose* (apply prn msgs)))
+


Get proper quadtree insertion/lookup working.

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/'


Add init module not added earlier

Add init module not added earlier

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

--- src/datemo/init.clj
+++ src/datemo/init.clj
@@ -0,0 +1,11 @@
+(ns datemo.init
+  (require
+    [environ.core :refer [env]]
+    [datemo.db :as db]))
+
+(require '[clojure.pprint :refer [pprint]])
+
+(defn init []
+  (if (= "true" (env :testing))
+    (db/init-db true)
+    (db/init-db)))


Separate election authority voter-info from VIP

...in vote-tomorrow notification logic b/c we need different updating &
caching semantics on one vs. the other.

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/'


Prepare for functional (unit?) tests.

Prepare for functional (unit?) 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/mtravers/incidents.git/'


Add lein-generate task

Add lein-generate task

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/manenko/re-widgets.git/'


day9 with spec

day9 with spec

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

--- src/adventofcode2017/day09_spec.clj
+++ src/adventofcode2017/day09_spec.clj
@@ -0,0 +1,44 @@
+(ns adventofcode2017.day09-spec
+  (:require [clojure.spec.alpha :as s]))
+
+(s/def ::garbage (s/cat
+                   :begin #{\<}
+                   :content (s/*
+                              (s/alt
+                                :chars (s/+ (comp not #{\! \>}))
+                                :ignored (s/cat :ign #{\!}
+                                                :char char?)
+                                ))
+                   :end #{\>}))
+
+(s/conform ::garbage (seq "<>"))
+(s/conform ::garbage (seq "<random characters>"))
+(s/conform ::garbage (seq "<<<<>"))
+(s/conform ::garbage (seq "<{!>}>"))
+(s/conform ::garbage (seq "<!!>"))
+(s/conform ::garbage (seq "<!!!>>"))
+(s/conform ::garbage (seq "<{o\"i!a,<{i<a>"))
+
+
+(s/def ::stuff (s/alt :group ::group
+                      :garbage ::garbage))
+
+(s/def ::group (s/cat
+                 :begin #{\{}
+                 :content (s/?
+                            (s/cat
+                              :stuff ::stuff
+                              :more (s/*
+                                      (s/cat
+                                        :separated #{\,}
+                                        :stuff ::stuff))))
+                 :end #{\}}))
+
+(s/conform ::group (seq "{}"))
+(s/conform ::group (seq "{{{}}}"))
+(s/conform ::group (seq "{{},{}}"))
+(s/conform ::group (seq "{{{},{},{{}}}}"))
+(s/conform ::group (seq "{<{},{},{{}}>}"))
+(s/conform ::group (seq "{<a>,<a>,<a>,<a>}"))
+(s/conform ::group (seq "{{<a>},{<a>},{<a>},{<a>}}"))
+(s/conform ::group (seq "{{<!>},{<!>},{<!>},{<a>}}"))


add migration to attach plans to subscription services


Tests for settings.models.delete-user

Tests for settings.models.delete-user

error: pathspec 'test/lunchlotto/settings/models_test.clj' did not match any file(s) known to git

--- test/lunchlotto/settings/models_test.clj
+++ test/lunchlotto/settings/models_test.clj
@@ -0,0 +1,47 @@
+(ns lunchlotto.settings.models-test
+  (:require [clojure.test :refer :all]
+            [clojure.java.jdbc :as jdbc]
+            [environ.core :refer [env]])
+  (:require [lunchlotto.settings.models :as models]
+            [lunchlotto.migrations :as migration]
+            [lunchlotto.auth.utils :as auth-utils]))
+
+(declare ^:dynamic *txn*)
+
+(use-fixtures
+  :once
+  (fn [f]
+    (migration/-main (env :database-url)) (f)))
+
+(use-fixtures
+  :each
+  (fn [f]
+    (jdbc/with-db-transaction
+      [transaction (env :database-url)]
+      (jdbc/db-set-rollback-only! transaction)
+      (binding [*txn* transaction] (f)))))
+
+(defn- create-test-user
+  []
+  (first (jdbc/insert! *txn* :users {:email "jdoe@example.com"
+                                     :password (auth-utils/encrypt-password "secret")
+                                     :is_confirmed true
+                                     :location "Somewhere"
+                                     :latitude 42.123
+                                     :longitude -42.321})))
+
+(defn- get-user-count
+  []
+  (first (jdbc/query *txn* "SELECT COUNT(*) FROM users")))
+
+(deftest delete-user
+  (testing "successfully delete user"
+    (let [user (create-test-user)]
+      (is (= {:count 1} (get-user-count)))
+      (is (true? (models/delete-user *txn* (:id user))))
+      (is (= {:count 0} (get-user-count)))))
+  (testing "attempting to delete a user that doesn't exist"
+    (let [user (create-test-user)]
+      (is (= {:count 1} (get-user-count)))
+      (is (false? (models/delete-user *txn* (java.util.UUID/randomUUID))))
+      (is (= {:count 1} (get-user-count))))))


Simple start to curves testing

Simple start to curves testing

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


refactor repo

refactor repo

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/fhirplace.git/'


Optimize imports

Optimize imports

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/'


Remove outdated manual sns auth approach

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/'


add links to order notifications

add links to order notifications

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/'


Improved exception? predicate implementation and add specialized implementation for extract.

--- src/cljx/cats/monad/exception.cljx
+++ src/cljx/cats/monad/exception.cljx
@@ -198,10 +198,34 @@
   "Return true in case of `v` is instance
   of Exception monad."
   [v]
-  (let [m (proto/get-context v)]
-    (= m exception-monad)))
-
-(defn exec-try-on
+  (if (satisfies? proto/Context v)
+    (identical? (proto/get-context v) exception-monad)
+    false))
+
+(defn extract
+  "Return inner value from exception monad.
+
+  This is a specialized version of `cats.core/extract`
+  for Exception monad types that allows set up
+  the default value.
+
+  If a provided `mv` is an instance of Failure type
+  it will re raise the inner exception. If you need
+  extract value without raising it, use `cats.core/extract`
+  function for it."
+  ([mv]
+   {:pre [(exception? mv)]}
+   (if (success? mv)
+     (proto/extract mv)
+     (throw (proto/extract mv))))
+  ([mv default]
+   {:pre [(exception? mv)]}
+   (if (success? mv)
+     (proto/extract mv)
+     default)))
+
+(defn ^{:no-doc true}
+  exec-try-on
   [func]
   (try
     (let [result (func)]


Rename try? predicate to exception?

Rename try? predicate to exception?

--- src/cljx/cats/monad/exception.cljx
+++ src/cljx/cats/monad/exception.cljx
@@ -194,9 +194,9 @@
   [v]
   (instance? Failure v))

-(defn try?
-  "Check if a provided parameter is instance
-  of Try monad."
+(defn exception?
+  "Return true in case of `v` is instance
+  of Exception monad."
   [v]
   (let [m (proto/get-context v)]
     (= m exception-monad)))


Defaulted to printing the containing paragraph

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/'


service settings form

service settings form

error: pathspec 'src/cljs/swarmpit/component/service/form_settings.cljs' did not match any file(s) known to git

--- src/cljs/swarmpit/component/service/form_settings.cljs
+++ src/cljs/swarmpit/component/service/form_settings.cljs
@@ -0,0 +1,93 @@
+(ns swarmpit.component.service.form-settings
+  (:require [swarmpit.material :as material :refer [svg]]
+            [swarmpit.utils :refer [remove-el]]
+            [rum.core :as rum]))
+
+(enable-console-print!)
+
+(defonce state (atom {:image        nil
+                      :serviceName  ""
+                      :mode         "replicated"
+                      :replicas     1
+                      :autoredeploy false}))
+
+(defn- update-item
+  "Update form item configuration"
+  [k v]
+  (swap! state assoc k v))
+
+(defn- form-image [value]
+  (material/form-row
+    "IMAGE"
+    (material/select-field
+      #js {:value    value
+           :onChange (fn [e i v] (update-item :image v))
+           :style    #js {:display  "inherit"
+                          :fontSize "14px"}}
+      (material/menu-item
+        #js {:key         1
+             :value       "image1:latest"
+             :primaryText "image1:latest"})
+      (material/menu-item
+        #js {:key         2
+             :value       "image1:latest"
+             :primaryText "image2:latest"}))))
+
+(defn- form-name [value]
+  (material/form-row
+    "SERVICE NAME"
+    (material/text-field
+      #js {:id       "serviceName"
+           :value    value
+           :onChange (fn [e v] (update-item :serviceName v))})))
+
+(defn- form-mode [value]
+  (material/form-row
+    "MODE"
+    (material/radio-button-group
+      #js {:name          "mode"
+           :valueSelected value
+           :onChange      (fn [e v] (update-item :mode v))
+           :style         #js {:display   "flex"
+                               :marginTop "14px"}}
+      (material/radio-button
+        #js {:label "Replicated"
+             :value "replicated"
+             :style #js {:width "170px"}})
+      (material/radio-button
+        #js {:label "Global"
+             :value "global"}))))
+
+(defn- form-replicas [value]
+  (material/form-row
+    (str "SERVICE REPLICAS  " "(" value ")")
+    (material/slider #js {:min          1
+                          :max          50
+                          :step         1
+                          :defaultValue 1
+                          :value        value
+                          :onChange     (fn [e v] (update-item :replicas v))
+                          :sliderStyle  #js {:marginTop "14px"}})))
+
+(defn- form-autoredeploy [value]
+  (material/form-row
+    "AUTOREDEPLOY"
+    (material/toogle
+      #js {:toggled  value
+           :onToggle (fn [e v] (update-item :autoredeploy v))
+           :style    #js {:marginTop "14px"}})))
+
+(rum/defc form < rum/reactive []
+  (let [{:keys [image
+                serviceName
+                mode
+                replicas
+                autoredeploy]} (rum/react state)]
+    [:form
+     [:fieldset
+      [:legend "General settings"]
+      (form-image image)
+      (form-name serviceName)
+      (form-mode mode)
+      (if (= "replicated" mode) (form-replicas replicas))
+      (form-autoredeploy autoredeploy)]]))


Custom responses for error statuses

Custom responses for error statuses

--- src/asciinema/yada.clj
+++ src/asciinema/yada.clj
@@ -1,6 +1,7 @@
 (ns asciinema.yada
   (:require [clojure.java.io :as io]
             [taoensso.timbre :as log]
+            [yada.status :as status]
             [yada.yada :as yada]))

 (def not-found-model
@@ -14,13 +15,23 @@
                     "text/html" (io/input-stream (io/resource "asciinema/errors/404.html"))
                     "Not found")))})

+(defn error-response [ctx]
+  (let [status (-> ctx :response :status)
+        status-name (get-in status/status [status :name])]
+    (case (yada/content-type ctx)
+      "text/html" (str "
" status-name "
")
+      status-name)))
+
 (defn logger [ctx]
   (when-let [error (:error ctx)]
     (when (not= (-> ctx :response :status) 404)
       (log/error error))))

 (defn resource [model]
-  (-> model
-      (assoc :logger logger)
-      (update-in [:responses 404] #(or % not-found-model))
-      yada/resource))
+  (let [error-statuses (set (concat (range 400 404) (range 405 600) ))]
+    (-> model
+        (assoc :logger logger)
+        (update-in [:responses 404] #(or % not-found-model))
+        (update-in [:responses error-statuses] #(or % {:produces #{"text/html" "text/plain"}
+                                                       :response error-response}))
+        yada/resource)))


jobs/web/spider.clj: generate requests for scrapable URIs

error: pathspec 'src/org/altlaw/jobs/web/spider.clj' did not match any file(s) known to git

--- src/org/altlaw/jobs/web/spider.clj
+++ src/org/altlaw/jobs/web/spider.clj
@@ -0,0 +1,17 @@
+(ns org.altlaw.jobs.web.spider
+  (:require [org.altlaw.util.hadoop :as h]
+            [org.altlaw.extract.scrape.handler :as handler]
+            [clojure.contrib.duck-streams :as duck]))
+
+(h/setup-mapreduce)
+
+(defn tool-run [this args]
+  (let [job (h/default-jobconf this)
+        outpath (Path. (h/job-path :web :request))
+        hdfs (FileSystem/get job)]
+    (.delete hdfs outpath true)
+    (with-open [hdfs-stream (.create hdfs (Path. outpath "part-99999") true)]
+      (binding [*out* (duck/writer (.getWrappedStream hdfs-stream))]
+        (doseq [r (handler/all-requests)]
+          (prn r))))
+    0))


Add note.

Add note.


Problem 0118.

Problem 0118.

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

--- src/project_euler/problem_0118.clj
+++ src/project_euler/problem_0118.clj
@@ -0,0 +1,65 @@
+(ns project-euler.problem_0118
+  (:require [clojure.math.combinatorics :as combo]))
+
+;; Using all of the digits 1 through 9 and concatenating them freely to form decimal integers,
+;; different sets can be formed.
+;; Interestingly with the set {2,5,47,89,631}, all of the elements belonging to it are prime.
+
+;; How many distinct sets containing each of the digits one through nine exactly once
+;; contain only prime elements?
+
+(defn prime?
+  [n]
+  {:pre [(integer? n) (> n 0)]}
+  (and (not (>= 1 n))
+       (or (== 2 n)
+           (let [mmax (+ (Math/sqrt n) 1)]
+             (not (some #(== 0 (rem n %)) (concat [2] (range 3 mmax 2))))
+             ))))
+
+(def mz-prime?
+  (memoize prime?))
+
+(defn contains-multiple-of-3? [dss]
+  (some (fn [ds]
+          (and (not (= ds [3]))
+               (zero? (rem (reduce + ds) 3))
+               ))
+        dss))
+
+(defn contains-multiple-of-2-or-5? [dss]
+  (some (fn [ds]
+          (and (not (= ds [2]))
+               (not (= ds [5]))
+               (let [last-d (last ds)]
+                 (or (even? last-d) (== 5 last-d)))
+               ))
+        dss))
+
+(defn digit-permutations [dss]
+  (->> dss
+       (filter (fn [ds]
+                 (or (= ds [3])
+                     (not (zero? (rem (reduce + ds) 3)))
+                     )))
+       (map combo/permutations)
+       (apply combo/cartesian-product)
+       ))
+
+(defn apply-digits [ds]
+  (reduce (fn [x d] (+ d (* 10 x))) 0 ds))
+
+(defn solution []
+  (->> (range 1 10)
+       (combo/partitions)
+       (remove #(some #{[1] [4] [6] [8]} %))
+       (remove contains-multiple-of-3?)
+       (mapcat digit-permutations)
+       (remove contains-multiple-of-2-or-5?)
+       (filter (fn [dss]
+                 (every? (fn [ds] (mz-prime? (apply-digits ds)))
+                         dss)))
+       (count)
+       ))
+
+;;-> 44680


Create lv.cljs

Create lv.cljs

Latvia (latvian language)

error: pathspec 'src/status_im/translations/lv.cljs' did not match any file(s) known to git

--- src/status_im/translations/lv.cljs
+++ src/status_im/translations/lv.cljs
@@ -0,0 +1,315 @@
+(ns status-im.translations.lv)
+
+(def translations
+  {
+   ;common
+   :members-title                         "Dalībnieki"
+   :not-implemented                       "!tādas funkcijas pagaidām nav"
+   :chat-name                             "Čata nosaukums"
+   :notifications-title                   "Paziņojumi un Skaņas"
+   :offline                               "Offline"
+   :search-for                            "Meklēt..."
+   :cancel                                "Atcelt"
+   :next                                  "Tālāk"
+   :type-a-message                        "Raksti īsziņu..."
+   :type-a-command                        "Ievadi komandu..."
+   :error                                 "Kļūda"
+
+   :camera-access-error                   "Kļūda, nav atļaujas piekļūt kamerai. Lūdzu, iestatījumos pārliecinies, ka  "Status > Camera" ir izvēlēts."
+   :photos-access-error                   "Kļūda, nav atļaujas piekļūt fotogrāfijām. Lūdzu, iestatījumos pārliecinies, ka "Status > Photos" ir izvēlēts."
+
+   ;drawer
+   :invite-friends                        "Uzaicināt draugus"
+   :faq                                   "FAQ un biežāk uzdotie jautājumi"
+   :switch-users                          "Mainīt lietotāju"
+   :feedback                              "Gribi atstāt atsauksmi?\Krati telefonu!"
+   :view-all                              "Skatīt visu"
+   :current-network                       "Tīkls"
+
+   ;chat
+   :is-typing                             "raksta"
+   :and-you                               "un tu
+   :search-chat                           "Meklēt čatu"
+   :members                               {:one   "1 dalībnieks"
+                                           :other "{{count}} dalībnieki"
+                                           :zero  "nav dalībnieku"}
+   :members-active                        {:one   "1 dalībnieks"
+                                           :other "{{count}} dalībnieki"
+                                           :zero  "nav dalībnieku"}
+   :public-group-status                   "Publisks"
+   :active-online                         "Online"
+   :active-unknown                        "Nezināms"
+   :available                             "Pieejams"
+   :no-messages                           "Nav īsziņu"
+   :suggestions-requests                  "Pieprasījums"
+   :suggestions-commands                  "Komandas"
+   :faucet-success                        "Faucet pieprasījums saņemts"
+   :faucet-error                          "Faucet pieprasījuma kļūda"
+
+   ;sync
+   :sync-in-progress                      "Sinhronizē..."
+   :sync-synced                           "Sinhronizēts"
+
+   ;messages
+   :status-sending                        "Sūta"
+   :status-pending                        "Neizlemts"
+   :status-sent                           "Aizsūtīts"
+   :status-seen-by-everyone               "Apskatīts"
+   :status-seen                           "Apskatīts"
+   :status-delivered                      "Piegādāts"
+   :status-failed                         "Neizdevās"
+
+   ;datetime
+   :datetime-ago-format                   "{{number}} {{time-intervals}} {{ago}}"
+   :datetime-second                       {:one   "sekunde"
+                                           :other "sekundes"}
+   :datetime-minute                       {:one   "minūte"
+                                           :other "minūtes"}
+   :datetime-hour                         {:one   "stunda"
+                                           :other "stundas"}
+   :datetime-day                          {:one   "diena"
+                                           :other "dienas"}
+   :datetime-multiple                     "s"
+   :datetime-ago                          "pirms"
+   :datetime-yesterday                    "vakar"
+   :datetime-today                        "šodien"
+
+   ;profile
+   :profile                               "Profils"
+   :edit-profile                          "Rediģēt profilu"
+   :report-user                           "Ziņot"
+   :message                               "Īsziņa"
+   :username                              "Lietotājvārds"
+   :not-specified                         "Nav norādīts"
+   :public-key                            "Public key"
+   :phone-number                          "Telefona numurs"
+   :email                                 "E-pasts"
+   :update-status                         "Rediģēt aprakstu..."
+   :add-a-status                          "Pievienot aprakstu..."
+   :status-prompt                         "Pievieno aprakstu lai cilvēki zinātu ko tu piedāvā. Tu vari arī izlietot #hashtagus."
+   :add-to-contacts                       "Pievieno kontaktu"
+   :in-contacts                           "Kontaktos"
+   :remove-from-contacts                  "Izdzēst kontaktu"
+   :start-conversation                    "Sākt sarunu"
+   :send-transaction                      "Sūtīt transakciju"
+   :share-qr                              "Dalīties ar QR kodu"
+   :error-incorrect-name                  "Lūdzu izmanto citu vārdu"
+   :error-incorrect-email                 "Nepareizs e-pasts"
+
+
+   ;;make_photo
+   :image-source-title                    "Profila bilde"
+   :image-source-make-photo               "Fotografēt"
+   :image-source-gallery                  "Izvēlēties no galerijas"
+   :image-source-cancel                   "Atcelt"
+
+   ;;sharing
+   :sharing-copy-to-clipboard             "Copy to clipboard"
+   :sharing-share                         "Dalīties..."
+   :sharing-cancel                        "Atcelt"
+
+   :browsing-title                        "Browse"
+   :browsing-browse                       "@browse"
+   :browsing-open-in-web-browser          "Atvert pārlūkprogrammā"
+   :browsing-cancel                       "Atcelt"
+
+   ;sign-up
+   :contacts-syncronized                  "Jūsu kontakti ir sinhronizēti"
+   :confirmation-code                     (str "Paldies! Mēs nosūtijām tev īsziņu ar apstiprinājuma kodu"
+                                               "code. Lūdzu ievadi apstiprinājuma kodu lai verificētu savu telefona numuru")
+   :incorrect-code                        (str "Nepareizs kods, mēģiniet vēlreiz")
+   :generate-passphrase                   (str "Tu saņemsi jaunu "passphrase" lai"
+                                               "tu varētu ieiet no cita telefona")
+   :phew-here-is-your-passphrase          "*Fuh* tas bija grūti, re, te ir tavs jauns "passphrase", *pieraksti un sargā to!* Tev viņš būs vajadzīgs lai atgūtu pieju."
+   :here-is-your-passphrase               "Te ir tavs jauns "passphrase", *pieraksti un sargā to!* Tev viņš būs vajadzīgs lai atgūtu pieju savam kontam."
+   :written-down                          "Pārliecinies, ka pareizi pierakstīji to."
+   :phone-number-required                 "Ievadi savu telefonu un es atradīšu tavus draugus."
+   :shake-your-phone                      "Atradi kļūdu? Pastāsti mums par to! Krati telefonu!"
+   :intro-status                          "Čato ar mani, ja gribi mainīt ustatījumus!"
+   :intro-message1                        "Sveicināti! Uzspied lai sāktu!"
+   :account-generation-message            "Lūdzu uzgaidi..."
+   :move-to-internal-failure-message      "Mums vajag pārvietot dažus failus no eksternās uz interno glabātuvi. Lai mēs to varētu izdarīt mums vajag jūsu atļauju."
+   :debug-enabled                         "Debug serveris startēja! Tu vari izlietot *status-dev-cli scan* lai atrastu serveri."
+
+   ;phone types
+   :phone-e164                            "International 1"
+   :phone-international                   "International 2"
+   :phone-national                        "National"
+   :phone-significant                     "Significant"
+
+   ;chats
+   :chats                                 "Čati"
+   :new-chat                              "Jaunais čāts"
+   :delete-chat                           "Dzēst čatu"
+   :new-group-chat                        "Jauna grupa"
+   :new-public-group-chat                 "Pievienoties publiskajam čatam"
+   :edit-chats                            "Rediģēt čatu"
+   :search-chats                          "Meklēt čatu"
+   :empty-topic                           "Nav temata"
+   :topic-format                          "Nepareiz formāts [a-z0-9\\-]+"
+   :public-group-topic                    "Temats"
+
+   ;discover
+   :discover                              "Discover"
+   :none                                  "None"
+   :search-tags                           "Type your search tags here"
+   :popular-tags                          "Popular tags"
+   :recent                                "Recent"
+   :no-statuses-discovered                "No statuses discovered"
+   :no-statuses-found                     "No statuses found"
+
+   ;settings
+   :settings                              "Iestatījumi"
+
+   ;contacts
+   :contacts                              "Kontakti"
+   :new-contact                           "Jauns kontakts"
+   :delete-contact                        "Dzēst kontaktu"
+   :delete-contact-confirmation           "Kontakts tiks dzēsts"
+   :remove-from-group                     "Dzēst no grupas"
+   :edit-contacts                         "Rediģēt kontakts"
+   :search-contacts                       "Meklēt kontaktus"
+   :show-all                              "PARĀDĪT VISUS"
+   :contacts-group-dapps                  "ÐApps"
+   :contacts-group-people                 "Cilvēki"
+   :contacts-group-new-chat               "Sākt jaunu čatu"
+   :choose-from-contacts                  "Izvēlēties no kontaktiem"
+   :no-contacts                           "Kontaktu nav"
+   :show-qr                               "Parādīt QR"
+   :enter-address                         "Ieraksti adresi"
+   :more                                  "vairāk"
+
+   ;group-settings
+   :remove                                "Noņemt"
+   :save                                  "Saglabāt"
+   :delete                                "Dzēst"
+   :change-color                          "Mainīt krāsu"
+   :clear-history                         "Dzēst vēsturi"
+   :mute-notifications                    "Mute"
+   :leave-chat                            "Iziet no čata"
+   :delete-and-leave                      "Dzēst un iziet"
+   :chat-settings                         "Čata iestatījumi"
+   :edit                                  "Rediģēt"
+   :add-members                           "Pievienot biedrus"
+   :blue                                  "Blue"
+   :purple                                "Purple"
+   :green                                 "Green"
+   :red                                   "Red"
+
+   ;commands
+   :money-command-description             "Sūtīt naudu"
+   :location-command-description          "Sūtīt lokāciju"
+   :phone-command-description             "Sūtīt numuru"
+   :phone-request-text                    "Telefona numura pieprasījums"
+   :confirmation-code-command-description "Sūtīt apstiprinājuma kodu"
+   :confirmation-code-request-text        "Apstiprinājuma koda pieprasījums"
+   :send-command-description              "Sūtīt lokāciju"
+   :request-command-description           "Sūtīt pieprasījumu"
+   :keypair-password-command-description  ""
+   :help-command-description              "Palīdzība"
+   :request                               "Pieprasījums"
+   :chat-send-eth                         "{{amount}} ETH"
+   :chat-send-eth-to                      "{{amount}} ETH kam {{chat-name}}"
+   :chat-send-eth-from                    "{{amount}} ETH no {{chat-name}}"
+
+   ;new-group
+   :group-chat-name                       "Čata nosaukums"
+   :empty-group-chat-name                 "Ievadi vārdu"
+   :illegal-group-chat-name               "Lūdzu, izvēlaties citu vārdu"
+   :new-group                             "Jauna grupa"
+   :reorder-groups                        "Reorder groups"
+   :group-name                            "Grupas nosaukums"
+   :edit-group                            "Rediģēt grupu"
+   :delete-group                          "Dzēst grupu"
+   :delete-group-confirmation             "Grupa tiks noņēmta. Tas neietikmēs tavus kontaktus"
+   :delete-group-prompt                   "Tas neietikmēs kontaktus"
+   :group-members                         "Grupas biedri"
+   :contact-s                             {:one   "kontakts"
+                                           :other "kontakti"}
+   ;participants
+   :add-participants                      "Pievienot biedrus"
+   :remove-participants                   "Noņemt biedrus"
+
+   ;protocol
+   :received-invitation                   "čata uzaicinājums"
+   :removed-from-chat                     "noņema jūs no grupas čata"
+   :left                                  "atstāja grupu"
+   :invited                               "uzaicināts"
+   :removed                               "noņemts"
+   :You                                   "Tu"
+
+   ;new-contact
+   :add-new-contact                       "Pievienot jaunu kontaktu"
+   :import-qr                             "Importēt"
+   :scan-qr                               "Skanēt QR"
+   :swow-qr                               "Parādīt QR"
+   :name                                  "Vārds"
+   :whisper-identity                      "Whisper Identity"
+   :address-explication                   "Maybe here should be some text explaining what an address is and where to look for it"
+   :enter-valid-address                   "Lūdzu ievadi adresi jeb skanē QR kodu"
+   :enter-valid-public-key                "Lūdzu ievadi publisko atslēgu, jeb skanē QR kodu"
+   :contact-already-added                 "Kontakts jau bija pievienots"
+   :can-not-add-yourself                  "Tu nevari pievienot sevi"
+   :unknown-address                       "Nezināmā adrese"
+
+
+   ;login
+   :connect                               "Savienoties"
+   :address                               "Adrese"
+   :password                              "Parole"
+   :login                                 "Lietotājvārds"
+   :sign-in-to-status                     "Ieiet "Status""
+   :sign-in                               "Ieiet"
+   :wrong-password                        "Parole ievadīta nepareizi"
+
+   ;recover
+   :recover-from-passphrase               "Atgūt no "passphrase""
+   :recover-explain                       "Ievadi "passphrase" lai atgūtu pieeju"
+   :passphrase                            ""Passphrase""
+   :recover                               "Atgūt"
+   :enter-valid-passphrase                "Ievadi "passphrase""
+   :enter-valid-password                  "Ievadi paroli"
+   :twelve-words-in-correct-order         "12 vārdi"
+
+   ;accounts
+   :recover-access                        "Atgūt pieeju"
+   :add-account                           "Pievienot kontu"
+   :create-new-account                    "Izveidot jaunu kontu"
+
+   ;wallet-qr-code
+   :done                                  "Darīts"
+   :main-wallet                           "Galvenais maks"
+
+   ;validation
+   :invalid-phone                         "Nepareizs telefona numurs"
+   :amount                                "Summa"
+   :not-enough-eth                        (str "Kontā nepietiek ETH "
+                                               "({{balance}} ETH)")
+   ;transactions
+   :confirm                               "Apstiprināt"
+   :confirm-transactions                  {:one   "Apstiprināt transakciju"
+                                           :other "Apstiprināt {{count}} transakcijas"
+                                           :zero  "Nav transakciju"}
+   :transactions-confirmed                {:one   "Transakcija apstiprināta"
+                                           :other "{{count}} transakcija apstiprinātas"
+                                           :zero  "Nav apstiprinātas transakcijas"}
+   :transaction                           "Transakcija"
+   :unsigned-transactions                 "Neparakstītas transakcijas"
+   :no-unsigned-transactions              "Nav neparakstītas transakcijas"
+   :enter-password-transactions           {:one   "Apstiprināt transakciju (ievadi savu paroli)"
+                                           :other "Apstiprināt transakcija (ievadi savu paroli)"}
+   :status                                "Status"
+   :pending-confirmation                  "Neizlemts apstiprinājums"
+   :recipient                             "Saņēmējs"
+   :one-more-item                         "Vel viena lieta"
+   :fee                                   "Maksa"
+   :estimated-fee                         "~Maksa"
+   :value                                 "Vērtība"
+   :to                                    "Kam"
+   :from                                  "No"
+   :data                                  "Dati"
+   :got-it                                "Got it"
+   :contract-creation                     "Līguma izveidošana"
+
+   ;:webview
+   :web-view-error                        "ups, kļūda"})


Two smaller todos.

Two smaller todos.

--- src/pepa/printing.clj
+++ src/pepa/printing.clj
@@ -45,7 +45,9 @@
   (lpd/make-server (assoc (select-keys config [:host :port])
                           :handler (job-handler lpd))))

+;;; TODO: Move service announcement to its own component
 (defn ^:private service-infos [config]
+  ;; TODO: Think about a better way to configure the announced name
   (let [name "Pepa DMS Printer"
         queues (or (:queues config) ["auto"])]
     (for [queue queues]


remove unused private var

remove unused private var

--- src/metabase/middleware/format.clj
+++ src/metabase/middleware/format.clj
@@ -34,9 +34,6 @@
                          (fn? %)))
                m))

-(defn- clob? [obj]
-  (= (type obj) org.h2.jdbc.JdbcClob))
-
 (defn- -format-response [obj]
   (cond
     (map? obj)  (->> (remove-fns-and-delays obj)   ; recurse over all vals in the map


fix ordering of `sel` / `ins`

fix ordering of `sel` / `ins`

--- src/metabase/db.clj
+++ src/metabase/db.clj
@@ -39,30 +39,6 @@
   "Should we enable DB call logging? (You might want to disable this if we're doing many in parallel)"
   true)

-(defmulti pre-insert
-  "Gets called by `ins` immediately before inserting a new object immediately before the korma `insert` call.
-   This provides an opportunity to do things like encode JSON or provide default values for certain fields.
-
-    (pre-insert Query [_ query]
-      (let [defaults {:version 1}]
-        (merge defaults query))) ; set some default values"
-  (fn [entity _] entity))
-
-(defmethod pre-insert :default [_ obj]
-  obj)   ; default impl returns object as is
-
-(defn ins
-  "Wrapper around `korma.core/insert` that renames the `:scope_identity()` keyword in output to `:id`
-   and automatically passes &rest KWARGS to `korma.core/values`.
-
-   Returns newly created object by calling `sel`."
-  [entity & kwargs]
-  (let [vals (->> kwargs
-                  (apply assoc {})
-                  (pre-insert entity))]
-    (let [{:keys [id]} (-> (insert entity (values vals))
-                           (clojure.set/rename-keys {(keyword "scope_identity()") :id}))]
-      (sel :one entity :id id))))

 (defmulti pre-update
   "Like pre-insert but called by `upd` before DB operations happen."
@@ -134,7 +110,9 @@
     (sel :many Table :db_id 1)                    -> (select User (where {:id 1}))
     (sel :many Table :db_id 1 (order :name :ASC)) -> (select User (where {:id 1}) (order :name ASC))"
   [one-or-many entity & forms]
-  {:pre [(contains? #{:one :many} one-or-many)]}
+  {:pre [(or (println "one-or-many:" one-or-many)
+             true)
+         (contains? #{:one :many} one-or-many)]}
   `(->> (-sel-select ~entity ~@forms ~@(when (= one-or-many :one) `((limit 1))))
         (map (partial post-select (entity->korma ~entity)))
         ~(case one-or-many
@@ -145,6 +123,31 @@
   "The entity passed to `-sel-select` gets merged with this dictionary right before `select` gets called. This lets you override some of the korma
    entity fields like `:transforms` or `:table`, if need be."
   {})
+
+(defmulti pre-insert
+  "Gets called by `ins` immediately before inserting a new object immediately before the korma `insert` call.
+   This provides an opportunity to do things like encode JSON or provide default values for certain fields.
+
+    (pre-insert Query [_ query]
+      (let [defaults {:version 1}]
+        (merge defaults query))) ; set some default values"
+  (fn [entity _] entity))
+
+(defmethod pre-insert :default [_ obj]
+  obj)   ; default impl returns object as is
+
+(defn ins
+  "Wrapper around `korma.core/insert` that renames the `:scope_identity()` keyword in output to `:id`
+   and automatically passes &rest KWARGS to `korma.core/values`.
+
+   Returns newly created object by calling `sel`."
+  [entity & kwargs]
+  (let [vals (->> kwargs
+                  (apply assoc {})
+                  (pre-insert entity))]
+    (let [{:keys [id]} (-> (insert entity (values vals))
+                           (clojure.set/rename-keys {(keyword "scope_identity()") :id}))]
+      (sel :one entity :id id))))

 (defmacro -sel-select
   "Internal macro used by `sel` (don't call this directly).


Optimized cover png

Optimized cover png


test fix

test fix

--- test/metabase/api/setting_test.clj
+++ test/metabase/api/setting_test.clj
@@ -22,7 +22,7 @@
 (expect-eval-actual-first
     [{:key "test-setting-1", :value nil,     :description "Test setting - this only shows up in dev (1)"}
      {:key "test-setting-2", :value "FANCY", :description "Test setting - this only shows up in dev (2)"}]
-    (do (set-settings nil "FANCY" nil)
+    (do (set-settings nil "FANCY")
         (fetch-all-settings)))

 ;; Check that a non-admin can't read settings
@@ -42,13 +42,13 @@
 (expect-eval-actual-first
     ["NICE!"
      "NICE!"]
-  (do ((user->client :rasta) :put 200 "setting/test-setting-1" :org @org-id {:value "NICE!"})
+  (do ((user->client :rasta) :put 200 "setting/test-setting-1" {:value "NICE!"} :org @org-id)
       [(test-setting-1 @org-id)
        (fetch-setting :test-setting-1)]))

 ;; ## Check non-admin can't set a Setting
 (expect "You don't have permissions to do that."
-  ((user->client :lucky) :put 403 "setting/test-setting-1" :org @org-id {:value "NICE!"}))
+  ((user->client :lucky) :put 403 "setting/test-setting-1" {:value "NICE!"} :org @org-id))

 ;; ## DELETE /api/setting/:key
 (expect-eval-actual-first


Removed unused import

Removed unused import


replace `ui/button` with an actual button


[WM EN] add ping test

[WM EN] add ping test

We use this to test for the service being live, so we should test it.

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/user-http-api.git/'


Bootstrap repl

Bootstrap repl

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

--- src/webcv/repl.cljs
+++ src/webcv/repl.cljs
@@ -0,0 +1,62 @@
+(ns webcv.repl
+  (:require-macros [webcv.env :refer [analyzer-state]])
+  (:require [reagent.core :as r]
+            [reagent.dom :as rdom]
+            [cljs.js]
+            [cljs.pprint :refer [pprint]]
+            [webcv.audio]))
+
+;; https://yogthos.net/posts/2015-11-12-ClojureScript-Eval.html
+;; https://stackoverflow.com/questions/51573858/
+
+(def compiler-state (cljs.js/empty-state))
+
+(def init-forms
+  ["(def out webcv.audio/out)"
+   "(def saw webcv.audio/saw)"])
+
+(let [init (atom false)]
+  (defn read-eval
+    [s]
+    (let [x (atom nil)
+          call-eval (fn [text]
+                      (cljs.js/eval-str compiler-state text nil
+                                        {:eval cljs.js/js-eval}
+                        #(reset! x (:value %))))]
+      (when-not @init
+        (doseq [f init-forms] (call-eval f))
+        (reset! init true))
+      (when s (call-eval s))
+      (deref x))))
+
+(defn eval-audio [s cb]
+  (.then (webcv.audio/reset-ctx!)
+         (fn [] (cb (read-eval s)))))
+
+(defn editor-did-mount [input]
+  (fn [this]
+    (let [cm (.fromTextArea  js/CodeMirror
+                             (rdom/dom-node this)
+                             #js {:mode "clojure"
+                                  :lineNumbers true})]
+      (.on cm "change" #(reset! input (.getValue %))))))
+
+(defn editor [input]
+  (r/create-class
+   {:render (fn [] [:textarea
+                            {:default-value ""
+                             :auto-complete "off"}])
+    :component-did-mount (editor-did-mount input)}))
+
+(defn repl []
+  (let [input (r/atom nil)
+        output (r/atom nil)]
+    (fn []
+      [:div
+       [editor input]
+       [:div
+        [:button
+         {:on-click #(eval-audio @input (partial reset! output))}
+         "run"]]
+       [:p (with-out-str (pprint @output))]])))
+


Remvoe staging don't link warning

Remvoe staging don't link warning

--- src/clj/clojuredocs/site/common.clj
+++ src/clj/clojuredocs/site/common.clj
@@ -98,7 +98,7 @@
     [:div.sticky-wrapper
      (when config/staging?
        [:div.staging-banner
-        "This is the ClojureDocs staging site, where you'll find all the neat things we're working on. Please don't link to here."])
+        "This is the ClojureDocs staging site, where you'll find all the neat things we're working on."])
      ($navbar opts)
      [:div.container
       [:div.row


added basic tests for linkification

added basic tests for linkification

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

--- test/linkification.clj
+++ test/linkification.clj
@@ -0,0 +1,28 @@
+(ns linkification
+  (:use clojure.test
+        [statuses.views.common :only [linkify]]))
+
+(deftest linkify-basic []
+  (is (= (linkify "lorem ipsum") "lorem ipsum")))
+
+(deftest linkify-uris []
+  (is (=
+      (linkify "lorem http://example.org ipsum")
+      "lorem http://example.org ipsum"))
+  (is (=
+      (linkify "http://example.org lipsum")
+      "http://example.org lipsum"))
+  (is (=
+      (linkify "lipsum http://example.org")
+      "lipsum http://example.org")))
+
+(deftest linkify-hashtags []
+  (is (=
+      (linkify "lorem #hashtag ipsum")
+      "lorem #hashtag ipsum"))
+  (is (=
+      (linkify "#hashtag lipsum")
+      "#hashtag lipsum"))
+  (is (=
+      (linkify "lipsum #hashtag")
+      "lipsum #hashtag")))


tstat

tstat

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/clojure-ml/cml.git/'


Add script to verify & repair electorates

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/'


[EN] Remove failing test.

[EN] Remove failing test.

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/'


oops, don't try to create Cards at compile time

--- test/metabase/api/card_test.clj
+++ test/metabase/api/card_test.clj
@@ -57,10 +57,9 @@

 ;; ## GET /api/card/:id
 ;; Test that we can fetch a card
-(let [card-name (random-card-name)
-      {:keys [id]} (post-card card-name)]
+(let [card-name (random-card-name)]
   (expect-eval-actual-first
-      (match-$ (sel :one Card :id id)
+      (match-$ (sel :one Card :name card-name)
         {:description nil
          :can_read true
          :can_write true
@@ -86,15 +85,16 @@
          :visualization_settings {:global {:title nil}}
          :public_perms 0
          :created_at $})
-    (-> ((user->client :rasta) :get 200 (format "card/%d" id))
-        (deserialize-dates :updated_at :created_at))))
+    (let [{:keys [id]} (post-card card-name)]
+      (-> ((user->client :rasta) :get 200 (format "card/%d" id))
+          (deserialize-dates :updated_at :created_at)))))

 ;; ## DELETE /api/card/:id
 ;; Check that we can delete a card
-(let [{:keys [id]} (post-card (random-card-name))]
-  (expect-eval-actual-first nil
-    (do ((user->client :rasta) :delete 204 (format "card/%d" id))
-        (sel :one Card :id id))))
+(expect-eval-actual-first nil
+  (let [{:keys [id]} (post-card (random-card-name))]
+    ((user->client :rasta) :delete 204 (format "card/%d" id))
+    (sel :one Card :id id)))

 ;; # CARD FAVORITE STUFF


fix history bundle content

fix history bundle content


snippets/user.clj

snippets/user.clj

error: pathspec 'home/snippets/.config/snippets/user.clj' did not match any file(s) known to git

--- home/snippets/.config/snippets/user.clj
+++ home/snippets/.config/snippets/user.clj
@@ -0,0 +1,16 @@
+(ns user
+  (:require [clojure.java.io :as io]
+            [clojure.string :as string]
+            [clojure.repl :refer [doc source]]
+            [clojure.tools.namespace.repl :refer [refresh refresh-all]]))
+
+(defn t
+  ([]
+   (refresh-all)
+   (clojure.test/run-all-tests))
+
+  ([ns-or-test]
+   (refresh)
+   (if (find-ns ns-or-test)
+     (clojure.test/test-ns ns-or-test)
+     ((resolve ns-or-test)))))


fix occasional test failure due to ambiguous ordering in test for GET /api/meta/db

--- test/metabase/api/meta/db_test.clj
+++ test/metabase/api/meta/db_test.clj
@@ -108,36 +108,36 @@
 ;; Test that we can get all the DBs for an Org, ordered by name
 (let [db-name (str "A" (random-name))] ; make sure this name comes before "Test Database"
   (expect-eval-actual-first
-      (filter identity
-              [(datasets/when-testing-dataset :generic-sql
-                 (match-$ (sel :one Database :name db-name)
-                   {:created_at      $
-                    :engine          "postgres"
-                    :id              $
-                    :details         {:host "localhost", :port 5432, :dbname "fakedb", :user "cam"}
-                    :updated_at      $
-                    :name            $
-                    :organization_id nil
-                    :description     nil}))
-               (datasets/when-testing-dataset :mongo
-                 (match-$ @mongo-test-data/mongo-test-db
-                   {:created_at      $
-                    :engine          "mongo"
-                    :id              $
-                    :details         $
-                    :updated_at      $
-                    :name            "Test Database"
-                    :organization_id nil
-                    :description     nil}))
-               (match-$ (db)
-                 {:created_at      $
-                  :engine          "h2"
-                  :id              $
-                  :details         $
-                  :updated_at      $
-                  :name            "Test Database"
-                  :organization_id nil
-                  :description     nil})])
+      (set (filter identity
+                   [(datasets/when-testing-dataset :generic-sql
+                      (match-$ (sel :one Database :name db-name)
+                        {:created_at      $
+                         :engine          "postgres"
+                         :id              $
+                         :details         {:host "localhost", :port 5432, :dbname "fakedb", :user "cam"}
+                         :updated_at      $
+                         :name            $
+                         :organization_id nil
+                         :description     nil}))
+                    (datasets/when-testing-dataset :mongo
+                      (match-$ @mongo-test-data/mongo-test-db
+                        {:created_at      $
+                         :engine          "mongo"
+                         :id              $
+                         :details         $
+                         :updated_at      $
+                         :name            "Test Database"
+                         :organization_id nil
+                         :description     nil}))
+                    (match-$ (db)
+                      {:created_at      $
+                       :engine          "h2"
+                       :id              $
+                       :details         $
+                       :updated_at      $
+                       :name            "Test Database"
+                       :organization_id nil
+                       :description     nil})]))
     (do
       ;; Delete all the randomly created Databases we've made so far
       (cascade-delete Database :id [not-in (set (filter identity
@@ -148,7 +148,7 @@
       ;; Add an extra DB so we have something to fetch besides the Test DB
       (create-db db-name)
       ;; Now hit the endpoint
-      ((user->client :rasta) :get 200 "meta/db"))))
+      (set ((user->client :rasta) :get 200 "meta/db")))))

 ;; # DB TABLES ENDPOINTS


Remove :data from schema validation errors

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/'


Examples from chapter 2.

Examples from chapter 2.

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

--- src/living_clojure/example_chapter2.clj
+++ src/living_clojure/example_chapter2.clj
@@ -0,0 +1,209 @@
+(ns wonderland)
+;;-> nil
+
+(defn drinkable? [x]
+  (= x :drinkme))
+;;-> #'wonderland/drinkable?
+
+;; every?
+
+(every? drinkable? [:drinkme :drinkme])
+;;-> true
+
+(every? drinkable? [:drinkme :poison])
+;;-> false
+
+(every? (fn [x] (= x :drinkme)) [:drinkme :drinkme])
+;;-> true
+
+(every? #(= % :drinkme) [:drinkme :drinkme])
+;;-> true
+
+;; not-any?
+(not-any? #(= % :drinkme) [:drinkme :poinson])
+;;-> false
+
+(not-any? #(= % :drinkme) [:poison :poison])
+;;-> true
+
+;; some
+(some #(> % 3) [1 2 3 4 5])
+;;-> true
+
+(some #(> % 3) [0 1 2 3])
+;;-> nil
+
+(#{1 2 3 4 5} 3)
+;;-> 3
+
+;; Beware of logically false values
+(some #{nil} [nil nil nil])
+;;-> nil
+
+(some #{false} [false false false])
+;;-> nil
+
+;; HARNESSING THE POWER OF FLOW CONTROL
+
+;; if
+
+(if true "it is true" "it is false")
+;;-> "it is true"
+
+(if false "it is true" "it is false")
+;;-> "it is false"
+
+(if nil "it is true" "it is false")
+;;-> "it is false"
+
+(if (= :drinkme :drinkme)
+  "Try it"
+  "Don't try it!")
+;;-> "Try it"
+
+;; if-let
+(let [need-to-grow-small (> 5 3)]
+  (if need-to-grow-small
+    "drink bottle"
+    "don't drink bottle"))
+;;-> "drink bottle"
+
+(if-let [need-to-grow-small (> 5 3)]
+  "drink bottle"
+  "don't drink bottle")
+;;-> "drink bottle"
+
+;; when
+(defn drink [need-to-grow-small]
+  (when need-to-grow-small "drink bottle"))
+;;-> #'wonderland/drink
+
+(drink true)
+;;-> "drink bottle"
+
+(drink false)
+;;-> nil
+
+;; when-let
+(when-let [need-to-grow-small true]
+  "drink bottle")
+;;-> "drink bottle"
+
+(when-let [need-to-grow-small false]
+  "drink bottle")
+;;-> nil
+
+;; cond
+(let [bottle "drinkme"]
+  (cond
+    (= bottle "poison") "don't touch"
+    (= bottle "drinkme") "grow smaller"
+    (= bottle "empty") "all gone"))
+;;-> "grow smaller"
+
+;; cond - order matters
+(let [x 5]
+  (cond
+    (> x 3) "bigger than 3"
+    (> x 4) "bigger than 4"
+    (> x 10) "bigger then 10"))
+;;-> "bigger than 3"
+
+(let [x 5]
+  (cond
+    (> x 4) "bigger than 4"
+    (> x 3) "bigger than 3"
+    (> x 10) "bigger than 10"))
+;;-> "bigger than 4"
+
+;; cond with :else keyword
+(let [bottle "mystery"]
+  (cond
+    (= bottle "poison") "don't touch"
+    (= bottle "drinkme") "grow smaller"
+    (= bottle "empty") "all gone"
+    :else "unknown"))
+;;-> "unknown"
+
+;; case
+(let [bottle "drinkme"]
+  (case bottle
+    "poison" "don't touch"
+    "drinkme" "grow smaller"
+    "empty" "all gone"))
+;;-> "grow smaller"
+
+;; case - Exception if none of tests match
+(let [bottle "mystery"]
+  (case bottle
+    "poison" "don't touch"
+    "drinkme" "grow smaller"
+    "empty" "all gone"))
+;;-> IllegalArgumentException
+
+;; FUNCTIONS CREATING FUNCTIONS AND OTHER
+(defn grow [name direction]
+  (if (= direction :small)
+    (str name " is growing smaller")
+    (str name " is growing bigger")))
+;;-> #'wonderland/grow
+
+(grow "Alice" :small)
+;;-> "Alice is growing smaller"
+
+(grow "Alice" :big)
+;;-> "Alice is growing bigger"
+
+;; partial application
+(partial grow "Alice")
+;;-> #<core$partial$fn__4228 clojure.core$partial$fn__4228@70be7da3>
+
+((partial grow "Alice") :small)
+;;-> "Alice is growing smaller"
+
+;; function composition
+(defn toogle-grow
+  [direction]
+  (if (= direction :small) :big :small))
+;;=> #'wonderland/toogle-grow
+
+(defn oh-my
+  [direction]
+  (str "Oh my! You're growing " direction))
+;;=> #'wonderland/oh-my
+
+(oh-my (toogle-grow :small))
+;;=> "Oh my! You're growing :big"
+
+(defn surprise
+  [direction]
+  ((comp oh-my toogle-grow) direction))
+;;-> #'wonderland/surprise
+
+(surprise :small)
+;;-> "Oh my! You're growing :big"
+
+;; DESTRUCTURING
+(let [[color size] ["blue" "small"]]
+  (str "The " color " door is " size))
+;;-> "The blue door is small"
+
+;; without destructuring, the code is more verbose
+(let [x ["blue" "small"]
+      color (first x)
+      size (last x)]
+  (str "The " color " door is " size))
+;;-> "The blue door is small"
+
+;; let's keep the whole initial data structure as binding
+(let [[color [size] :as original] ["blue" ["small"]]]
+  {:color color :size size :original original})
+;;-> {:color "blue", :size "small", :original ["blue" ["small"]]}
+
+;; destructuring can be also applied to maps
+(let [{flower1 :flower1 flower2 :flower2}
+      {:flower1 "red" :flower2 "blue"}]
+  (str "The flowers are " flower1 " and " flower2))
+;;-> "The flowers are red and blue"
+
+;; We can also u


solved

solved

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

--- src/4clojure/lcm.clj
+++ src/4clojure/lcm.clj
@@ -0,0 +1,89 @@
+;; Least Common Multiple
+;; http://www.4clojure.com/problem/100
+
+;; Difficulty:	Easy
+;; Topics:	math
+
+
+;; Write a function which calculates the least common multiple. Your function should accept a variable number of positive integers or ratios.
+
+;; https://en.wikipedia.org/wiki/Least_common_multiple
+;; works for two numbers integers
+
+;; + http://stackoverflow.com/questions/4229870/c-algorithm-to-calculate-least-common-multiple-for-multiple-numbers/4229930
+
+;; http://clojure.org/reference/special_forms
+(defn __
+  ([a b & coll] (reduce __ 1 (concat [a b] coll)))
+  ([a b]
+    (letfn [(gcd [x y] (if (zero? y) x (gcd y (mod x y))))
+            (abs [a] (if (pos? a) a (- a)))]
+      (/ (* (abs a) (abs b))
+         (gcd a b)))))
+
+
+(== (__ 2 3) 6)
+
+(== (__ 5 3 7) 105)
+
+(== (__ 1/3 2/5) 2)
+
+(== (__ 3/4 1/6) 3/2)
+
+(== (__ 7 5/7 2 3/5) 210)
+
+
+;; 4clojure copy paste
+(fn __
+  ([a b & coll] (reduce __ 1 (concat [a b] coll)))
+  ([a b]
+    (letfn [(gcd [x y] (if (zero? y) x (gcd y (mod x y))))
+            (abs [a] (if (pos? a) a (- a)))]
+      (/ (* (abs a) (abs b))
+         (gcd a b)))))
+
+
+
+;; _artem_uv's solution:
+(fn [& a] (reduce (fn [x y] (* x (/ y ((fn [a b] (if (zero? b) a (recur b (mod a b)))) x y)))) (seq a)))
+
+;; _pcl's solution:
+(fn [& xs]
+  (/ (apply * xs)
+    (reduce #(if (zero? %2) % (recur %2 (mod % %2))) xs)))
+
+;; aceeca1's solution:
+(fn lcm [x1 & xn] (first (drop-while
+    (fn [s] (not-every? #(zero? (mod s %)) xn))
+    (iterate (partial + x1) x1))))
+
+;; adereth's solution:
+(fn [x & xs]
+  (let [multiples (map (partial * x) (rest (range)))]
+    (first
+     (filter #(every?
+               (fn [y] (zero? (mod % y)))
+               xs)
+             multiples))))
+
+;; 0x89's solution:
+(fn lcm [& args]
+  (let [lcm-int (fn [args acc]
+                  (let [values (map second acc)
+                        [min-index min-value] (apply min-key second acc)
+                        orig-min-value (args min-index)]
+                    (if (every? (partial = (first values))
+                                values)
+                      min-value
+                        (recur args
+                               (assoc acc
+                                      min-index
+                                      [min-index (+ min-value orig-min-value)]))
+                      )))
+        indexed (vec
+                  (map #(vector %1 %2)
+                       (range)
+                       args))]
+    (lcm-int (vec args) indexed)
+    )
+  )


mesos: improve scheduler logic

mesos: improve scheduler logic

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/pyr/bundes.git/'


Change idiom for blank screen based on feedback

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/'


Less abbreviation

Less abbreviation


Need to munge the params here, but would be nicer if we could get rid of this js* use.

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/'


Adding a multimethod that handles response output coercions

This approach helps extensibility by allowing clients of
this library to add more `:as` coercion options. They only
would need to extend the `coerce-response-output` multimethod
using the value of the `:as` keyword as the dispatching value.

--- src/clj_http/client.clj
+++ src/clj_http/client.clj
@@ -146,74 +146,68 @@
           "deflate" (update resp-c :body util/inflate)
           resp-c)))))

+
+(defmulti coerce-response-output (fn [as _] as))
+
+(defmethod coerce-response-output :byte-array [_ resp] resp)
+
+(defmethod coerce-response-output :stream [_ resp] resp)
+
+(defmethod coerce-response-output :json [_ {:keys [body status] :as resp}]
+  (if (and json-enabled? (unexceptional-status? status))
+    (assoc resp :body (json-decode (String. #^"[B" body "UTF-8") true))
+    (assoc resp :body (String. #^"[B" body "UTF-8"))))
+
+(defmethod coerce-response-output
+  :json-string-keys
+  [_ {:keys [body status] :as resp}]
+  (if (and json-enabled? (unexceptional-status? status))
+    (assoc resp :body (json-decode (String. #^"[B" body "UTF-8")))
+    (assoc resp :body (String. #^"[B" body "UTF-8"))))
+
+(defmethod coerce-response-output :clojure [_ {:keys [status body] :as resp}]
+  (assoc resp :body (read-string (String. #^"[B" body "UTF-8"))))
+
+(defmethod coerce-response-output :auto [_ {:keys [status body] :as resp}]
+  (assoc resp
+         :body
+         (let [typestring (get-in resp [:headers "content-type"])]
+           (cond
+             (.startsWith (str typestring) "text/")
+             (if-let [charset (second (re-find #"charset=(.*)"
+                                               (str typestring)))]
+                     (String. #^"[B" body ^String charset)
+                     (String. #^"[B" body "UTF-8"))
+
+             (.startsWith (str typestring) "application/clojure")
+             (if-let [charset (second (re-find #"charset=(.*)"
+                                               (str typestring)))]
+                     (read-string (String. #^"[B" body ^String charset))
+                     (read-string (String. #^"[B" body "UTF-8")))
+
+             (and (.startsWith (str typestring) "application/json")
+                  json-enabled?
+                  (unexceptional-status? status))
+             (if-let [charset (second (re-find #"charset=(.*)"
+                                               (str typestring)))]
+                     (json-decode (String. #^"[B" body ^String charset) true)
+                     (json-decode (String. #^"[B" body "UTF-8") true))
+
+             :else
+             (String. #^"[B" body "UTF-8")))))
+
+(defmethod coerce-response-output :default [as {:keys [status body] :as resp}]
+  (cond
+    (keyword? as) (assoc resp :body (String. #^"[B" body "UTF-8"))
+    (string? as)  (assoc resp :body (String. #^"[B" body ^String as))
+    :else (assoc resp :body (String. #^"[B" body "UTF-8"))))
+
 (defn wrap-output-coercion [client]
   (fn [{:keys [as] :as req}]
-    (let [{:keys [body status] :as resp} (client req)]
-      (if body
-        (cond
-          (keyword? as)
-          (condp = as
-            ;; Don't do anything when it's a byte-array
-            :byte-array resp
-
-            ;; Don't do anything when it's a stream
-            :stream resp
-
-            ;; Convert to json from UTF-8 string
-            :json
-            (if (and json-enabled? (unexceptional-status? status))
-              (assoc resp :body (json-decode (String. #^"[B" body "UTF-8") true))
-              (assoc resp :body (String. #^"[B" body "UTF-8")))
-
-            ;; Convert to json with strings as keys
-            :json-string-keys
-            (if (and json-enabled? (unexceptional-status? status))
-              (assoc resp :body (json-decode (String. #^"[B" body "UTF-8")))
-              (assoc resp :body (String. #^"[B" body "UTF-8")))
-
-            :clojure
-            (assoc resp :body (read-string (String. #^"[B" body "UTF-8")))
-
-            ;; Attempt to automatically coerce the body, returning a
-            ;; string if no coercions are found
-            :auto
-            (assoc resp
-              :body
-              (let [typestring (get-in resp [:headers "content-type"])]
-                (cond
-                  (.startsWith (str typestring) "text/")
-                  (if-let [charset (second (re-find #"charset=(.*)"
-                                                    (str typestring)))]
-                    (String. #^"[B" body ^String charset)
-                    (String. #^"[B" body "UTF-8"))
-
-                  (.startsWith (str typestring) "application/clojure")
-                  (if-let [charset (second (re-find #"charset=(.*)"
-                                                    (str typestring)))]
-                    (read-string (String. #^"[B" body ^String charset))
-                    (read-string (String. #^"[B" body "UTF-8")))
-
-                  (and (.startsWith (str typestring) "application/json")
-                       json-enabled?
-                       (unexceptional-status? status))
-                  (if-let [charset (second (re-find #"charset=(.*)"
-                                                    (str typestring)))]
-                    (json-decode (String. #^"[B" body ^String charset) true)
-                    (json-decode (String. #^"[B" body "UTF-8") true))
-
-                  :else
-                  (String. #^"[B" body "UTF-8"))))
-
-            ;; No :as matches found
-            (assoc resp :body (String. #^"[B" body "UTF-8")))
-
-          ;; Try the charset given if a string is specified
-          (string? as)
-          (assoc resp :body (String. #^"[B" body ^String as))
-          ;; Return a regular UTF-8 string body
-          :else
-          (assoc resp :body (String. #^"[B" body "UTF-8")))
-        resp))))
+      (let [{:keys [body] :as resp} (client req)]
+        (if body
+          (coerce-response-output as resp)
+          resp))))

 (defn wrap-input-coercion [client]
   (fn [{:keys [body body-encoding length] :as req}]


Log election authority search requests

Log election authority search requests

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-authority-works.git/'


Don't try sub

Don't try sub

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/'


Add job flow for wgset phase 0 processing

error: pathspec 'Jobs/wgseq-phase-0-job-template.clj' did not match any file(s) known to git

--- Jobs/wgseq-phase-0-job-template.clj
+++ Jobs/wgseq-phase-0-job-template.clj
@@ -0,0 +1,10 @@
+
+{:nodes
+ {:ph0
+  {:name "wgseq-phase0",
+   :type "tool",
+   :args []}
+  :prn1 {:type "func",
+         :name "prn"}},
+ :edges
+ {:ph0 [:prn1]}}


WIP AOC Day 24

WIP AOC Day 24

error: pathspec 'clj/advent-of-code-2016/src/advent_of_code_2016/day24.clj' did not match any file(s) known to git

--- clj/advent-of-code-2016/src/advent_of_code_2016/day24.clj
+++ clj/advent-of-code-2016/src/advent_of_code_2016/day24.clj
@@ -0,0 +1,67 @@
+(ns advent-of-code-2016.day24)
+
+(defn parse-input
+  [input]
+  (->> input
+       (clojure.string/split-lines)
+       (map-indexed
+         (fn [row-number row]
+           (map-indexed (fn [column-number symbol] [[column-number row-number] symbol]) row)))
+       (apply concat)
+       (into (sorted-map))))
+
+(defn find-start-location
+  [layout]
+  (->> layout
+       (filter (fn [[_ val]] (= val \0)))
+       (map first)
+       (first)))
+
+(defn get-available-adjacent-locations
+  [layout [x y]]
+  (for [neighbor [[(inc x) y] [(dec x) y] [x (inc y)] [x (dec y)]]
+        :let [neighbor-val (get layout neighbor)]
+        :when (and (not (nil? neighbor-val)) (not= neighbor-val \#))]
+    neighbor))
+
+(defn req-loc? [val] (and (not= val \.) (not= val \#)))
+
+(defn get-required-locations-count
+  [layout]
+  (->> layout
+       (filter (fn [[_ val]] (req-loc? val)))
+       (count)))
+
+(defn step
+  [layout visited-req-locations current-path-length shortest-path-length-so-far current-location req-locations-count prev-loc]
+  (println "Visiting" current-location)
+  (cond
+    (= (count visited-req-locations) req-locations-count) current-path-length
+    (= shortest-path-length-so-far current-path-length) shortest-path-length-so-far
+    :else
+      (let [next-locations (get-available-adjacent-locations layout current-location)
+            curr-value (get layout current-location)
+            next-req-locations (if (req-loc? curr-value) (conj visited-req-locations curr-value) visited-req-locations)]
+        (println "Got" (dec (count next-locations)) "locations next")
+        (reduce
+          (fn [shortest-so-far loc]
+            (step layout next-req-locations (inc current-path-length) shortest-so-far loc req-locations-count current-location))
+          shortest-path-length-so-far
+          (filter #(not= prev-loc %) next-locations)))))
+
+(def sample-input "###########\n#0.1.....2#\n#.#######.#\n#4.......3#\n###########")
+(def sample-layout (parse-input sample-input))
+(def start (find-start-location sample-layout))
+
+
+
+(get-available-adjacent-locations sample-layout [5 1])
+
+(step
+  sample-layout
+  #{}
+  0
+  12333
+  start
+  (get-required-locations-count sample-layout)
+  nil)


Remove refreshAppearances when filling

Remove refreshAppearances when filling

Looks like this _isn't_ required to handle auto-sizing text, and we have
a couple forms that throw font-related exceptions b/c of the way
refreshAppearances ends up re-creating fonts.


M0ar tests

M0ar tests

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

--- test/grimoire/util_test.clj
+++ test/grimoire/util_test.clj
@@ -0,0 +1,19 @@
+(ns grimoire.util-test
+  (:require [grimoire.util :as u]
+            [clojure.test :refer :all]))
+
+(deftest munge-test
+  (is (= "QMARK" (u/munge "?")))
+  (is (= "DOT"   (u/munge ".")))
+  (is (= "SLASH" (u/munge "/"))))
+
+(deftest update-munge
+  (is (= "-" (u/update-munge "_DASH_")))
+  (is (= "!" (u/update-munge "_BANG_")))
+  (is (= "*" (u/update-munge "_STAR_")))
+  (is (= "=" (u/update-munge "_EQ_")))
+  (is (= "<" (u/update-munge "_LT")))
+  (is (= ">" (u/update-munge "_GT"))))
+
+(deftest normalize-version-test
+  (is (= "1.0.0" (u/normalize-version "1.0"))))


nicer, more efficient expansion for with-temp-db

--- test/metabase/test/data.clj
+++ test/metabase/test/data.clj
@@ -198,6 +198,18 @@
          form))
    body))

+(defn with-temp-db* [loader ^DatabaseDefinition dbdef f]
+  (let [dbdef (map->DatabaseDefinition (assoc dbdef :short-lived? true))]
+    (try
+      (remove-database! loader dbdef)
+      (let [db (-> (get-or-create-database! loader dbdef)
+                   -temp-db-add-getter-delay)]
+        (assert db)
+        (assert (exists? Database :id (:id db)))
+        (f db))
+      (finally
+        (remove-database! loader dbdef)))))
+
 (defmacro with-temp-db
   "Load and sync DATABASE-DEFINITION with DATASET-LOADER and execute BODY with
    the newly created `Database` bound to DB-BINDING.
@@ -217,15 +229,6 @@
                                           :aggregation  [\"count\"]
                                           :filter       [\"<\" (:id &events.timestamp) \"1765-01-01\"]}}))"
   [[db-binding dataset-loader ^DatabaseDefinition database-definition] & body]
-  `(let [loader# ~dataset-loader
-         ;; Add :short-lived? to the database definition so dataset loaders can use different connection options if desired
-         dbdef# (map->DatabaseDefinition (assoc ~database-definition :short-lived? true))]
-     (try
-       (remove-database! loader# dbdef#)                              ; Remove DB if it already exists for some weird reason
-       (let [~db-binding (-> (get-or-create-database! loader# dbdef#)
-                             -temp-db-add-getter-delay)]              ; Add the :table-name->table delay used by -temp-get
-         (assert ~db-binding)
-         (assert (exists? Database :id (:id ~db-binding)))
-         ~@(walk-expand-& db-binding body))                           ; expand $table and $table.field forms into -temp-get calls
-       (finally
-         (remove-database! loader# dbdef#)))))
+  `(with-temp-db* ~dataset-loader ~database-definition
+     (fn [~db-binding]
+       ~@(walk-expand-& db-binding body))))


Rotating triangle example

Rotating triangle example

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

--- src/gamma_examples/animate.cljs
+++ src/gamma_examples/animate.cljs
@@ -0,0 +1,72 @@
+(ns gamma-examples.animate
+  (:require
+    [gamma-driver.drivers.basic :as driver]
+    [gamma-driver.protocols :as dp]
+    [gamma.program :as p]
+    [gamma.api :as g]
+    [thi.ng.geom.core :as geom]
+    [thi.ng.geom.core.matrix :as mat :refer [M44]]))
+
+
+(def pos-attribute (g/attribute "a_Pos" :vec2))
+
+(def tmatrix (g/uniform "u_TriangleMatrix" :mat4))
+
+(def color-attribute (g/attribute "colorAttr" :vec4))
+
+(def color-varying (g/varying "colorVarying" :vec4 :mediump))
+
+
+(defn example-program []
+  (p/program
+    {:vertex-shader {(g/gl-position) (g/* tmatrix (g/vec4 pos-attribute 0 1))
+                       color-varying   color-attribute}
+     :fragment-shader {(g/gl-frag-color) color-varying}}))
+
+
+(defn base-data []
+  (driver/normalize-data
+    {pos-attribute [[0 0.5] [-0.5 -0.5] [0.5 -0.5]]
+     color-attribute [[1 0 0 1] [0 1 0 1] [0 0 1 1]]}))
+
+(defn ->radians [degrees]
+  (/ (* degrees Math/PI) 180))
+
+(defn rotate [m deg]
+  (geom/rotate-around-axis m [0 1 0] (->radians deg)))
+
+
+(defn example-driver []
+  (driver/basic-driver
+    (.getContext (.getElementById js/document "gl-canvas") "webgl")))
+
+(defn draw-fn [d p]
+  (fn [triangle-mv-matrix]
+    (driver/draw-program
+      d
+      p
+      (driver/normalize-data {tmatrix triangle-mv-matrix}))))
+
+(defn animate [drawfn stepfn current-value]
+  (js/requestAnimationFrame
+    (fn []
+      (let [next-value (stepfn current-value)]
+        (drawfn next-value)
+        (animate drawfn stepfn next-value)))))
+
+
+(defn main []
+  (let [d (example-driver)
+        p (dp/program d (example-program))
+        base-data (base-data)]
+    (driver/bind d p base-data)
+    (animate
+      (draw-fn d p)
+      #(rotate % 1)
+      M44)))
+
+
+
+
+
+


Make sure we don't divide by zero

Make sure we don't divide by zero

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/'


Clean up imports

Clean up imports


Updated miscRNA gene type assertions rule

Did not complete rule - need to know which SO concept to subclass

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

--- resources/rules/post_identifier_merge/ice_to_bio/miscrna_gene_type_assertions.clj
+++ resources/rules/post_identifier_merge/ice_to_bio/miscrna_gene_type_assertions.clj
@@ -0,0 +1,22 @@
+;; ----------------------------------------------
+;; --------- miscRNA Gene Type Assertion ---------
+;; -----------------------------------------------
+`{:name "miscrna-gene-type-assertion"
+  :description "This rule asserts miscRNA gene type"
+  ;; miscRNA maps to SO: (so:)
+  :head ((?/egKabobDna rdfs/subClassOf obo/SO_XXXXXX))
+  :body ((?/record rdf/type ccp/IAO_EXT_0000681) ; ccp:NCBI_gene_info_record
+         (?/record obo/BFO_0000051 ?/dna_field_value) ; BFO:has_part
+         (?/gene_field_value rdf/type ccp/IAO_EXT_0000876) ; ccp:NCBI_gene_info_record__gene_identifier_field_value
+         (?/gene_field_value rdf/type ?/gene_ice_id)
+         (?/gene_ice_id obo/IAO_0000219 ?/gene) ; IAO:denotes
+
+         ;; retrieve gene type
+         (?/record obo/BFO_0000051 ?/type_field_value) ; BFO:has_part
+         (?/type_field_value rdf/type ccp/IAO_EXT_0000884) ; ccp:NCBI_gene_info_record__type_of_gene_field_value
+         (?/type_field_value rdf/type ?/type_ice_id)
+         (?/type_ice_id obo/IAO_0000219 ?/type) ; IAO:denotes
+
+         (= ?/type "miscRNA"))
+
+  }


added the json part

added the json part

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

--- src/hivewing_core/postgres_json.clj
+++ src/hivewing_core/postgres_json.clj
@@ -0,0 +1,26 @@
+(ns hivewing-core.postgres-json
+  "Inspired by http://www.niwi.be/2014/04/13/postgresql-json-field-with-clojure-and-jdbc/"
+  (:require [clojure.java.jdbc :as jdbc]
+            [clojure.data.json :as json])
+  (:import org.postgresql.util.PGobject))
+
+(defn value-to-json-pgobject [value]
+  (doto (PGobject.)
+    (.setType "json")
+      (.setValue (json/write-str value))))
+
+(extend-protocol jdbc/ISQLValue
+  clojure.lang.IPersistentMap
+  (sql-value [value] (value-to-json-pgobject value))
+
+  clojure.lang.IPersistentVector
+  (sql-value [value] (value-to-json-pgobject value)))
+
+(extend-protocol jdbc/IResultSetReadColumn
+  PGobject
+  (result-set-read-column [pgobj metadata idx]
+    (let [type  (.getType pgobj)
+          value (.getValue pgobj)]
+      (case type
+        "json" (json/read-str value :key-fn keyword)
+        :else value))))


MOAR logging

MOAR logging

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/amedw/mud-server.git/'


MOAR logging

MOAR logging


add new

add new

error: pathspec 'Valid-Anagram/VA.clj' did not match any file(s) known to git

--- Valid-Anagram/VA.clj
+++ Valid-Anagram/VA.clj
@@ -0,0 +1,7 @@
+(defn is-anagram [s t]
+  (cond (= "" s) false
+        (= (seq s) (->> t (seq) (reverse))) true
+        :else false))
+
+(is-anagram "abc" "cba")
+(is-anagram "abc" "cba ")


Added screen-wrapper to allow continuation of game through repl instead of crashing and having to restart the game.

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/'


Add forward-params to run-saved-query

Add forward-params to run-saved-query

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/'


Create file for default projections

Create file for default projections

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

--- src/photon/default_projs.clj
+++ src/photon/default_projs.clj
@@ -0,0 +1,29 @@
+(ns photon.default-projs
+  (:require [serializable.fn :as sfn]
+            [photon.streams :as streams]))
+
+(def stream-fn
+  (sfn/fn [p n]
+    (merge-with
+     #(assoc %1 :total-events (+ (:total-events %1)
+                                 (:total-events %2)))
+     p
+     {(:stream-name n)
+      {:total-events 1}})))
+
+(def default-projections
+  [{:projection-name "__streams__"
+    :stream-name "__all__"
+    :language :clojure
+    :reduction (pr-str stream-fn)
+    :initial-value {}}])
+
+(defn init-default-projs! [stm]
+  (dorun (map #(apply streams/register-query!
+                      stm
+                      (vals
+                       (select-keys % [:projection-name
+                                       :stream-name :language
+                                       :reduction :initial-value])))
+              default-projections)))
+


Show exit dialog when quitting via the OS X menubar


add index view

add index view

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

--- src-cljs/views/index.cljs
+++ src-cljs/views/index.cljs
@@ -0,0 +1,34 @@
+(ns doctopus.views.index)
+
+(defn tentacle-items
+  [tentacles]
+  [:ul
+    (for [tentacle tentacles]
+      (let [tentacle-name (:name tentacle)
+            tentacle-location (:location tentacle)]
+        ^{:key tentacle-name} [:li
+                               [:a {:href tentacle-location} tentacle-name]]))])
+
+(defn head-items
+  [heads]
+  [:ul
+    (for [head heads]
+      (let [head-name (:name head) head-location (:location head)]
+        ^{:key head-name} [:li [:a {:href head-location} head-name]]))])
+
+(defn main
+  [{:keys [heads tentacles]}]
+  (fn []
+    [:main
+     [:section.module
+      [:div.sub-header
+       [:h2 "Heads"]
+       [:div.sub-header-actions
+        [:a.btn.medium.primary {:href "/add-head"} "Add a head"]]]
+      [head-items heads]]
+     [:section.module
+      [:div.sub-header
+       [:h2 "Tentacles"]
+       [:div.sub-header-actions
+        [:a.btn.medium.primary {:href "/add-tentacle"} "Add a tentacle"]]]
+      [tentacle-items tentacles]]]))


Add try-start-repl function

Add try-start-repl function

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

--- src/clojure/neko/repl.clj
+++ src/clojure/neko/repl.clj
@@ -0,0 +1,36 @@
+; Copyright © 2012 Alexander Yakushev.
+; All rights reserved.
+;
+; This program and the accompanying materials are made available under the
+; terms of the Eclipse Public License v1.0 which accompanies this distribution,
+; and is available at <http://www.eclipse.org/legal/epl-v10.html>.
+;
+; By using this software in any fashion, you are agreeing to be bound by the
+; terms of this license.  You must not remove this notice, or any other, from
+; this software.
+
+(ns neko.repl
+  "Utilities to start the REPL on the remote device."
+  {:author "Alexander Yakushev"}
+  (:import java.io.FileNotFoundException)
+  (:require [neko.compilation :as neko]))
+
+;; A symbol that matches the nREPL namespace with `start-server`
+;; function.
+(def ^{:private true} nrepl-ns-symbol 'clojure.tools.nrepl.server)
+
+(defn try-start-repl
+  "Initializes neko's compilation facilities and tries to launch the
+  remote nREPL server. If the nrepl namespace is not present in the
+  runtime (probably because the current build is the release one) does
+  nothing."
+  [context & repl-args]
+  (try
+    (let [user-ns (create-ns 'user)]
+      (binding [*ns* user-ns]
+        (refer-clojure)
+        (use nrepl-ns-symbol)
+        (let [start-server-fn (resolve 'start-server)]
+          (neko/init context "classes")
+          (apply start-server-fn repl-args))))
+    (catch FileNotFoundException e nil)))


Removed rabbit

Removed rabbit

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/'


for map

for map

mapper-gen4 generates map that is used in page.clj for displaying results, not sure if that one is correct either

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

--- src/adder/reorder.clj
+++ src/adder/reorder.clj
@@ -0,0 +1,14 @@
+(ns adder.reorder)
+
+(defstruct flick :name :image)
+
+(defn mapper-gen2
+  [names images] (sort-by :name (map #(hash-map :name %1 :image %2 ) names images)))
+
+(defn mapper-gen3
+  [names images read-link] (sort-by :name (map #(hash-map :name %1 :image %2 :read-link %3)
+                                                                   names images read-link )))
+
+
+(defn mapper-gen4
+  [names images read-link download-link] (sort-by :names (map #(:name %1 :image %2 :read-link %3 :download-link %4) names images read-link download-link)))


www/content_pages.clj: copied from v4 pages/static.clj

error: pathspec 'src/org/altlaw/www/content_pages.clj' did not match any file(s) known to git

--- src/org/altlaw/www/content_pages.clj
+++ src/org/altlaw/www/content_pages.clj
@@ -0,0 +1,40 @@
+(ns org.altlaw.www.content-pages
+  (:gen-class)
+  (:require [org.altlaw.util.files :as files]
+            [org.altlaw.util.context :as context])
+  (:use org.altlaw.www.render
+        org.altlaw.util.markdown
+        [clojure.contrib.duck-streams :only (file slurp* spit)]
+        [clojure.contrib.test-is :only (with-test is)])
+  (import (java.io File)
+          (org.apache.commons.lang StringEscapeUtils)))
+
+(with-test
+ (defn html-output-file [source-file]
+   (let [relpath (files/relative-path (context/www-content-dir) source-file)]
+     (file (context/www-public-dir) "/" (.replace relpath ".md" ".html"))))
+ (is (= (file (context/www-public-dir) "/foo/index.html")
+        (html-output-file (file (context/www-content-dir) "/foo/index.md")))))
+
+(defn gen-markdown-page [markdown-text]
+  (let [[contenthead contentbody] (seq (.split markdown-text "---\n" 2))]
+    (render :xhtml_page
+            :html_title "AltLaw, the free legal search engine"
+            :html_head (render :default_html_head)
+            :html_body (render :default_layout
+                               :page_class "doctype_about"
+                               :content_head (markdown contenthead)
+                               :content_body (markdown contentbody)
+                               :sidebar (render :sidebar_about_pages)))))
+
+(defn save-static-page [source-file]
+  (let [target-file (html-output-file source-file)]
+   (.mkdirs (.getParentFile target-file))
+   (spit target-file (gen-markdown-page (slurp* source-file)))))
+
+(defn save-static-pages []
+  (dorun (map save-static-page
+              (filter #(.isFile %) (file-seq (context/www-content-dir))))))
+
+(defn -main [& args]
+  (save-static-pages))


package

package

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/clojure-ml/cml.git/'


Lein workflow thanks to @noidi Pimp My Workflow on /dev/solita

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/scott-abernethy/dot-files.git/'


add `cljs.analyzer.api` namespace

add `cljs.analyzer.api` namespace

error: pathspec 'src/clj/cljs/analyzer/api.clj' did not match any file(s) known to git

--- src/clj/cljs/analyzer/api.clj
+++ src/clj/cljs/analyzer/api.clj
@@ -0,0 +1,21 @@
+;   Copyright (c) Rich Hickey. All rights reserved.
+;   The use and distribution terms for this software are covered by the
+;   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+;   which can be found in the file epl-v10.html at the root of this distribution.
+;   By using this software in any fashion, you are agreeing to be bound by
+;   the terms of this license.
+;   You must not remove this notice, or any other, from this software.
+
+(ns cljs.analyzer.api
+  (:refer-clojure :exclude [all-ns ns-interns ns-resolve])
+  (:require [cljs.env :as env]
+            [cljs.analyzer :as ana]))
+
+(defn all-ns []
+  (keys (get @env/*compiler* ::ana/namespaces)))
+
+(defn ns-interns [ns]
+  (get-in @env/*compiler* [::ana/namespaces ns :defs]))
+
+(defn ns-resolve [ns sym]
+  (get-in @env/*compiler* [::ana/namespaces ns :defs sym]))