helpers to download and base64 fonts

helpers to download and base64 fonts

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

--- src-cljs/frontend/fonts.cljs
+++ src-cljs/frontend/fonts.cljs
@@ -0,0 +1,39 @@
+(ns frontend.fonts
+  (:require [cljs-http.client :as http]
+            [cljs.core.async :as async]
+            [cljs.core.async.impl.buffers :as buffers]
+            [goog.crypt]
+            [goog.crypt.base64 :as base64]
+            [frontend.utils :as utils])
+  (:require-macros [cljs.core.async.macros :refer (go)]))
+
+(defonce font-promise-chs (let [roboto-buffer (buffers/promise-buffer)
+                                fa-buffer (buffers/promise-buffer)]
+                            ;; need the buffer so that we can count
+                            {"Roboto" {:buffer roboto-buffer
+                                      :ch (async/chan roboto-buffer nil nil)}
+                             "FontAwesome" {:buffer fa-buffer
+                                           :ch (async/chan fa-buffer nil nil)}}))
+
+(defn font-ch [font-name]
+  (get-in font-promise-chs [font-name :ch]))
+
+(def font-paths {"Roboto" (utils/cdn-path "/webfonts/roboto-v15-latin-regular.ttf")
+                 "FontAwesome" (utils/cdn-path "/webfonts/fontawesome-webfont.ttf")})
+
+;; Note that this could try to fetch the same font multiple times, but
+;; will always return as soon as the first fetch finishes.
+(defn fetch-font
+  "Fetches the font and puts it in the font-promise-chan base64-encoded."
+  [font-name]
+  (let [{:keys [buffer ch]} (get font-promise-chs font-name)
+        font-path (get font-paths font-name)]
+    (when (zero? (count buffer))
+      (go
+        (let [font-str (-> (http/get (str font-path "?xhr=true") ;; cache buster for cors
+                                     {:response-type :array-buffer})
+                         (async/<!)
+                         (:body)
+                         (js/Uint8Array.)
+                         (base64/encodeByteArray))]
+          (async/>! ch {:font-name font-name :font-str font-str}))))))


Normalized appropriate string parameters into vectors

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


Started on tests for conv-man

Started on tests for conv-man

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

--- test/conv_man_tests.clj
+++ test/conv_man_tests.clj
@@ -0,0 +1,14 @@
+(ns conv-man-tests
+  (:use polismath.utils
+        test-helpers)
+  (:require [clojure.test :refer :all]
+            [polismath.conv-man :refer :all]))
+
+; Initialization test
+(deftest split-batches-test
+  (testing "of a missing param"
+    (let [messages [[:votes [{:a 4} {:b 5} {:c 6}]]
+                    [:votes [{:d 7} {:e 8} {:f 9}]]]]
+      (is (= (split-batches messages)
+             {:votes [{:a 4} {:b 5} {:c 6} {:d 7} {:e 8} {:f 9}]})))))
+


Basic blinking modes.

Basic blinking modes.

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


Allow conneg to succeed on GET

Allow conneg to succeed on GET

OAuth2 initiation

--- src/yada/oauth.clj
+++ src/yada/oauth.clj
@@ -62,9 +62,11 @@
      (merge
       (when-let [id (:id opts)] {:id id})
       {:methods
-       {:get {:parameters {:query {(s/optional-key :target-uri) s/Str}}
+       {:get {:produces "text/plain" ; it's a redirect, but we need to allow content neg to succeed
+              :parameters {:query {(s/optional-key :target-uri) s/Str}}
               :response (fn [ctx] (initiate ctx opts (-> ctx :parameters :query :target-uri)))}
-        :post {:parameters {:form {(s/optional-key :target-uri) s/Str}}
+        :post {:consumes "application/x-www-form-urlencoded"
+               :parameters {:form {(s/optional-key :target-uri) s/Str}}
                :response (fn [ctx] (initiate ctx opts (-> ctx :parameters :form :target-uri)))}}}))))

 (s/defn oauth2-callback-resource-github


Fixing tests for subscription

Fixing tests for subscription

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


[DG] STOP IMPORTING YOURSELF!!!

[DG] STOP IMPORTING YOURSELF!!!

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


[WM] fix tests & add negative reg-methods 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/voter-registration-works.git/'


Updated entree gene type rule to work with ccp ext ontology

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

--- resources/rules/post_identifier_merge/entity/type/entrez_gene_type.clj
+++ resources/rules/post_identifier_merge/entity/type/entrez_gene_type.clj
@@ -0,0 +1,27 @@
+;; ------------------------------------
+;; --------- Entrez Gene Type ---------
+;; ------------------------------------
+`{:name "entrez-gene-type"
+  :description "This rule identifies entrez gene type"
+  :head ((?/dna rdfs/subClassOf obo/SO_0000704) ; SO:gene
+         (?/dna rdf/type kbio/GeneSpecificGClass))
+
+  :body ((?/record rdf/type ccp/IAO_EXT_0000681) ; ccp:NCBI_gene_info_record
+         (?/record obo/BFO_0000051 ?/dna_field_value) ; BFO:has_part
+         (?/dna_field_value rdf/type ccp/IAO_EXT_0000876) ; ccp:NCBI_gene_info_record__gene_identifier_field_value
+         (?/dna_field_value rdf/type ?/dna_ice_id)
+         (?/dna_ice_id obo/IAO_0000219 ?/dna) ; 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 "pseudo")
+         (!= ?/type "unknown")
+         (!= ?/type "other"))
+  }
+
+
+


Greatest Common Divisor done

Greatest Common Divisor done

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

--- src/4clojure/gcd.clj
+++ src/4clojure/gcd.clj
@@ -0,0 +1,50 @@
+;; Greatest Common Divisor
+;; http://www.4clojure.com/problem/66
+
+
+;; Difficulty:	Easy
+;; Topics:
+
+
+;; Given two integers, write a function which returns the greatest common divisor.
+;; test not run
+
+;; https://en.wikipedia.org/wiki/Euclidean_algorithm
+(defn __ [a b]
+  (if (zero? b)
+    a
+    (__ b (mod a b))))
+
+
+(= (__ 2 4) 2)
+
+(= (__ 10 5) 5)
+
+(= (__ 5 7) 1)
+
+(= (__ 1023 858) 33)
+
+
+;; 4Clojure copy paste
+(fn __ [a b]
+  (if (zero? b)
+    a
+    (__ b (mod a b))))
+
+
+;; _artem_uv's solution:
+;; (fn [x y] (if (zero? y) x (recur y (rem x y))))
+;; -> could use recur with anonymous function
+
+;; _pcl's solution:
+;; (fn [x y] (apply max (filter #(= 0 (mod x %) (mod y %)) (range 1 (+ 1 (max (/ x 2) (/ y 2)))))))
+
+;; aceeca1's solution:
+;; (comp (partial apply +) first (partial drop-while (comp (partial < 0) (partial apply min))) #(iterate (fn [[x1 x2]] (vector (mod x1 x2) (mod x2 x1))) [%1 %2]))
+
+;; adereth's solution:
+;; (fn [v1 v2]
+;;   (apply max
+;;          (filter #(and (zero? (mod v1 %))
+;;                        (zero? (mod v2 %)))
+;;                  (range 1 (max v1 v2)))))


Avoid parsing the JSON in this module.

Avoid parsing the JSON in this module.

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


squash! Rework the way field flattening happens in annotate :yum:

--- src/metabase/driver/query_processor/annotate.clj
+++ src/metabase/driver/query_processor/annotate.clj
@@ -44,7 +44,7 @@
   (assoc field :field-name (keyword (apply str (->> (rest (i/qualified-name-components field))
                                                     (interpose "."))))))

-(defn- collect-fields
+(defn collect-fields
   "Return a sequence of all the `Fields` inside THIS, recursing as needed for collections.
    For maps, add or `conj` to property `:path`, recording the keypath used to reach each `Field.`

@@ -53,16 +53,14 @@
      (collect-fields {:a {:name \"id\", ...}) -> [{:name \"id\", :path [:a], ...}]"
   [this]
   (condp instance? this
-    clojure.lang.IPersistentMap
-    (for [[k v] (seq this)
-          field (collect-fields v)]
-      (update field :path conj k))
-
-    clojure.lang.Sequential
-    (mapcat collect-fields this)
+    ;; For a DateTimeField we'll flatten it back into regular Field but include the :unit info for the frontend.
+    ;; Recurse so it is otherwise handled normally
+    metabase.driver.query_processor.interface.DateTimeField
+    (let [{:keys [field unit]} this]
+      (recur (assoc field :unit unit)))

     metabase.driver.query_processor.interface.Field
-    (if-let [{:keys [parent]} this]
+    (if-let [parent (:parent this)]
       ;; Nested Mongo fields come back inside of their parent when you specify them in the fields clause
       ;; e.g. (Q fields venue...name) will return rows like {:venue {:name "Kyle's Low-Carb Grill"}}
       ;; Until we fix this the right way we'll just include the parent Field in the :query-fields list so the pattern
@@ -70,15 +68,21 @@
       [this parent]
       [this])

-    ;; For a DateTimeField we'll flatten it back into regular Field but include the :unit info for the frontend
-    metabase.driver.query_processor.interface.DateTimeField
-    (recur (assoc (:field this) :unit (:unit this)))
+    clojure.lang.IPersistentMap
+    (for [[k v] (seq this)
+          field (collect-fields v)
+          :when field]
+      (update field :path conj k))
+
+    clojure.lang.Sequential
+    (mapcat collect-fields this)

     nil))

 (defn- flatten-fields
   "Flatten a group of fields, keeping those which are more important when duplicates exist."
   [fields]
+  {:pre [(every? identity fields)]}
   (let [path-importance (fn [{[k] :path}]
                           (cond
                             (= k :breakout) 0     ; lower number = higher importance, because `sort` is ascending


Layout

Layout

--- 2-collectors/clojure-collector/src/snowplow/clojure_collector/responses.clj
+++ 2-collectors/clojure-collector/src/snowplow/clojure_collector/responses.clj
@@ -43,7 +43,7 @@
   [id duration domain]
   (merge
     {:value    id
-     :expires  (now-plus duration)}
+     :expires (now-plus duration)}
    (when-let [d nil]
     {:domain   d}))


Make use of alias

Make use of alias

--- Clojure/src/ambly/repl/jsc.clj
+++ Clojure/src/ambly/repl/jsc.clj
@@ -187,7 +187,7 @@
   repl/IParseStacktrace
   (-parse-stacktrace [this stacktrace error opts]
     (raw-stacktrace->canonical-stacktrace stacktrace opts))
-  cljs.repl/IPrintStacktrace
+  repl/IPrintStacktrace
   (-print-stacktrace [repl-env stacktrace error build-options]
     (doseq [{:keys [function file url line column]}
             (cljs.repl/mapped-stacktrace stacktrace build-options)]


Added lein/profiles inspired by Timo Mihaljov

* vinyasa injecting pprint, doc etc., debug-repl,
  clj-ns-browser, difform
* spyscope
* lein-try, -ancient

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

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -0,0 +1,23 @@
+;; Inspired heavily by http://dev.solita.fi/2014/03/18/pimp-my-repl.html
+{:user {:dependencies [
+                       [org.clojars.gjahad/debug-repl "0.3.3"]
+                       [im.chit/vinyasa "0.1.8"]
+                       [spyscope "0.1.4"] ;; reader macro to print forms before execution: #spy/p, d
+                       [difform "1.1.2"] ;; diff of clj data structures
+                       [clj-ns-browser "1.3.1"]
+                       ]
+        ;; "Copy" the given function to clojure.core (and thus all namespaces), prefixed with > => (>doc ..)
+        :injections [(require 'vinyasa.inject) ;; TODO check also vinyasa/pull, lein, reimport
+                     (require 'alex-and-georges.debug-repl)
+                     (require 'com.georgejahad.difform)
+                     (require 'clj-ns-browser.sdoc)
+                     (vinyasa.inject/inject 'clojure.core '>
+                       '[[clojure.repl doc source]
+                         [clojure.pprint pprint pp]
+                         [alex-and-georges.debug-repl debug-repl]
+                         [com.georgejahad.difform difform]
+                         [clj-ns-browser.sdoc sdoc]])
+                     (require 'spyscope.core)]
+        :plugins [
+                  [lein-ancient "0.5.4"]
+                  [lein-try "0.4.1"]]}}


Use safe form-to

Use safe form-to

--- src/clojars/web/jar.clj
+++ src/clojars/web/jar.clj
@@ -4,7 +4,8 @@
                                         simple-date]]
             [hiccup.core :refer [h]]
             [hiccup.element :refer [link-to]]
-            [hiccup.form :refer [form-to submit-button]]
+            [hiccup.form :refer [submit-button]]
+            [clojars.web.safe-hiccup :refer [form-to]]
             [clojars.maven :refer [jar-to-pom-map commit-url]]
             [clojars.auth :refer [authorized?]]
             [clojars.db :refer [find-jar jar-exists]]


add a preliminary layer model

add a preliminary layer model

error: pathspec 'src/pc/models/layer.clj' did not match any file(s) known to git

--- src/pc/models/layer.clj
+++ src/pc/models/layer.clj
@@ -0,0 +1,23 @@
+(ns pc.models.layer
+  (:require [pc.datomic :as pcd]
+            [datomic.api :refer [db q] :as d]))
+
+
+;; We'll pretend we have a type here
+#_(t/def-alias Layer (HMap :mandatory {:document/id Long
+                                       :db/id Long
+                                       :layer/name String}
+                           :optional {:layer/type Keyword
+                                      :layer/child Long}))
+
+;; This will work as long as other things don't get a document id
+(defn all [db]
+  (pcd/touch-all '{:find [?t]
+                   :where [[?t :document/id]
+                           [?t :layer/name]]}
+                 db))
+
+(defn find-by-document [db document]
+  (pcd/touch-all '{:find [?t] :in [$ ?document-id]
+                   :where [[?t :document/id ?document-id]]}
+                 db (:db/id document)))


scale

scale

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


first wide-domain: symbol

first wide-domain: symbol

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

--- test/such/f_wide_domains.clj
+++ test/such/f_wide_domains.clj
@@ -0,0 +1,13 @@
+(ns such.f-wide-domains
+  (:require [such.wide-domains :as subject])
+  (:use midje.sweet))
+
+(fact symbol
+  (subject/symbol "th") => 'th
+  (subject/symbol #'clojure.core/even?) => 'even?
+  (subject/symbol *ns* "th2") => 'such.f-wide-domains/th2
+  (subject/symbol 'such.f-wide-domains "th3") => 'such.f-wide-domains/th3
+  (subject/symbol "such.f-wide-domains" "th4") => 'such.f-wide-domains/th4
+  (subject/symbol "no.such.namespace" "th5") => 'no.such.namespace/th5
+  (subject/symbol *ns* 'th6) => 'such.f-wide-domains/th6
+  (subject/symbol *ns* :th7) => 'such.f-wide-domains/th7)


Add function to receive sequence numbers.

--- src/pepa/model.clj
+++ src/pepa/model.clj
@@ -327,3 +327,16 @@
        (map #(hash-map :name (:filename %)
                        :data (slurp-bytes @(:content %))
                        :content-type "application/pdf"))))
+
+;;; Sequence Number Stuff
+
+(def ^:private sequenced-tables
+  [:pages :page_images :files :documents :document_tags :document_pages])
+
+(let [names (map name sequenced-tables)
+      where (s/join ", " (map #(str % "_state_seq as " %) names))
+      select (s/join ", " (map #(str % ".current as " %) names))
+      query (str "SELECT " select " FROM " where)]
+  (defn sequence-numbers [db]
+    (db/query db [query]
+              :identifiers (comp keyword #(s/replace % "_" "-")))))


Split reserved stats into buckets

Split reserved stats into buckets

... by how long ago messages were reserved

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


You can clear the entire collection

You can clear the entire collection

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/ben-biddington/solace.git/'


trying a different parameter

trying a different parameter

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


Clojure: only load readline history once.

--- clojure/src/readline.clj
+++ clojure/src/readline.clj
@@ -27,7 +27,8 @@
   (def load-history (jna/to-fn Integer readline/read_history)))

 (defn readline [prompt & [lib]]
-  (if (not @history-loaded)
+  (when (not @history-loaded)
+    (reset! history-loaded true)
     (load-history HISTORY-FILE))
   (let [line (readline-call prompt)]
     (when line


Rename circles to anchor-circle.

Rename circles to anchor-circle.

--- src/clj/freefrog/rest.clj
+++ src/clj/freefrog/rest.clj
@@ -33,7 +33,7 @@
         [ring.util.codec :only [url-encode url-decode]])
   (:import java.net.URL))

-(defonce circles (ref {}))
+(defonce anchor-circle (ref {}))

 ;;;; http://clojure-liberator.github.io/liberator/tutorial/all-together.html
 ;; convert the body to a reader. Useful for testing in the repl
@@ -88,7 +88,7 @@
   (let [uri (get-in context [:request :uri])
         uri-list (split uri #"/")
         circle-name (url-decode (first (take-last index uri-list)))
-        circle (get @circles circle-name)]
+        circle (get @anchor-circle circle-name)]
     (if circle
       [true {::circle-name circle-name ::circle circle}]
       [false {:message (format "Circle '%s' does not exist." circle-name)}])))
@@ -97,9 +97,9 @@
   (let [{:keys [name lead-link-name lead-link-email]} (::json-data context)]
     (try
       (dosync
-        (alter circles assoc name
+        (alter anchor-circle assoc name
                (g/anchor-circle name lead-link-name lead-link-email)))
-      {::circle-data (get @circles name) ::url-encoded-id (url-encode name)}
+      {::circle-data (get @anchor-circle name) ::url-encoded-id (url-encode name)}
       (catch IllegalArgumentException e
         ;(.printStackTrace e)
         {::create-failed (format "IllegalArgumentException: %s" (.getMessage e))}))))
@@ -108,10 +108,10 @@
   (let [{:keys [name purpose domains accountabilities]} (get context ::json-data)
         circle-name (::circle-name context)]
     (try
-      (dosync (alter circles assoc circle-name
+      (dosync (alter anchor-circle assoc circle-name
                      (g/add-role (::circle context)
                                  name purpose domains accountabilities)))
-      {::role-data (:roles (get @circles circle-name))
+      {::role-data (:roles (get @anchor-circle circle-name))
        ::url-encoded-role-id (url-encode name)}
       (catch IllegalArgumentException e
         ;(.printStackTrace e)
@@ -128,7 +128,7 @@
       ret-val)))

 (defresource anchor-circle-resource
-  :handle-ok (fn[_] (json/generate-string @circles))
+  :handle-ok (fn[_] (json/generate-string @anchor-circle))
   :allowed-methods [:get])

 (defresource implicit-circle-resource
@@ -144,7 +144,7 @@
   :allowed-methods [:get]
   :known-content-type? #(check-content-type % ["application/json"])
   :exists? (fn [_]
-             (let [e (get @circles (url-decode id))]
+             (let [e (get @anchor-circle (url-decode id))]
                (if-not (nil? e)
                  {::circle e})))
   :available-media-types ["application/json"]
@@ -159,7 +159,7 @@
   :post! #(create-circle %)
   :new? true
   :handle-ok #(map (fn [id] (str (build-entry-url (get % :request) id)))
-                   (keys @circles))
+                   (keys @anchor-circle))
   :handle-created #(when (::create-failed %)
                      (ring-response {:status 400
                                      :body (::create-failed %)}))
@@ -212,4 +212,4 @@

 (defn reset-database []
   (dosync
-    (ref-set circles {})))
+    (ref-set anchor-circle {})))


[EN] Make it test.

[EN] Make it 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/election-authority-works.git/'


Bugfix: Remove hard-coded artifact github link

--- src/clojars/web/jar.clj
+++ src/clojars/web/jar.clj
@@ -70,8 +70,7 @@
                 [:ul#jar-info-bar
                  [:li
                   (let [pom-map (jar-to-pom-map jar)]
-                    (if-let [gh-info ;; (github-info pom-map)
-                             "ztellman/aleph"]
+                    (if-let [gh-info (github-info pom-map)]
                       (link-to {:target "_blank"}
                                (format "https://github.com/%s" gh-info)
                                (image "/images/GitHub-Mark-16px.png" "GitHub")


Removed unused require.

Removed unused require.

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


Deleted redundant code

Deleted redundant code

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

--- src/model/algorithm.clj
+++ src/model/algorithm.clj
@@ -0,0 +1,73 @@
+(ns model.algorithm
+  (:refer-clojure :exclude [get])
+  (:require [clojure.java.jdbc :as j]
+            [clojure.java.jdbc.sql :as s]
+            [clojure.string :as cs]
+            [model.data :as data]))
+
+(def db-spec {:classname "org.h2.Driver"
+              :subprotocol "h2:file"
+              :subname "db/my-webapp"})
+
+(defn intersect
+  [s1 s2]
+  "Returns a colecton of elements that exist in both of the parameters."
+  (let [f1 (frequencies s1)
+        f2 (frequencies s2)
+        d1 (apply dissoc f1 (keys f2))
+        d2 (apply dissoc f2 (keys f1))
+        f1 (apply dissoc f1 (keys d1))
+        f2 (apply dissoc f2 (keys d2))]
+    (mapcat
+      (fn [[k v]]
+        (repeat v k))
+      (merge-with min f1 f2))))
+
+
+(defn letter-pairs
+  [joined]
+  "Makes a colection of letter pairs in a text."
+  (mapv clojure.string/join
+    (butlast (partition-all 2 1
+               (subvec (clojure.string/split joined #"")1)))))
+
+(defn join-selected-text
+  [words]
+  "Takes the text and joins the words and returns the letter pairs."
+  (letter-pairs (clojure.string/replace (clojure.string/trim words) #"\s" "")))
+
+(defn get-selected-text
+  [id]
+  "Gets the text of the selected news from the database."
+  (join-selected-text (:text (nth (j/query db-spec
+                                ["select * from news where id=?" id]
+                                  :row-fn data/replace-clob) 0))))
+
+(defn numerator
+  [row id]
+  "The numerator for the Sorensen-Dice index."
+  (* 2.0 (count (intersect (letter-pairs
+                             (clojure.string/replace
+                               (clojure.string/trim (:text (data/replace-clob row))) #"\s" ""))
+                (get-selected-text id)))))
+
+(defn denominator
+  [row id]
+  "The dominator for the Sorensen-Dice index."
+  (+ (count (letter-pairs
+              (clojure.string/replace (clojure.string/trim
+                                        (:text (data/replace-clob row))) #"\s" "")))
+            (count (get-selected-text id))))
+
+(defn text-difference
+ [row id]
+ "Fills the list with values."
+ (assoc row :difference (/ (numerator row id) (denominator row id))))
+
+(defn get-similar-texts
+  [id]
+  "Returns three most similar news to the one selected."
+  (take 3 (rest (reverse
+                  (sort-by :difference (j/query db-spec
+                    ["select * from news"]
+                      :row-fn #(text-difference % id)))))))


some-fn

some-fn

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


Problem 0049.

Problem 0049.

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

--- src/project_euler/problem_0049.clj
+++ src/project_euler/problem_0049.clj
@@ -0,0 +1,63 @@
+(ns project-euler.problem_0049
+  (:require [clojure.math.combinatorics :as combo]))
+
+;; The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330,
+;; is unusual in two ways:
+;; (i) each of the three terms are prime, and,
+;; (ii) each of the 4-digit numbers are permutations of one another.
+
+;; There are no arithmetic sequences made up of three 1-, 2-, or 3-digit primes, exhibiting this property,
+;; but there is one other 4-digit increasing sequence.
+
+;; What 12-digit number do you form by concatenating the three terms in this sequence?
+
+;;-------------------------------------------------------------------------------------------------------
+;; from problem_0030:
+
+(defn digits
+  [n]
+  (loop [n n, ds []]
+    (let [r (rem n 10)
+          q (quot n 10)
+          new-ds (conj ds r)]
+      (if (== q 0)
+        new-ds
+        (recur q new-ds)
+        ))))
+
+;;-------------------------------------------------------------------------------------------------------
+;; from problem_0007:
+
+(defn prime?
+  [n]
+  {:pre [(integer? n) (> n 0)]}
+  (or (== 2 n)
+      (let [mmax (+ (Math/sqrt n) 1)]
+        (not (some #(== 0 (rem n %)) (concat [2] (range 3 mmax 2))))
+        )))
+
+;;-------------------------------------------------------------------------------------------------------
+
+(def four-digits-primes (filter prime? (range 1001 10000 2)))
+
+(defn from-digits [digits] (reduce #(+ %2 (* 10 %1)) 0 digits))
+
+(defn solution []
+  (->> four-digits-primes
+       (group-by (comp from-digits sort digits))
+       (vals)
+       (filter #(>= (count %) 3))
+       (mapcat (fn [xs] (->> (combo/combinations xs 2)
+                          (group-by (fn [[x y]] (- y x)))
+                          (vals)
+                          (filter #(>= (count %) 2))
+                          )))
+       (map #(apply concat %))
+       (remove #(== (count %) (count (distinct %))))
+       (remove #(some #{1487} %))
+       (first)
+       (distinct)
+       (apply str)
+       ))
+
+;; 296962999629


introducing common

introducing common

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

--- src/openstack/common.clj
+++ src/openstack/common.clj
@@ -0,0 +1,24 @@
+(ns openstack.common
+  "common openstack api access"
+  (:require
+    [celestial.model :refer (hypervisor)]
+    )
+  (:import
+    org.openstack4j.openstack.OSFactory
+    )
+  )
+
+(defn openstack [tenant]
+  (let [{:keys [username password endpoint]} (hypervisor :openstack)]
+    (-> (OSFactory/builder)
+        (.endpoint endpoint)
+        (.credentials username password)
+        (.tenantName tenant)
+        (.authenticate))))
+
+(defn compute [tenant]
+  (let [{:keys [username password endpoint]} (hypervisor :openstack)]
+    (.compute (openstack tenant))))
+
+(defn servers [tenant] (-> (compute tenant) (.servers)))
+


reversing sort order of the months so most recent one is first

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


Parametro gutxiago

Parametro gutxiago

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


Iruzkinen data erakutsi

Iruzkinen data erakutsi


explicitly use the en-email-date-formatter

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


uniquify should preserve metadata (vary-meta approach saves a wrapper-call too)

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


Adding git pooling on pipeline

Adding git pooling on pipeline

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/iot-paas-home/telegram-iot-gateway.git/'


Move result types/protocols to lazytest.results

error: pathspec 'src/main/clojure/com/stuartsierra/lazytest/results.clj' did not match any file(s) known to git

--- src/main/clojure/com/stuartsierra/lazytest/results.clj
+++ src/main/clojure/com/stuartsierra/lazytest/results.clj
@@ -0,0 +1,35 @@
+(ns com.stuartsierra.lazytest.results)
+
+(defprotocol TestResult
+  (success? [r] "True if this result and all its children passed.")
+  (pending? [r] "True if this is the result of an empty test.")
+  (error? [r] "True if this is the result of a thrown exception.")
+  (container? [r] "True if this is a container for other results."))
+
+(defrecord TestResultContainer [source children]
+  TestResult
+    (success? [this] (every? success? children))
+    (pending? [this] (if (seq children) false true))
+    (error? [this] false)
+    (container? [this] true))
+
+(defrecord TestPassed [source states]
+  TestResult
+    (success? [this] true)
+    (pending? [this] false)
+    (error? [this] false)
+    (container? [this] false))
+
+(defrecord TestFailed [source states]
+  TestResult
+    (success? [this] false)
+    (pending? [this] false)
+    (error? [this] false)
+    (container? [this] false))
+
+(defrecord TestThrown [source states throwable]
+  TestResult
+    (success? [this] false)
+    (pending? [this] false)
+    (error? [this] true)
+    (container? [this] false))


Environment management for the desugar phase

That's a tough set of functions.
Main difficulty is how global and nonlocal declaration interfere
with possible macroexpansion.

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

--- src/pyjure/environment.clj
+++ src/pyjure/environment.clj
@@ -0,0 +1,244 @@
+(ns pyjure.environment
+  (:require [clojure.core :as c]
+            [clojure.string :as str]
+            [clojure.set :as set]
+            [clojure.math.numeric-tower :as math])
+  (:use [clojure.core.match :only [match]]
+        [pyjure.debug]
+        [pyjure.utilities]
+        [pyjure.names]
+        [pyjure.mop]))
+
+
+;;; Runtime and Compile-time environments
+
+;; a scope at runtime
+(defrecord RuntimeScope
+    [^clojure.lang.PersistentVector values
+     parent ;; a parent RuntimeScope, or nil if top-level
+     ^clojure.lang.PersistentVector names]) ;; nil if no introspection
+
+(defrecord CompileTimeEnvironment
+    [lexical-scope ;; nil if at top-level
+     toplevel-scope])
+
+;;; a scope at compile-time is just a map from string to CompileTimeBinding, and a parent
+(defrecord CompileTimeScope
+    [bindings ;; a map from name to binding
+     parent]) ;; nil if top-level
+
+(defn scope-toplevel? [scope]
+  ;; works for both RuntimeScope and CompileTimeScope
+  (nil? (:parent scope)))
+
+;; flags for a CompileTimeBinding
+(declare +ctb-bits+)
+
+(defn expand-ctb-mask [spec bits]
+  (match [spec]
+    [_ :guard keyword?] (or (get bits spec) ($syntax-error spec "ctb bit ~s not found" [:spec spec]))
+    [(['or & ms] :seq)] (apply bit-or (map #(expand-ctb-mask % bits) ms))
+    [(['and & ms] :seq)] (apply bit-and (map #(expand-ctb-mask % bits) ms))
+    [(['not m] :seq)] (bit-not (expand-ctb-mask m bits))))
+
+(defmacro ctb-mask
+  ([spec] (expand-ctb-mask spec +ctb-bits+))
+  ([flags spec] `(bit-and ~flags (ctb-mask ~spec))))
+
+(defmacro def-ctb-bits [specs]
+  (loop [shift 0 mask 1 specs specs bits {} rev {}]
+    (match [specs]
+      [_ :guard empty?] `(do (def +ctb-bits+ '~bits) (def +ctb-bit-name+ '~rev))
+      [[[name combo] & more]]
+      (let [flags (expand-ctb-mask combo bits)]
+        (recur shift mask more (conj bits [name flags]) (conj rev [flags name])))
+      [[name & more]]
+      (if (>= shift 31) (throw (Exception. "Only 31 bits allowed in a defbits"))
+          (recur (inc shift) (* 2 mask) more (conj bits [name mask]) (conj rev [mask name]))))))
+
+(def-ctb-bits
+  [:constant  ; is it a compile-time constant? (NB: it's always immutable at runtime)
+   :typed  ; was the type specified?
+   :dynamic  ; is it a dynamic variable? (like a Clojure var, a CL special variable)
+   :global  ; was it declared global?
+   :nonlocal  ; was it declared nonlocal?
+   :class  ; is is known to be class-scoped? (TODO: handle class bindings)
+   :parameter  ; it is a parameter?
+   :def  ; it is a def target?
+   :call-macro ;; bound as a call-macro
+   :decorator-macro ;; bound as a decorator-macro
+   :with-macro ;; bound as a with-macro
+   :place-macro ;; bound as a place-macro
+   :target  ; bound as target to some "assignment" var = value
+   :bound-before-use  ; was it bound before it's used?
+   :referenced ; was the variable referenced in the current scope?
+   :call-referenced ; used as function
+   :decorator-referenced ;; used as decorator
+   :with-referenced ;; used as a with annotation
+   :expanded ;; was previously resolved as a macro
+   :found ;; for updated-mask only, found in the current scope
+   [:annotated (or :typed :dynamic :constant)]
+   [:forwarded (or :global :nonlocal)]
+   [:defined (or :parameter :def :class)] ;; defined as a regular variable *in this scope*
+   [:used (or :referenced :call-referenced :decorator-referenced :with-referenced :expanded)] ;; used in any way
+   [:macro (or :call-macro :decorator-macro :with-macro :place-macro)]]) ;; bound as any kind of macro in this scope
+
+(defmacro mask? [flags mask] `(pos? (bit-and ~flags ~mask)))
+(defmacro ctb-mask? [flags mask] `(mask? ~flags (ctb-mask ~mask)))
+(defmacro ctb-flags? [binding mask] `(ctb-mask? (:flags ~binding) ~mask))
+
+(defmacro ctb-flags-assoc
+  ([binding flags] `(update-in binding [:flags] #(bit-or % (ctb-mask ~flags))))
+  ([binding mask flags] `(update-in binding [:flags] #(bit-or (bit-and % (bit-not mask)) (ctb-mask ~flags)))))
+
+(defmacro ctb-bit-name
+  ([bit] `(-ctb-bit-name ~bit))
+  ([flags mask] `(ctb-bit-name (bit-and ~flags (ctb-mask ~mask)))))
+
+(defmacro ctb-bit-names
+  ([bit] `(-ctb-bit-names ~bit))
+  ([flags mask] `(ctb-bit-names (bit-and ~flags (ctb-mask ~mask)))))
+
+(defn first-bit [n]
+  (if (zero? n) nil (loop [m 1] (if (pos? (bit-and m n)) m (recur (+ m m))))))
+
+(defn -ctb-bit-name [bit]
+  (or (get +ctb-bit-name+ bit) (get +ctb-bit-name+ (first-bit bit))))
+
+(defn -ctb-bit-names [n]
+  (loop [n n m 1 l []]
+    (cond (zero? n) l
+          (pos? (bit-and m n)) (recur (bit-and n (bit-not m)) (+ m m) (conj l (-ctb-bit-name m)))
+          :else (recur n (+ m m) l))))
+
+(defrecord CompileTimeBinding
+    [^Integer flags
+     value ;; the value, if it's a constant, or the expander if it's a macro
+     type ;; the type, if known
+     expansion-path]) ;; path to the macro that was expanded
+
+(def null-CompileTimeBinding (map->CompileTimeBinding {}))
+
+(defn check-flags [flags location]
+  (when (and (ctb-mask? flags :nonlocal) (ctb-mask? flags :global))
+    ($syntax-error location "Can't declare a variable both nonlocal and global"))
+  (when (ctb-mask? flags :forwarded)
+    (let [declname (ctb-bit-name flags :forwarded)]
+      (when (ctb-mask? flags :defined)
+        ($syntax-error location "Can't declare %a a %a" [declname (ctb-bit-name flags :defined)]))
+      (when (ctb-mask? flags :annotated)
+        ($syntax-error location "Can't annotate a %a variable as %a" [declname (ctb-bit-name flags :annotated)]))
+      (when (ctb-mask? flags :macro)
+        ($syntax-error location "Can't define a %a variable as a macro" [declname]))))
+  (let [defined (ctb-mask flags :defined)]
+    (when (pos? defined)
+      (when-not (= defined (first-bit defined))
+        ($syntax-error location "A variable can't be both %a and %a" (take 2 (ctb-bit-names defined))))
+      (when (ctb-mask? flags :macro)
+        ($syntax-error location "A variable can't be both %a and %a"
+                       [(ctb-bit-name defined) (ctb-bit-name flags :macro)]))))
+  (when (ctb-mask? flags :target) ;; restrictions not in Python
+    (when (ctb-mask? flags :forwarded)
+      ($syntax-error location "Can't bind a %a variable" [(ctb-bit-name flags :forwarded)]))
+    (when (ctb-mask? flags :macro)
+      ($syntax-error location "A variable can't be both bound and defined as a macro" [(ctb-bit-name flags :forwarded)])))
+  flags)
+
+(defn -compile-time-var [lexical-scope toplevel-scope name effect location levels-up nonlocal?]
+  (let [;; The current scope
+        scope (or lexical-scope toplevel-scope)
+        ;; Is it the top-level scope?
+        toplevel? (not lexical-scope)
+        ;; The binding for the variable in this scope if it's known, or else a fresh binding.
+        binding (get-in scope [:bindings name] null-CompileTimeBinding)
+        ;; Is this variable being bound before it was ever used?
+        bound-before-use (and (ctb-mask? effect :target)
+                              (not (ctb-flags? binding (or :annotated :forwarded :defined :used))))
+        ;; Add a synthetic effect for variables that are assigned before they are used.
+        effect2 (if bound-before-use (bit-or effect (ctb-mask :bound-before-use)) effect)
+        ;; Is this effect relevant to the local scope only?
+        ;; excludes :target :bound-before-use :used :found
+        local-effect? (ctb-mask? effect2 (or :annotated :forwarded :defined :macro :bound-before-use))
+        ;; Is this scope the one that defines the current variable?
+        found? (or toplevel? local-effect?
+                   (ctb-flags? binding (or :annotated :defined :macro))
+                   (and (ctb-flags? binding :target) (not (ctb-flags? binding :forwarded))))
+        ;; New flags for the binding
+        new-flags (check-flags effect2 location)]
+    (letfn [(new-binding [path found-binding expanded?]
+              (if expanded?
+                (if (ctb-flags? binding :expanded)
+                  (if (= (:expansion-path binding) path)
+                    (assoc binding :flags new-flags)
+                    ($syntax-error location "variable was previously expanded from a different source"))
+                  (assoc binding
+                    :flags (bit-or new-flags (ctb-mask :expanded))
+                    :path path :value (:value found-binding)))
+                (assoc binding :flags new-flags)))
+            (new-bindings [new-binding]
+              (assoc (:bindings scope) name new-binding))]
+        (if found?
+          (let [expanded? (and (ctb-mask? new-flags :macro) (ctb-mask? effect :used))]
+            (if toplevel?
+              (let [path [:global name]
+                    new-binding (new-binding path binding expanded?)]
+                [nil (->CompileTimeScope (new-bindings new-binding)) path new-binding])
+              (let [path (if (zero? levels-up) [:local name] [:lexical levels-up name])
+                    new-binding (new-binding path binding expanded?)]
+                [(->CompileTimeScope (new-bindings new-binding) (:parent lexical-scope)) toplevel-scope path new-binding])))
+          (let [;; Not found. Compute mask to recurse with.
+                up-effect (bit-and effect2 (ctb-mask (or :target :used)))
+                _ (assert (pos? up-effect))
+                ;; Get information from upper scope.
+                [up-lexical-scope up-toplevel-scope path up-binding]
+                (cond
+                 ;; If the variable wasn't declared, go to the next scope.
+                 (not (ctb-mask? new-flags :global))
+                 (-compile-time-var (:parent lexical-scope) toplevel-scope name up-effect location
+                                    (inc levels-up) (or nonlocal? (ctb-flags? new-flags :nonlocal)))
+                 ;; If the variable was declared global, go straight to top-level scope.
+                 nonlocal?
+                 ($syntax-error location "variable declared nonlocal but resolves to global")
+                 :else
+                 (-compile-time-var nil toplevel-scope name up-effect location -1 false))
+                ;; Is this a macro-expansion?
+                expanded? (ctb-flags? up-binding :macro)
+                new-binding (new-binding path up-binding expanded?)
+                new-bindings (new-bindings new-binding)]
+            [(->CompileTimeScope new-bindings (:parent up-lexical-scope)) up-toplevel-scope
+             path new-binding])))))
+
+(defn compile-time-var
+  "Given an environment, a variable name, and an effect on that variable,
+lookup the variable by name, modify the environment to account for the effect, and
+return a vector [updated-environment path binding] of the updated environment,
+a path to the variable from current scope (assuming it will not be invalidated by a further
+declaration), and the compile-time binding for the variable assuming the path is correct.
+Issue a warning or an error as appropriate if the effect contradicts a previous reference,
+reporting it as happening at given location.
+The path can be a vector [:local ~name], [:lexical ~levels-up ~name], [:globals ~name].
+An effect can be nil (no meta-modification), :global or :nonlocal (declaration),
+:parameter or :def or :class (definition), :bind (binding with =), :reference (variable used),
+:call-reference, :decorator-reference, :with-reference, :modify-reference ( +=, etc.)"
+  [environment name effect location]
+  (let [[lexical-scope toplevel-scope path binding]
+        (-compile-time-var (:lexical-scope environment) (:toplevel-scope environment) name effect location 0 false)]
+    [(->CompileTimeEnvironment lexical-scope toplevel-scope) path binding]))
+
+;;; Initial global bindings
+(def initial-globals (atom {}))
+
+(defn register-global [name value]
+  (swap! initial-globals #(assoc % name value)))
+(defn register-globals [map]
+  (swap! initial-globals #(merge % map)))
+
+(defn map-map-values [f m]
+  (into {} (map (fn [[name value]] [name (f value)]) m)))
+
+(defn compile-time-bindings-for-known-constants [m]
+  (map-map-values #(map->CompileTimeBinding {:constant true :value %}) m))
+
+(defn initial-compile-time-globals []
+  (compile-time-bindings-for-known-constants @initial-globals))
+


Use true? for message handler result checking

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


views: remove unnecessary apply

views: remove unnecessary apply

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


CMR-688: First cut at adding ISO-MENDS support for opendata fields.

error: pathspec 'umm-lib/src/cmr/umm/iso_mends/collection/personnel.clj' did not match any file(s) known to git

--- umm-lib/src/cmr/umm/iso_mends/collection/personnel.clj
+++ umm-lib/src/cmr/umm/iso_mends/collection/personnel.clj
@@ -0,0 +1,56 @@
+(ns cmr.umm.iso-mends.collection.personnel
+  "Contains functions for parsing and generating the ISO MENDS personnel"
+  (:require [clojure.data.xml :as x]
+            [cmr.common.xml :as cx]
+            [cmr.umm.collection :as c]
+            [cmr.umm.iso-mends.collection.instrument :as inst]
+            [cmr.umm.iso-mends.collection.keyword :as k]
+            [cmr.umm.iso-mends.collection.helper :as h]
+            [cmr.umm.generator-util :as gu]))
+
+(defn- xml-elem->contact-name
+  "Returns the contact name from a parsed IdentificationInfo XML structure"
+  [xml-struct]
+  (let [person-name (cx/string-at-path xml-struct [:pointOfContact
+                                                   :CI_ResponsibleParty
+                                                   :individualName
+                                                   :CharacterString])
+        org-name (cx/string-at-path xml-struct [:pointOfContact
+                                                :CI_ResponsibleParty
+                                                :organisationName
+                                                :CharacterString])]
+    (or person-name org-name)))
+
+
+(defn- xml-elem->email
+  "Returns the contact email from a parsed IdentificationInfo XML structure"
+  [xml-struct]
+  (cx/string-at-path xml-struct [:pointOfContact
+                                 :CI_ResponsibleParty
+                                 :contactInfo
+                                 :CI_Contact
+                                 :address
+                                 :CI_Address
+                                 :electronicMailAddress
+                                 :CharacterString]))
+
+(defn- xml-elem->role
+  "Returns the personnel role from a parsed XML structure"
+  [xml-struct]
+  (cx/string-at-path xml-struct [:pontOfContact
+                                 :CI_ResponsibleParty
+                                 :role
+                                 :CI_RoleCode
+                                 :codeListValue]))
+
+(defn xml-elem->personnel
+  "Returns the personnel from a parsed XML structure"
+  [xml-struct]
+  (let [email (xml-elem->email xml-struct)
+        contact-name (xml-elem->contact-name xml-struct)
+        contact (c/map->Contact {:type :email
+                                 :value email})
+        role (xml-elem->role xml-struct)]
+    [(c/map->Personnel {:roles [role]
+                        :contacts [contact]
+                        :last-name contact-name})]))


Test pulse endpoint

Test pulse endpoint

--- src/metabase/api/pulse.clj
+++ src/metabase/api/pulse.clj
@@ -11,7 +11,9 @@
                              [database :refer [Database]]
                              [pulse :refer [Pulse] :as pulse]
                              [pulse-channel :refer [channel-types]])
-            [metabase.pulse :as p]))
+            [metabase.pulse :as p]
+            [metabase.task.send-pulses :refer [send-pulse]]
+            [metabase.models.pulse :refer [retrieve-pulse]]))

 (defendpoint GET "/"
@@ -105,4 +107,12 @@
           ba (p/render-pulse-card-to-png card data true)]
       {:status 200 :headers {"Content-Type" "image/png"} :body (new java.io.ByteArrayInputStream ba) })))

+;; Using "GET" for now so it's easier to trigger from the browser. Switch to using POST if we add a button in the UI.
+(defendpoint GET "/:id/test"
+  "Test send a pulse"
+  [id]
+  (check-superuser)
+  (send-pulse (retrieve-pulse id))
+  {:status 200 :body {:ok true}})
+
 (define-routes)


rev :import

rev :import


day 25 part 1

day 25 part 1

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

--- src/adventofcode/day25.clj
+++ src/adventofcode/day25.clj
@@ -0,0 +1,12 @@
+(ns adventofcode.day25)
+
+(defn triangle-from [start first-step]
+  (iterate (fn [[n step]] [(+ n step) (inc step)]) [start first-step]))
+
+(defn coordinates->number [row column]
+  (let [triangle-start (/ (* column (inc column)) 2)]
+    (first (first (drop (dec row) (triangle-from triangle-start column))))))
+
+(def index (coordinates->number 2978 3083))
+
+(def part-one (first (drop (dec index) (iterate #(rem (* % 252533) 33554393) 20151125))))


Add api route to upload income verification files

It also updates the application to include the income files

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


Fix typo

Fix typo

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


cleanup core loop members

cleanup core loop members


first implementation of an item library based onon tesco api

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

--- src/eatme/item_library.clj
+++ src/eatme/item_library.clj
@@ -0,0 +1,45 @@
+(ns eatme.item-library
+  (:use [eatme.config :only [config]])
+  (:require [clj-http.client :as client]
+            [clojure.string :as string]))
+
+(def tesco-api "https://secure.techfortesco.com/groceryapi/restservice.aspx")
+
+(defn- get-app []
+  {:developerkey  (config :tesco_devkey)
+   :applicationkey (config :tesco_appkey)})
+
+(def app (memoize get-app))
+
+;; logs in as "Mrs. Anonymously-Loggedin" and works. yay!
+(def user {:email ""
+           :password ""})
+
+(defonce session (atom {}))
+
+(defn- to-command [command]
+  (string/upper-case (name command)))
+
+(defn call-api
+  ([command] (call-api command {}))
+  ([command params]
+     (:body (client/get tesco-api {:query-params (merge {:command (to-command command)
+                                                         :sessionkey (:SessionKey @session)
+                                                         :page 1} (app) params)
+                                   :as :json}))))
+
+(defn login
+  ([] (login user))
+  ([user] (reset! session (call-api :login user))))
+
+(defn search
+  ([q] (search q 1))
+  ([q p] (call-api :productsearch {:searchtext q :page p})))
+
+;; login and get a session id
+(defn init []
+  (login))
+
+;; useful commands
+;; LISTPRODUCTCATEGORIES - Lists the departments, aisles and shelves in a nested format
+;; LISTPRODUCTSBYCATEGORY - Lists the products for a given shelf (provided by ListProductCategories. Now with new parameter EXTENDEDINFO=Y


add source to subscribe! options in reassign


expand team members on click

expand team members on click

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/clojurecup/cc2014-frontend.git/'


some speed improvements

some speed improvements

--- src/metabase/driver/query_processor/annotate.clj
+++ src/metabase/driver/query_processor/annotate.clj
@@ -20,7 +20,7 @@
                                        keyword))
                (dissoc :parent :parent-id :table-name))))

-(defn- query-add-info [query results]
+(defn- query-add-info [{{ag-type :aggregation-type, ag-field :field} :aggregation, :as query} results]
   {:pre [(integer? (get-in query [:source-table :id]))]}
   (let [fields (transient [])]
     (clojure.walk/prewalk (fn [f]
@@ -36,6 +36,18 @@
                                       (when (:parent f)
                                         (conj! fields (:parent f))))))
                           query)
+    ;; Add an aggregate field to :query-fields if appropriate
+    (when (contains? #{:avg :count :distinct :stddev :sum} ag-type)
+      (conj! fields (-> (if (contains? #{:count :distinct} ag-type)
+                          {:base-type    :IntegerField
+                           :field-name   "count"
+                           :special-type :number}
+                          (-> ag-field
+                              (select-keys [:base-type :special-type])
+                              (assoc :field-name (if (= ag-type :distinct) "count"
+                                                     (name ag-type)))))
+                        (assoc :ag-field? true)
+                        expand/map->Field)))
     (assoc query
            :result-keys  (vec (sort (keys (first results))))
            :query-fields (mapv collapse-field (persistent! fields))
@@ -48,31 +60,19 @@
 (defn- breakout-fieldo [{breakout-fields :breakout} field]
   (member1o field breakout-fields))

+(defn- aggregate-fieldo [field]
+  (fresh [ag-field?]
+    (featurec field {:ag-field? ag-field?})
+    (== ag-field? true)))
+
 (defn- explicit-fields-fieldo [{:keys [fields-is-implicit], fields-fields :fields} field]
   (all (nilo fields-is-implicit)
        (member1o field fields-fields)))
-
-(defn- aggregate-fieldo [{{ag-type :aggregation-type, ag-field :field} :aggregation} field]
-  (all (== field (if (contains? #{:count :distinct} ag-type)
-                   {:base-type    :IntegerField
-                    :field-name   :count
-                    :special-type :number}
-                   (-> ag-field
-                       (select-keys [:base-type :special-type])
-                       (assoc :field-name (if (= ag-type :distinct) :count
-                                              ag-type)))))
-       (member1o ag-type [:count :avg :sum :stddev :distinct])))

 (defn- valid-nameo [{:keys [result-keys]} field]
   (fresh [field-name]
     (featurec field {:field-name field-name})
     (member1o field-name result-keys)))
-
-(defn- fieldo [{:keys [query-fields], :as query} field]
-  (all (conde
-        ((member1o field query-fields))
-        ((aggregate-fieldo query field)))
-       (valid-nameo query field)))

 ;;; ## Ordering
@@ -100,7 +100,7 @@
 (defn- field-groupo [query field v]
   (conda
    ((breakout-fieldo query field)        (== v 0))
-   ((aggregate-fieldo query field)       (== v 1))
+   ((aggregate-fieldo field)             (== v 1))
    ((explicit-fields-fieldo query field) (== v 2))
    (s#                                   (== v 3))))

@@ -156,22 +156,29 @@

 ;;; ## Top-Level Resolution / Ordering

+(def ^:private total-slowness (atom 0))
+(def ^:private run-count (atom 0))
+
 (defn- resolve+order-cols [query]
-  {:post [(or (sequential? %)
-              (println "FAILED!\n" (u/pprint-to-str query) "\nRESULTS:" %))
-          (every? map? %)]}
+  {:post [(or (and (sequential? %)
+                   (every? map? %))
+              (println "FAILED!\n" (u/pprint-to-str query) "\nRESULTS:" %))]}
   (let [num-cols   (count (:result-keys query))
         cols       (vec (lvars num-cols))
         ;; A few queries take a ridiculous amount of time to order. Let's do some ghetto profiling
         start-time (System/currentTimeMillis)
         results    (first (run 1 [q]
                             (== q cols)
-                            (distincto q)
-                            (everyg (partial fieldo query) q)
+                            (distincto cols)
+                            (everyg #(member1o % (:query-fields query)) cols)
+                            (everyg (partial valid-nameo query) cols)
                             (everyg (fn [i]
                                       (fields< query (cols i) (cols (inc i))))
                                     (range 0 (dec num-cols)))))
         run-time   (- (System/currentTimeMillis) start-time)]
+    (swap! total-slowness #(+ % run-time))
+    (swap! run-count inc)
+    (println (u/format-color 'cyan "Total slowness thus far: %.1f (avg: %.2f)" (/ @total-slowness 1000.0) (/ (/ @total-slowness 1000.0) @run-count)))
     (when (> run-time 2000)
       (println (u/format-color 'red "This query took a STUPID LONG amount of time to order (%.1f seconds):\n%s\n%s" (/ run-time 1000.0)
                                (u/pprint-to-str query) (u/pprint-to-str results))))
@@ -192,7 +199,7 @@
                                   :field-name   :name
                                   :special-type :special_type
                                   :table-id     :table_id})
-               (dissoc :parent :parent-id :position)))))
+               (dissoc :parent :parent-id :position :ag-field?)))))

 (defn- add-fields-extra-info
   "Add `:extra_info` about `ForeignKeys` to `Fields` whose `special_type` is `:fk`."
@@ -236,3 +243,26 @@
        :columns (mapv name columns)
        :rows    (for [row results]
                   (mapv row columns))})))
+
+;; #_(require 'metabase.driver)
+;; (require 'metabase.test.data)
+;; (require 'metabase.test.data.datasets)
+;; (defn x []
+;;   (metabase.test.data.datasets/with-dataset
+;;     :postgres
+;;     (metabase.driver/process-query
+;;      {:type :query,
+;;       :database (metabase.test.data/db-id),
+;;       :query
+;;       {:source_table (metabase.test.data/id :venues),
+;;        :filter
+;;        ["INSIDE"
+;;         (metabase.test.data/id :venues :latitude)
+;;         (metabase.test.data/id :venues :longitude)
+;;         10.0649
+;;         -165.379
+;;         10.0641
+;;         -165.371],
+;;        :aggregation ["rows"],
+;;        :breakout [nil],
+;;        :limit nil}})))


Fix typo

Fix typo

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


Unnecessary code was deleted

Unnecessary code was deleted

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/abtv/personal-aggregator.git/'


GM: Added tests for user-routes

GM: Added tests for user-routes

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

--- tests/clj/ona/viewer/routes_tests.clj
+++ tests/clj/ona/viewer/routes_tests.clj
@@ -0,0 +1,29 @@
+(ns ona.viewer.routes_tests
+  (:require [midje.sweet :refer :all]
+            [ona.viewer.routes :refer :all]
+            [ona.viewer.views.accounts :as accounts]))
+
+(def username "username")
+(def session {:account :fake-account})
+(def result {:body :something})
+
+(defn- route-params
+  "Make route params"
+  ([method uri]
+   {:request-method method :uri uri})
+  ([method uri session]
+   (route-params method uri session nil))
+  ([method uri session params]
+   (assoc (route-params method uri) :session session :params params)))
+
+(facts "user-routes"
+  (fact "GET /temp-token should calls get-token"
+    (user-routes (route-params :get
+                               (str "/" username "/temp-token"))) => (contains result)
+    (provided
+      (accounts/get-token :fake-account username) => result))
+  (fact "GET /validate-token calls validate-token"
+     (user-routes (route-params :get
+                                (str "/" username "/validate-token"))) => (contains result)
+     (provided
+       (accounts/validate-token :fake-account username) => result)))


approval component (init-commit)

approval component (init-commit)

error: pathspec 'src/ca_recipe/components/approvals.clj' did not match any file(s) known to git

--- src/ca_recipe/components/approvals.clj
+++ src/ca_recipe/components/approvals.clj
@@ -0,0 +1,19 @@
+(ns ca-recipe.components.approvals
+  :require [com.stuartsierra.component :as component])
+
+(defrecord Approvals [approval-config
+                      alert-chan
+                      knowledge-engine
+                      response-chan]
+  component/Livecicle
+  (start [component]
+    (process-alerts alert-chan)
+    (process-responses knowledge-engine response-chan)
+    component)
+  (stop [component]
+    component))
+
+(defn new-approvals [approval-config alert-chan response-chan]
+  (map->Approvals {:approval-config  approval-config
+                   :alert-chan alert-chan
+                   :response-chan response-chan}))


Don't save *data-readers* for java-only projects

--- src/leiningen/droid/compile.clj
+++ src/leiningen/droid/compile.clj
@@ -34,9 +34,11 @@
   This task is necessary if you define the UI in XML and also to gain
   access to your strings and images by their ID."
   [{{:keys [sdk-path target-version manifest-path res-path gen-path
-            out-res-path external-res-paths library]} :android :as project}]
+            out-res-path external-res-paths library]} :android
+    java-only :java-only :as project}]
   (info "Generating R.java...")
-  (save-data-readers-to-resource project)
+  (when-not java-only
+    (save-data-readers-to-resource project))
   (let [aapt-bin (sdk-binary sdk-path :aapt)
         android-jar (get-sdk-android-jar sdk-path target-version)
         manifest-file (io/file manifest-path)


Correctly exclude namespaces

Correctly exclude namespaces

--- src/leiningen/droid/compile.clj
+++ src/leiningen/droid/compile.clj
@@ -73,7 +73,7 @@
           (map symbol aot))
       set
       (sets/union always-compile-ns)
-      (sets/difference aot-exclude-ns)))
+      (sets/difference (set (map symbol aot-exclude-ns)))))

 (defn compile-clojure
   "Compiles Clojure files into .class files.


Creates small wrapper around noir's flash support.

error: pathspec 'src/cadence/model/flash.clj' did not match any file(s) known to git

--- src/cadence/model/flash.clj
+++ src/cadence/model/flash.clj
@@ -0,0 +1,8 @@
+(ns cadence.model.flash
+  (:refer-clojure :exclude [get])
+  (:require [noir.session :as sess]))
+
+(defn put! [t m]
+  (sess/flash-put! {:type t :message m}))
+
+(def get sess/flash-get)


mutable Boxed,Ejected variants and helpers

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


adding filesystem_test namespce, and adding tests for file-extension

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

--- test/vignette/util/filesystem_test.clj
+++ test/vignette/util/filesystem_test.clj
@@ -0,0 +1,7 @@
+(ns vignette.util.filesystem-test
+  (:require [midje.sweet :refer :all]
+            [vignette.util.filesystem :refer :all]))
+
+(facts :file-extension
+       (file-extension "some-file.png") => "png"
+       (file-extension "some-file.png.jpg") => "jpg")


handle initialization and provide help for dropping Aspire SQL DB tables

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

--- src/aspire/sql_db.clj
+++ src/aspire/sql_db.clj
@@ -0,0 +1,14 @@
+(ns aspire.sql-db
+  (:require [jdbc-pg-init.core :as jpi]
+            [clojure.edn :as edn]))
+
+(def schema (edn/read-string (slurp "schema.edn")))
+
+(defn init! [db]
+  (jpi/init! db schema))
+
+(defn print-drop-sql! []
+  (doall (for [table (keys (schema :tables))]
+           (println (format "DROP TABLE %s CASCADE;"
+                            (name table)))))
+  nil)


add o+ n m

add o+ n m

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/carolove/clojure-ring-app.git/'


refactor layout

refactor layout

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


remove bogus require

remove bogus require


lortu aurrez aipatu behar da

lortu aurrez aipatu behar da

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


Found irritating perf regression

Found irritating perf regression

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/thinktopic/netlib-ccm.git/'


Remove commented code

Remove commented code


retract duplicate messages

retract duplicate messages

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


Long line!

Long line!

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


All tests pass and all is well with the world.

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


Kehaar 0.7.0 with bounded thread pools

Kehaar 0.7.0 with bounded thread pools

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


add initial project configuration for an uberjar

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

--- project.clj
+++ project.clj
@@ -0,0 +1,9 @@
+(defproject fat-jar "0.1.0-SNAPSHOT"
+  :description "FIXME: write description"
+  :url "http://example.com/FIXME"
+  :license {:name "Eclipse Public License"
+            :url "http://www.eclipse.org/legal/epl-v10.html"}
+  :dependencies [[org.clojure/clojure "1.7.0"]]
+  :main fat-jar.core
+  :target-path "target/%s"
+  :profiles {:uberjar {:aot :all}})


Upgrade kehaar to 0.10.3

Upgrade kehaar to 0.10.3

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


Upgrade compojure

Upgrade compojure


bump teller

bump teller

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


[EN] Upgrade to Immutant 2

[EN] Upgrade to Immutant 2

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


bump version

bump version

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject storm "0.7.2-SNAPSHOT"
+(defproject storm "0.7.2-rc1"
   :source-path "src/clj"
   :test-path "test/clj"
   :java-source-path "src/jvm"


conclusions

conclusions

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

--- src/mark_volkmann_tutorial/conclusion.clj
+++ src/mark_volkmann_tutorial/conclusion.clj
@@ -0,0 +1,14 @@
+;; Conclusion
+;; http://java.ociweb.com/mark/clojure/article.html#Conclusion
+
+;; more
+;; Programming Clojure by Stuart Halloway.
+
+;; easier concurrent programming
+;; functional programming vs OOP
+;; run on JVM
+;; dynamic vs static typed
+;; Lisp syntax
+
+;; References
+;; http://java.ociweb.com/mark/clojure/article.html#References


fix bug with team fields not always being editable

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/clojurecup/cc2014-frontend.git/'


Friendly configuration message

Friendly configuration message

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


Handle 500 response codes

Handle 500 response codes

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


Add basic geodesic sketch drawing an icosahedron.

error: pathspec 'src/org/playasophy/wonderdome/geodesic.clj' did not match any file(s) known to git

--- src/org/playasophy/wonderdome/geodesic.clj
+++ src/org/playasophy/wonderdome/geodesic.clj
@@ -0,0 +1,91 @@
+(ns org.playasophy.wonderdome.geodesic
+  (:require
+    [quil.core :refer :all]
+    [quil.helpers.drawing :refer [line-join-points]]
+    [quil.helpers.calc :refer [mul-add]]))
+
+
+(def strut-counts-3V
+  "Number of each strut needed in a 3V dome."
+  {:a 30
+   :b 40
+   :c 50})
+
+
+(def strut-ratios-3V
+  "The ratio of each strut length to the radius."
+  {:a 0.34862
+   :b 0.40355
+   :c 0.41241})
+
+
+; chord-factor n = 2*sin(theta/2)
+; theta = central angle
+; length of chord = r*n
+
+; 0.3486 = 1*2*sin(t/2)
+; 0.3486/2 = sin(t/2)
+; arcsin(0.3486/2) = t/2
+; 2*arcsin(ratio/2)
+
+
+(def icosahedron
+  "An icosahedron with unit radius."
+  (let [phi (/ (+ 1 (Math/sqrt 5.0)) 2)
+        -phi (- phi)
+        points
+        {:A [ 0.0  1.0  phi] :B [ 0.0 -1.0  phi]
+         :C [ 0.0 -1.0 -phi] :D [ 0.0  1.0 -phi]
+         :E [ phi  0.0  1.0] :F [-phi  0.0  1.0]
+         :G [-phi  0.0 -1.0] :H [ phi  0.0 -1.0]
+         :I [ 1.0  phi  0.0] :J [-1.0  phi  0.0]
+         :K [-1.0 -phi  0.0] :L [ 1.0 -phi  0.0]}
+        faces
+        [[:A :I :J] [:A :J :F] [:A :F :B] [:A :B :E] [:A :E :I]
+         [:B :F :K] [:B :K :L] [:B :L :E] [:C :D :H] [:C :H :L]
+         [:C :L :K] [:C :K :G] [:C :G :D] [:D :G :J] [:D :J :I]
+         [:D :I :H] [:E :L :H] [:E :H :I] [:F :J :G] [:F :G :K]]]
+    (set (map (comp set (partial map points)) faces))))
+
+
+;;;;; SKETCH CODE ;;;;;
+
+(defn setup []
+  (background 255)
+  (stroke 00))
+
+
+(defn draw []
+  (background 255)
+  (translate (/ (width) 2) (/ (height) 2) 0)
+  (rotate-y (* (frame-count) 0.03))
+  (rotate-x (* (frame-count) 0.04))
+  (doseq [face icosahedron]
+    (-> face
+        (as-> points
+          (map #(vec (map (partial * 50) %)) points)   ; scale the points
+          (vec points)
+          (conj points (first points)))                ; repeat the last point
+        line-join-points
+        (as-> lines
+          (map (partial apply line) lines))
+        dorun))
+  #_
+  (let [line-args (for [t (range 0 180)]
+                    (let [s (* t 18)
+                          radian-s (radians s)
+                          radian-t (radians t)
+                          x (* radius (cos radian-s) (sin radian-t))
+                          y (* radius (sin radian-s) (sin radian-t))
+                          z (* radius (cos radian-t))]
+                      [x y z]))]
+    (dorun
+     (map #(apply line %) (line-join-points line-args)))))
+
+
+(defsketch geodesic-dome
+  :title "Geodesic Dome"
+  :setup setup
+  :draw draw
+  :size [500 300]
+  :renderer :opengl)


add autopay-start, fix set-autopay!

add autopay-start, fix set-autopay!

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


CMR-1354 Finish integration tests

CMR-1354 Finish integration tests

error: pathspec 'search-app/test/cmr/search/test/data/temporal_ranges_to_elastic.clj' did not match any file(s) known to git

--- search-app/test/cmr/search/test/data/temporal_ranges_to_elastic.clj
+++ search-app/test/cmr/search/test/data/temporal_ranges_to_elastic.clj
@@ -0,0 +1,39 @@
+(ns cmr.search.test.data.temporal-ranges-to-elastic
+  "Contains test to verify the functions that get the temporal ranges for the elastic search
+  temporal relevancy sort script"
+ (:require
+  [clj-time.coerce :as time-coerce]
+  [clj-time.core :as time]
+  [clojure.test :refer :all]
+  [cmr.common.util :as util :refer [are3]]
+  [cmr.search.data.temporal-ranges-to-elastic :as temporal-to-elastic]))
+
+;; Temporal range input is a map of :start-date :end-date
+;; Temporal ranges in elastic should have values for nil start or end dates, have the date
+;; range calculated, and params should be in snake case
+
+(deftest temporal-ranges-to-elastic
+  (are3 [temporal-range elastic-temporal-range]
+    (is (= elastic-temporal-range
+           (temporal-to-elastic/temporal-range->elastic-param temporal-range)))
+
+    "Both start and end date"
+    {:start-date (time/date-time 2014 01 01)
+     :end-date (time/date-time 2016 01 01)}
+    {:range 63072000000
+     :end_date (time-coerce/to-long (time/date-time 2016 01 01))
+     :start_date (time-coerce/to-long (time/date-time 2014 01 01))}
+
+    "Nil end date"
+    {:start-date (time/date-time 2014 01 01)
+     :end-date nil}
+    {:range (- (time-coerce/to-long (time/today)) (time-coerce/to-long (time/date-time 2014 01 01)))
+     :end_date (time-coerce/to-long (time/today))
+     :start_date (time-coerce/to-long (time/date-time 2014 01 01))}
+
+    "Nil start date"
+    {:start-date nil
+     :end-date (time/date-time 2016 01 01)}
+    {:range 1451606400000
+     :end_date (time-coerce/to-long (time/date-time 2016 01 01))
+     :start_date (time-coerce/to-long (time/date-time 1970 01 01))}))


nice colored logging for generic SQL QP

nice colored logging for generic SQL QP

--- src/metabase/driver/generic_sql/query_processor.clj
+++ src/metabase/driver/generic_sql/query_processor.clj
@@ -22,6 +22,7 @@
 (defn process
   "Convert QUERY into a korma `select` form."
   [{{:keys [source_table] :as query} :query}]
+  (println (u/format-color 'magenta "EXPANDED-QUERY:\n%s" (u/pprint-to-str qp/*expanded-query*)))
   (when-not (zero? source_table)
     (let [forms (->> (map apply-form query)                    ; call `apply-form` for each clause and strip out nil results
                      (filter identity)
@@ -228,10 +229,6 @@
   [{:keys [source_table] :as query} forms]
   (when-not qp/*disable-qp-logging*
     (log/debug
-     "\n********************"
-     "\nSOURCE TABLE: " source_table
-     "\nQUERY ->"      (with-out-str (clojure.pprint/pprint query))
-     "\nKORMA FORM ->" (with-out-str (clojure.pprint/pprint `(select (table-id->korma-entity ~source_table) ~@forms)))
-     "\nSQL ->"        (eval `(let [entity# (table-id->korma-entity ~source_table)]
-                                (sql-only (select entity# ~@forms))))
-     "\n********************\n")))
+     (u/format-color 'green "\n\nKORMA FORM:\n%s" (u/pprint-to-str `(select (table-id->korma-entity ~source_table) ~@forms)))
+     (u/format-color 'blue  "\nSQL:\n%s\n"        (eval `(let [entity# (table-id->korma-entity ~source_table)]
+                                                           (sql-only (select entity# ~@forms))))))))


[upcoming]  revert adding :election-day to reg-same-day


add Mariah

add Mariah


Exemples with 2 pads working

Exemples with 2 pads working

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

--- examples/yaw/pad_ball_2.clj
+++ examples/yaw/pad_ball_2.clj
@@ -0,0 +1,233 @@
+(ns yaw.pad-ball-2
+  "A simple 3D example using a reagent-like approach."
+  (:require
+   [clojure.set :as set]
+   [yaw.world :as world]
+   [yaw.reaction :as react]
+   [yaw.render :as render]))
+
+(def +myctrl+ (world/start-universe!))
+
+;;; =====================
+;;; The state part
+;;; =====================
+
+(react/register-state ::pad1-state {:pos [3 0 -5]
+                                    :delta [0 0.05 0]})
+
+(react/register-state ::pad2-state {:pos [-3 0 -5]
+                                    :delta [0 0.05 0]})
+
+(react/register-state ::ball-state {:pos [-2 0 -5]
+                                    :delta [0.02 0 0]})
+
+(def init-pad1-state
+  {:pos [3 0 -5]
+   :delta [0 0.05 0]})
+
+(def init-pad2-state
+  {:pos [-3 0 -5]
+   :delta [0 0.05 0]})
+
+(def init-ball-state
+  {:pos [-2 0 -5]
+   :delta [0.02 0 0]})
+
+;;; =====================
+;;; Subscription(s)
+;;; =====================
+
+(react/register-subscription
+ ::pad1-changed
+ (fn [db]
+   (::pad1-state  db)))
+
+(react/register-subscription
+ ::pad2-changed
+ (fn [db]
+   (::pad2-state  db)))
+
+(react/register-subscription
+ ::ball-changed
+ (fn [db]
+   (::ball-state  db)))
+
+;;; ====================
+;;; Event handlers
+;;; ====================
+
+(react/register-event
+ :react/initialize
+ (fn []
+   (react/init-state ::pad1-state init-pad1-state)
+   (react/init-state ::pad2-state init-pad2-state)
+   (react/init-state ::ball-state init-ball-state)))
+
+(react/register-event
+ :react/frame-update
+ (fn []
+   (react/dispatch [::move-ball])))
+
+(declare update-ball-state)
+
+(react/register-event
+ ::move-up-pad1
+ (fn []
+   (react/update-state ::pad1-state
+                       (fn [{pos :pos
+                             delta :delta}]
+                         {:pos (mapv + pos delta)
+                          :delta delta}))))
+(react/register-event
+ ::move-down-pad1
+ (fn []
+   (react/update-state ::pad1-state
+                       (fn [{pos :pos
+                             delta :delta}]
+                         {:pos (mapv - pos delta)
+                          :delta delta}))))
+
+
+(react/register-event
+ ::move-up-pad2
+ (fn []
+   (react/update-state ::pad2-state
+                       (fn [{pos :pos
+                             delta :delta}]
+                         {:pos (mapv + pos delta)
+                          :delta delta}))))
+(react/register-event
+ ::move-down-pad2
+ (fn []
+   (react/update-state ::pad2-state
+                       (fn [{pos :pos
+                             delta :delta}]
+                         {:pos (mapv - pos delta)
+                          :delta delta}))))
+
+
+(react/register-event
+ ::move-ball
+ (fn []
+   (react/update-state ::ball-state
+                       (fn [{pos :pos
+                             delta :delta}]
+                         {:pos (mapv + pos delta) :delta delta}))))
+
+(react/register-event
+ ::ball-collision
+ (fn []
+   (react/update-state ::ball-state
+                       (fn [{pos :pos
+                             delta :delta}]
+                         {:pos pos :delta (mapv - delta)}))))
+
+(world/register-input-callback! (:world @+myctrl+)
+ (fn [key _ action _]
+   (cond
+    (and (= key 265) ; HACK: GLFW constant for up arrow!
+            (or (= action 2) (= action 1))) ; HACK: GLFW_PRESS or REPEATED
+     (react/dispatch [::move-up-pad1])
+    (and (= key 264) ; HACK: GLFW constant for down arrow!
+            (or (= action 2) (= action 1))) ; HACK: GLFW_PRESS or REPEATED
+      (react/dispatch [::move-down-pad1])
+    (and (= key 87) ; HACK: GLFW constant for z!
+            (or (= action 2) (= action 1))) ; HACK: GLFW_PRESS or REPEATED
+     (react/dispatch [::move-up-pad2])
+    (and (= key 83) ; HACK: GLFW constant for s!
+            (or (= action 2) (= action 1))) ; HACK: GLFW_PRESS or REPEATED
+      (react/dispatch [::move-down-pad2]))))
+
+
+;;; =====================
+;;; The view part
+;;; =====================
+
+;; TODO Why can't we use this function twice to define both pads ?
+; (defn the-pad
+;   [id state]
+;   [:group (keyword "test" (str "pad-group-" id))
+;           {:pos (:pos @state)
+;             :rot [0 0 0]
+;             :scale 1}
+;    [:item (keyword "test" (str "pad-" id))
+;           {:mesh :mesh/cuboid
+;             :pos [0 0 0]
+;             :rot [0 0 0]
+;             :mat :red
+;             :scale 0.3}]
+;    [:hitbox (keyword "test" (str "hitbox-" id))
+;             {:pos [0 0 0]
+;               :scale 0.6
+;               :length [1 3 1]}]])
+
+(defn the-pad1
+  [state]
+  [:group :test/pad-group-1
+          {:pos (:pos @state)
+            :rot [0 0 0]
+            :scale 1}
+   [:item :test/pad-item-1
+          {:mesh :mesh/cuboid
+            :pos [0 0 0]
+            :rot [0 0 0]
+            :mat :red
+            :scale 0.3}]
+   [:hitbox :test/pad-hitbox-1
+            {:pos [0 0 0]
+              :scale 0.6
+              :length [1.05 3.01 1.01]}]])
+
+(defn the-pad2
+  [state]
+  [:group :test/pad-group-2
+          {:pos (:pos @state)
+            :rot [0 0 0]
+            :scale 1}
+   [:item :test/pad-item-2
+          {:mesh :mesh/cuboid
+            :pos [0 0 0]
+            :rot [0 0 0]
+            :mat :red
+            :scale 0.3}]
+   [:hitbox :test/pad-hitbox-2
+            {:pos [0 0 0]
+              :scale 0.6
+              :length [1.05 3.01 1.01]}]])
+
+(defn the-ball
+  [state]
+  [:group :test/ball {:pos (:pos @state)
+                      :rot [0 0 0]
+                      :scale 1}
+   [:item :test/box {:mesh :mesh/box
+                     :pos [0 0 0]
+                     :rot [0 0 0]
+                     :mat :white
+                     :scale 0.3}]
+   [:hitbox :test/ball-hitbox {:pos [0 0 0]
+                              :scale 0.6
+                              :length [1 1 1]}
+    [{:group-id :test/pad-group-1 :hitbox-id :test/pad-hitbox-1 :collision-handler #(react/dispatch [::ball-collision])}
+     {:group-id :test/pad-group-2 :hitbox-id :test/pad-hitbox-2 :collision-handler #(react/dispatch [::ball-collision])}]]])
+
+
+(defn scene []
+  [:scene
+   [:ambient {:color :white :i 0.4}]
+   [:sun {:color :red :i 1 :dir [-1 0 0]}]
+   [:light ::light {:color :yellow :pos [0.5 0 -4]}]
+   (let [pad-state1 (react/subscribe +myctrl+ [::pad1-changed])]
+    [the-pad1 pad-state1])
+   (let [pad-state2 (react/subscribe +myctrl+ [::pad2-changed])]
+    [the-pad2 pad-state2])
+   (let [ball-state (react/subscribe +myctrl+ [::ball-changed])]
+     [the-ball ball-state])
+    ])
+
+;;; =====================
+;;; The main part
+;;; =====================
+
+(react/activate! +myctrl+ [scene])
+ ;; (react/dispatch :react/initialize)


Increase version number for dev

Increase version number for dev

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/tobiasbayer/eureka-client.git/'


Version 1.12.0

Version 1.12.0


disover MESOS_HOME in the environment

disover MESOS_HOME in the environment

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


upgrade some stuff

upgrade some stuff

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


Update deps

Update deps

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


consistent alpha order

consistent alpha order

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


Update deps w/ new releases since original PR

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


minor

minor

--- cljs-client/cljsinfo_client/cheatsheet.cljs
+++ cljs-client/cljsinfo_client/cheatsheet.cljs
@@ -17,6 +17,9 @@
 (def sml-layout-class "sml-5dcf3")
 (def med-layout-class "med-0000a")
 (def lrg-layout-class "lrg-92b4d")
+(def layout-classes (str sml-layout-class " "
+                         med-layout-class " "
+                         lrg-layout-class))

 (defn- width->size [w]
   (cond
@@ -28,9 +31,7 @@

 (defn- on-change-size [_ _ _ new-size]
   (-> ($ "body")
-    (.removeClass (str sml-layout-class " "
-                       med-layout-class " "
-                       lrg-layout-class))
+    (.removeClass layout-classes)
     (.addClass
       (case new-size
         :small  sml-layout-class
@@ -70,7 +71,8 @@
       (.hide $el))))

 (defn- toggle-groups-and-sections!
-  "Show / hide groups and sections based on whether they contain a search match or not."
+  "Show / hide groups and sections based on whether they contain a search match
+   or not."
   []
   (.each ($ section-sel) toggle-el!)
   (.each ($ group-sel) toggle-el!))


minor clean up requires

minor clean up requires

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/JetBrains/imperative-nodejs.git/'


CMR-4013: Added db migration for CMR_VARIABLES table.

error: pathspec 'metadata-db-app/src/migrations/048_setup_variables_table.clj' did not match any file(s) known to git

--- metadata-db-app/src/migrations/048_setup_variables_table.clj
+++ metadata-db-app/src/migrations/048_setup_variables_table.clj
@@ -0,0 +1,59 @@
+(ns migrations.048-setup-variables-table
+  (:require [clojure.java.jdbc :as j]
+            [config.migrate-config :as config]
+            [config.mdb-migrate-helper :as h]))
+
+(def ^:private variables-column-sql
+  "id NUMBER,
+  concept_id VARCHAR(255) NOT NULL,
+  native_id VARCHAR(1030) NOT NULL,
+  metadata BLOB NOT NULL,
+  format VARCHAR(255) NOT NULL,
+  revision_id INTEGER DEFAULT 1 NOT NULL,
+  revision_date TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL,
+  created_at TIMESTAMP WITH TIME ZONE DEFAULT SYSTIMESTAMP NOT NULL,
+  deleted INTEGER DEFAULT 0 NOT NULL,
+  user_id VARCHAR(30),
+  variable_name VARCHAR(20),
+  measurement VARCHAR(1024),
+  transaction_id INTEGER DEFAULT 0 NOT NULL")
+
+(def ^:private variables-constraint-sql
+  (str "CONSTRAINT variables_pk PRIMARY KEY (id), "
+       ;; Unique constraint on native id and revision id
+       "CONSTRAINT variables_con_rev UNIQUE (native_id, revision_id)
+       USING INDEX (create unique index variables_ucr_i ON cmr_variables (native_id, revision_id)), "
+
+       ;; Unique constraint on concept id and revision id
+       "CONSTRAINT variables_cid_rev UNIQUE (concept_id, revision_id)
+       USING INDEX (create unique index variables_cri ON cmr_variables (concept_id, revision_id))"))
+
+(defn- create-variables-table
+  []
+  (h/sql
+   (format "CREATE TABLE METADATA_DB.cmr_variables (%s, %s)"
+           variables-column-sql variables-constraint-sql)))
+
+
+(defn- create-variables-indices
+  []
+  (h/sql "CREATE INDEX variables_crdi ON cmr_variables (concept_id, revision_id, deleted)"))
+
+(defn- create-variables-sequence
+  []
+  (h/sql "CREATE SEQUENCE cmr_variables_seq"))
+
+(defn up
+  "Migrates the database up to version 48."
+  []
+  (println "migrations.048-setup-variables-table up...")
+  (create-variables-table)
+  (create-variables-indices)
+  (create-variables-sequence))
+
+(defn down
+  "Migrates the database down from version 48."
+  []
+  (println "migrations.048-setup-variables-table down...")
+  (h/sql "DROP SEQUENCE METADATA_DB.cmr_variables_seq")
+  (h/sql "DROP TABLE METADATA_DB.cmr_variables"))


Add m0ar tests

Add m0ar tests

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

--- test/grimoire/things_test.clj
+++ test/grimoire/things_test.clj
@@ -0,0 +1,89 @@
+(ns grimoire.things-test
+  (:require [grimoire.things :as t]
+            [clojure.test :refer :all]))
+
+(def t
+  (-> (t/->Group "foo")
+      (t/->Artifact "bar")
+      (t/->Version "1.0.0")
+      (t/->Platform "clj")
+      (t/->Ns "foo.bar")
+      (t/->Def "qux")))
+
+(defmacro is-assert-error? [x]
+  `(is (~'thrown? AssertionError ~x)))
+
+(deftest thing-conversion-test
+  ;; Testing stuff that should work
+  (is (t/group?     (t/thing->group t)))
+  (is (t/artifact?  (t/thing->artifact t)))
+  (is (t/version?   (t/thing->version t)))
+  (is (t/platform?  (t/thing->platform t)))
+  (is (t/namespace? (t/thing->namespace t)))
+  (is (t/def?       (t/thing->def t)))
+
+  ;; Testing stuff that should fail
+  (testing "Testing thing->def"
+    (is-assert-error?
+     (t/thing->def
+      (t/thing->namespace t)))
+
+    (is-assert-error?
+     (t/thing->def
+      (t/thing->platform t)))
+
+    (is-assert-error?
+     (t/thing->def
+      (t/thing->version t)))
+
+    (is-assert-error?
+     (t/thing->def
+      (t/thing->artifact t)))
+
+    (is-assert-error?
+     (t/thing->def
+      (t/thing->group t))))
+
+  (testing "Testing thing->namespace"
+    (is-assert-error?
+     (t/thing->namespace
+      (t/thing->platform t)))
+
+    (is-assert-error?
+     (t/thing->namespace
+      (t/thing->version t)))
+
+    (is-assert-error?
+     (t/thing->namespace
+      (t/thing->artifact t)))
+
+    (is-assert-error?
+     (t/thing->namespace
+      (t/thing->group t))))
+
+  (testing "Testing thing->platform"
+    (is-assert-error?
+     (t/thing->platform
+      (t/thing->version t)))
+
+    (is-assert-error?
+     (t/thing->platform
+      (t/thing->artifact t)))
+
+    (is-assert-error?
+     (t/thing->platform
+      (t/thing->group t))))
+
+  (testing "Testing thing->version"
+    (is-assert-error?
+     (t/thing->version
+      (t/thing->artifact t)))
+
+    (is-assert-error?
+     (t/thing->version
+      (t/thing->group t))))
+
+  (testing "Testing thing->artifact"
+    (is-assert-error?
+     (t/thing->artifact
+      (t/thing->group t)))))


Using clojure.test.

Using clojure.test.

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

--- Spraff/test/spraff/test/core.clj
+++ Spraff/test/spraff/test/core.clj
@@ -0,0 +1,11 @@
+; :mode=clojure:
+
+(ns spraff.test.core
+    (:gen-class)
+    (:use
+        [spraff.core]
+        [clojure.test])
+)
+
+(deftest foobar
+    (is false "TODO."))