check in model file

check in model file

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

--- src-cljs/frontend/models/issue.cljs
+++ src-cljs/frontend/models/issue.cljs
@@ -0,0 +1,12 @@
+(ns frontend.models.issue
+  (:require [datascript :as d]
+            [frontend.utils :as utils :include-macros true]))
+
+(defn top-level-comments [issue]
+  (remove :comment/parent (:issue/comments issue)))
+
+(defn direct-descendants [db comment]
+  (d/q '{:find [[?e ...]]
+         :in [$ ?comment-id]
+         :where [[?e :comment/parent ?comment-id]]}
+       db (:db/id comment)))


Refactor shopping cart view

Refactor shopping cart view

-make items more concise

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


adding install-all command

adding install-all command

--- plugin/dev/figwheel_tasks/core.clj
+++ plugin/dev/figwheel_tasks/core.clj
@@ -1,6 +1,7 @@
 (ns figwheel-tasks.core
   (:require [clojure.java.io :as io]
-            [clojure.string :as string]))
+            [clojure.string :as string]
+            [clojure.java.shell :as shell]))

 (defn internal-version [version line]
   (if (.contains line "def _figwheel-version_")
@@ -45,8 +46,14 @@
                  "../support/src/figwheel/client.cljs"]]
     (chg-file-version internal-version version file)))

+(defn install-all []
+  (doseq [dir ["../support" "../sidecar" "./"]]
+    (-> (shell/sh "lein" "install" :dir dir) :out println)
+    (flush)))
+
 #_(change-version "AAAAAAAAAAAAA")

 (defn -main [command & args]
   (condp = command
-    :change-version (change-version (first args))))
+    ":change-version" (change-version (first args))
+    ":install-all" (install-all)))


add scheduler

add scheduler

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

--- src/ceres_collector/scheduler.clj
+++ src/ceres_collector/scheduler.clj
@@ -0,0 +1,173 @@
+(ns ceres-collector.scheduler
+  (:require [clojurewerkz.quartzite.scheduler :as qs]
+            [clojurewerkz.quartzite.triggers :as t]
+            [clojurewerkz.quartzite.jobs :as j]
+            [clojurewerkz.quartzite.conversion :as qc]
+            [clojurewerkz.quartzite.jobs :refer [defjob]]
+            [clojurewerkz.quartzite.schedule.daily-interval :refer [schedule time-of-day every-day starting-daily-at ending-daily-at]]
+            [ceres-collector.db :as db]
+            [taoensso.timbre :as timbre]))
+
+(timbre/refer-timbre)
+
+(defjob HtmlsBackup [ctx]
+  (let [path (get (qc/from-job-data ctx) "folder-path")]
+      (info "Writing htmls backup...")
+    (db/backup-yesterday "athena" "htmls" path)))
+
+(defjob TweetBackup [ctx]
+  (let [path (get (qc/from-job-data ctx) "folder-path")]
+      (info "Writing tweets backup...")
+      (db/backup-yesterday "athena" "tweets" path)))
+
+(defjob ReactionsBackup [ctx]
+  (let [path (get (qc/from-job-data ctx) "folder-path")]
+      (info "Writing reactions backup...")
+    (db/backup-yesterday "athena" "reactions" path)))
+
+(defjob PubsBackup [ctx]
+  (let [path (get (qc/from-job-data ctx) "folder-path")]
+      (info "Writing publications backup...")
+    (db/backup-yesterday "athena" "publications" path)))
+
+(defjob UrlsBackup [ctx]
+  (let [path (get (qc/from-job-data ctx) "folder-path")]
+      (info "Writing urls backup...")
+      (db/backup-yesterday "athena" "urls" path)))
+
+(defjob UsersBackup [ctx]
+  (let [path (get (qc/from-job-data ctx) "folder-path")]
+      (info "Writing users backup...")
+    (db/backup-yesterday "athena" "users" path)))
+
+(defjob MentionsBackup [ctx]
+  (let [path (get (qc/from-job-data ctx) "folder-path")]
+      (info "Writing mentions backup...")
+    (db/backup-yesterday "athena" "mentions" path)))
+
+;; Schedules
+
+(defn tweets-backup-schedule
+  "Create a schedule to backup the tweets at 3 am"
+  [path]
+  (let [job (j/build
+             (j/of-type TweetBackup)
+             (j/using-job-data {"folder-path" path})
+             (j/with-identity (j/key "jobs.tweetsbackup.1")))
+        tk (t/key "triggers.1")
+        trigger (t/build
+                 (t/with-identity tk)
+                 (t/start-now)
+                 (t/with-schedule
+                   (schedule
+                    (every-day)
+                    (starting-daily-at (time-of-day 3 00 00))
+                    (ending-daily-at (time-of-day 3 00 01)))))]
+    (qs/schedule job trigger)))
+
+
+(defn htmls-backup-schedule
+  "Create a schedule to backup the htmls at 3.05 am"
+  [path]
+  (let [job (j/build
+             (j/of-type HtmlsBackup)
+             (j/using-job-data {"folder-path" path})
+             (j/with-identity (j/key "jobs.htmlsbackup.1")))
+        tk (t/key "triggers.2")
+        trigger (t/build
+                 (t/with-identity tk)
+                 (t/start-now)
+                 (t/with-schedule
+                   (schedule
+                    (every-day)
+                    (starting-daily-at (time-of-day 3 05 00))
+                    (ending-daily-at (time-of-day 3 05 01)))))]
+    (qs/schedule job trigger)))
+
+
+(defn reactions-backup-schedule
+  "Create a schedule to backup the reactions at 3.10 am"
+  [path]
+  (let [job (j/build
+             (j/of-type ReactionsBackup)
+             (j/using-job-data {"folder-path" path})
+             (j/with-identity (j/key "jobs.reactionsbackup.1")))
+        tk (t/key "triggers.3")
+        trigger (t/build
+                 (t/with-identity tk)
+                 (t/start-now)
+                 (t/with-schedule
+                   (schedule
+                    (every-day)
+                    (starting-daily-at (time-of-day 3 10 00))
+                    (ending-daily-at (time-of-day 3 10 01)))))]
+    (qs/schedule job trigger)))
+
+
+(defn pubs-backup-schedule
+  "Create a schedule to backup the reactions at 3.15 am"
+  [path]
+  (let [job (j/build
+             (j/of-type PubsBackup)
+             (j/using-job-data {"folder-path" path})
+             (j/with-identity (j/key "jobs.pubsbackup.1")))
+        tk (t/key "triggers.4")
+        trigger (t/build
+                 (t/with-identity tk)
+                 (t/start-now)
+                 (t/with-schedule
+                   (schedule
+                    (every-day)
+                    (starting-daily-at (time-of-day 3 15 00))
+                    (ending-daily-at (time-of-day 3 15 01)))))]
+    (qs/schedule job trigger)))
+
+
+(defn urls-backup-schedule
+  "Create a schedule to backup the reactions at 3.15 am"
+  [path]
+  (let [job (j/build
+             (j/of-type UrlsBackup)
+             (j/using-job-data {"folder-path" path})
+             (j/with-identity (j/key "jobs.urlsbackup.1")))
+        tk (t/key "triggers.5")
+        trigger (t/build
+                 (t/with-identity tk)
+                 (t/start-now)
+                 (t/with-schedule
+                   (schedule
+                    (every-day)
+                    (starting-daily-at (time-of-day 3 20 00))
+                    (ending-daily-at (time-of-day 3 20 01)))))]
+    (qs/schedule job trigger)))
+
+(defn users-backup-schedule
+  "Create a schedule to backup the reactions at 3.15 am"
+  [path]
+  (let [job (j/build
+             (j/of-type UsersBackup)
+             (j/using-job-data {"folder-path" path})
+             (j/with-identity (j/key "jobs.usersbackup.1")))
+        tk (t/key "triggers.6")
+        trigger (t/build
+                 (t/with-identity tk)
+                 (t/start-now)
+                 (t/with-schedule
+                   (schedule
+                    (every-day)
+                    (starting-daily-at (time-of-day 3 25 00))
+                    (ending-daily-at (time-of-day 3 25 01)))))]
+    (qs/schedule job trigger)))
+
+
+(defn start-executor
+  "Run the schedules"
+  [path]
+  (qs/initialize)
+  (qs/start)
+  (tweets-backup-schedule path)
+  (htmls-backup-schedule path)
+  (reactions-backup-schedule path)
+  (pubs-backup-schedule path)
+  (urls-backup-schedule path)
+  )


[EN] Rename locals to make them clearer.

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


[WM] explain purpose of memoize-async's 3rd arg


More test

More test

error: pathspec 'test/cljc/spec_tools/spec_test.cljc' did not match any file(s) known to git

--- test/cljc/spec_tools/spec_test.cljc
+++ test/cljc/spec_tools/spec_test.cljc
@@ -0,0 +1,52 @@
+(ns spec-tools.spec-test
+  (:require [clojure.test :refer [deftest are]]
+            [spec-tools.spec :as spec]))
+
+(deftest specs-test
+  (are [spec pred]
+    (= (:spec spec) pred)
+    spec/any? clojure.core/any?
+    spec/some? clojure.core/some?
+    spec/number? clojure.core/number?
+    spec/integer? clojure.core/integer?
+    spec/int? clojure.core/int?
+    spec/pos-int? clojure.core/pos-int?
+    spec/neg-int? clojure.core/neg-int?
+    spec/nat-int? clojure.core/nat-int?
+    spec/float? clojure.core/float?
+    spec/double? clojure.core/double?
+    spec/boolean? clojure.core/boolean?
+    spec/string? clojure.core/string?
+    spec/ident? clojure.core/ident?
+    spec/simple-ident? clojure.core/simple-ident?
+    spec/qualified-ident? clojure.core/qualified-ident?
+    spec/keyword? clojure.core/keyword?
+    spec/simple-keyword? clojure.core/simple-keyword?
+    spec/qualified-keyword? clojure.core/qualified-keyword?
+    spec/symbol? clojure.core/symbol?
+    spec/simple-symbol? clojure.core/simple-symbol?
+    spec/qualified-symbol? clojure.core/qualified-symbol?
+    spec/uuid? clojure.core/uuid?
+    ;#?(:clj spec/uri? clojure.core/uri?)
+    ;#?(:clj spec/bigdec? clojure.core/bigdec?)
+    spec/inst? clojure.core/inst?
+    spec/seqable? clojure.core/seqable?
+    spec/indexed? clojure.core/indexed?
+    spec/map? clojure.core/map?
+    spec/vector? clojure.core/vector?
+    spec/list? clojure.core/list?
+    spec/seq? clojure.core/seq?
+    spec/char? clojure.core/char?
+    spec/set? clojure.core/set?
+    spec/nil? clojure.core/nil?
+    spec/false? clojure.core/false?
+    spec/true? clojure.core/true?
+    spec/zero? clojure.core/zero?
+    ;#?(:clj spec/rational? clojure.core/rational?)
+    spec/coll? clojure.core/coll?
+    spec/empty? clojure.core/empty?
+    spec/associative? clojure.core/associative?
+    spec/sequential? clojure.core/sequential?
+    ;#?(:clj spec/ratio? clojure.core/ratio?)
+    ;#?(:clj spec/bytes? clojure.core/bytes?)
+    ))


Run schema checks after all events

Run schema checks after all events

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/sashton/duct-tape.git/'


Adding functions for counting engaged users

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


Little bit of database code

Little bit of database code

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

--- src/sweng_hw6_grader/database.clj
+++ src/sweng_hw6_grader/database.clj
@@ -0,0 +1,4 @@
+(ns sweng-hw6-grader.database
+  (:use korma.db))
+
+(defdb db (postgres {:db "swenghw6grader"}))


Fix voting-id instructions import again

Fix voting-id instructions import again

This time I'm making it add each translation, not clobber what's there already.

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


Basic REST API handler

Basic REST API handler

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

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -0,0 +1,53 @@
+;
+;  (C) Copyright 2016  Pavel Tisnovsky
+;
+;  All rights reserved. This program and the accompanying materials
+;  are made available under the terms of the Eclipse Public License v1.0
+;  which accompanies this distribution, and is available at
+;  http://www.eclipse.org/legal/epl-v10.html
+;
+;  Contributors:
+;      Pavel Tisnovsky
+;
+
+(ns emender-jenkins.rest-api)
+
+(require '[ring.util.response           :as http-response])
+(require '[clojure.pprint               :as pprint])
+(require '[clojure.data.json            :as json])
+
+(require '[emender-jenkins.file-utils   :as file-utils])
+(require '[emender-jenkins.results      :as results])
+(require '[emender-jenkins.config       :as config])
+
+(defn read-request-body
+    [request]
+    (file-utils/slurp- (:body request)))
+
+(defn body->results
+    [body]
+    (json/read-str body))
+
+(defn body->test-info
+    [body]
+    (json/read-str body :key-fn clojure.core/keyword))
+
+(defn send-response
+    [response]
+    (-> (http-response/response (json/write-str response))
+        (http-response/content-type "application/json")))
+
+(defn info-handler
+    [request hostname]
+    (let [response {:toasterNotifications [(str "info|Api response|Emender Service api v1 on
" hostname)]
+                    :configuration (:configuration request)}]
+        (send-response response)))
+
+(defn unknown-call-handler
+    [uri method]
+    (let [response {:status :error
+                    :error "Unknown API call"
+                    :uri uri
+                    :method method}]
+        (send-response response)))
+


Ignore empty headers

Ignore empty headers

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


Remove idiotic error.

Remove idiotic error.

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


Create resource.clj

Create resource.clj

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


correctly diffs service properties

correctly diffs service properties


32 luzerako tokena sortu

32 luzerako tokena sortu

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


microbench experiments WIP

microbench experiments WIP

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


location test stub

location test stub

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


Update documentation for library.browser.history.

--- src/cljs/library/browser/history.cljs
+++ src/cljs/library/browser/history.cljs
@@ -1,4 +1,5 @@
-(ns ^{:doc "Wraps Google Closure's history functionality."}
+(ns ^{:doc "Supports working with Google Closure's history management
+  object."}
   library.browser.history
   (:require [clojure.browser.event :as event]
             [goog.History :as history]))
@@ -15,6 +16,16 @@
            (js->clj goog.history.EventType)))))

 (defn history
+  "Create a new history object in user visible mode. This allows users
+  to, for example, hit the browser's back button without leaving the
+  current page. The current history state is shown in the browser
+  address bar as a document location fragment (the portion of the URL
+  after the '#'). These addresses can be bookmarked, copied and pasted
+  into another browser, and modified directly by the user like any
+  other URL.
+
+  Any changes to the location hash will call the passed callback
+  function."
   [callback]
   (let [h (goog.History.)]
     (do (event/listen h "navigate"
@@ -26,6 +37,8 @@
         h)))

 (defn set-token
+  "Sets the history state. The URL fragment will be set to the
+  provided token."
   [history token]
   (.setToken history (name token)))


upgrade authentication check middleware to validate that session user `is_active = true` and session age is less than max-session-age

--- src/metabase/middleware/auth.clj
+++ src/metabase/middleware/auth.clj
@@ -1,6 +1,7 @@
 (ns metabase.middleware.auth
   "Middleware for dealing with authentication and session management."
-  (:require [korma.core :refer :all]
+  (:require [korma.core :as korma]
+            [metabase.config :as config]
             [metabase.db :refer [sel]]
             [metabase.api.common :refer [*current-user* *current-user-id*]]
             (metabase.models [session :refer [Session]]
@@ -9,6 +10,8 @@

 (def SESSION_COOKIE "metabase.SESSION_ID")
 (def SESSION_HEADER "x-metabase-session")
+
+(def response-unauthentic {:status 401 :body "Unauthenticated"})

 (defn wrap-sessionid
@@ -34,11 +37,18 @@
    NOTE: we are purposely not associating the full current user object here so that we can be modular."
   [handler]
   (fn [{:keys [metabase-sessionid] :as request}]
-    (if-let [session (sel :one Session :id metabase-sessionid)]
-      ;; TODO - enforce session expiration
-      ;; TODO - validate user is_active?
-      (handler (assoc request :metabase-userid (:user_id session)))
-      {:status 401 :body "Unauthenticated"})))
+    ;; TODO - what kind of validations can we do on the sessionid to make sure it's safe to handle?  str?  alphanumeric?
+    (let [session (first (korma/select Session
+                           ;; NOTE: we join with the User table and ensure user.is_active = true
+                           (korma/with User (korma/where {:is_active true}))
+                           (korma/fields :created_at)
+                           (korma/where {:id metabase-sessionid})))
+          session-age (- (System/currentTimeMillis) (.getTime (get session :created_at (java.util.Date. 0))))]
+      ;; If the session exists and is not expired (max-session-age > session-age) then validation is good
+      (when (and session (> (:max-session-age config/app-defaults) session-age))
+        (handler (assoc request :metabase-userid (:user_id session))))
+      ;; default response is 401
+      response-unauthentic)))

 (defmacro sel-current-user [current-user-id]


mesos.framework: logging

mesos.framework: logging

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


Add data link type utility

Add data link type utility

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

--- src/clojure_pf/data_link_type.clj
+++ src/clojure_pf/data_link_type.clj
@@ -0,0 +1,17 @@
+(ns clojure-pf.data-link-type
+  "Supported data link type level codes."
+  (:require [clojure.set :refer [map-invert]]))
+
+(def ^:private ^:const dlt-map
+  {:null      0     ; no link-layer encapsulation
+   :en10mb    1     ; ethernet (10Mb)
+   :ieee80211 105}) ; IEEE 802.11 wireless
+
+(def ^:private ^:const code-map
+  (map-invert dlt-map))
+
+(defn to-code [dlt]
+  (get dlt-map dlt))
+
+(defn from-code [code]
+  (get code-map code))


added delete button

added delete button

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/talexand/velcro-notes.git/'


Helper HTML namespace.

Helper HTML namespace.

error: pathspec 'src/plugboard/webfunction/html.clj' did not match any file(s) known to git

--- src/plugboard/webfunction/html.clj
+++ src/plugboard/webfunction/html.clj
@@ -0,0 +1,13 @@
+(ns plugboard.webfunction.html)
+
+(defmulti table type)
+(defmethod table clojure.lang.IPersistentMap
+  [m]
+  (vec
+   (concat
+    [:table {:border 2}]
+    (map (fn [[k v]]
+           (vector :tr [:td (str k)] [:td (str v)]))
+         (seq m))))
+  )
+


add version tests

add version tests

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

--- test/cake/tasks/version_test.clj
+++ test/cake/tasks/version_test.clj
@@ -0,0 +1,57 @@
+(ns cake.tasks.version-test
+  (:use clojure.test helpers
+	[cake.file :only [file]])
+  (:require [clojure.java.io :as io]))
+
+(defn version-wrap [f]
+  (cake "version" "0.1.0-SNAPSHOT")
+  (f)
+  (cake "version" "0.1.0-SNAPSHOT"))
+
+(use-fixtures :once in-test-project)
+(use-fixtures :each version-wrap)
+
+(defn assert-version [expected & [task-output]]
+  (let [results (cake "version")]
+    (testing "in current results from 'cake version'"
+      (is (= (str "test-example " expected "\n")
+	     (:out results))))
+    (testing "in defproject contents"
+      (is (= (str "(defproject test-example \"" expected "\"")
+	     (first (line-seq (io/reader (file "project.clj")))))))
+    (when task-output
+      (testing "in output of called task"
+	(is (re-matches (re-pattern (str ".*-> test-example " expected "\n"))
+			(:out task-output)))))))
+
+(deftest initial-version
+  (testing "initial version is set to 0.1.0-SNAPSHOT by fixture"
+    (assert-version "0.1.0-SNAPSHOT")))
+
+(deftest explicit-version
+  (testing "version set to 2.0.0"
+    (let [results (cake "version" "2.0.0")]
+      (assert-version "2.0.0"))))
+
+(deftest version-bumping-test
+  (testing "version set with cake version bump"
+    (let [results (cake "version" "bump")]
+      (assert-version "0.1.0" results)))
+  (testing "version set with cake version bump --major"
+    (let [results (cake "version" "bump" "--major")]
+      (assert-version "1.1.0" results)))
+  (testing "version set with cake version bump --minor"
+    (let [results (cake "version" "bump" "--minor")]
+      (assert-version "1.2.0" results)))
+  (testing "version set with cake version bump --patch"
+    (let [results (cake "version" "bump" "--patch")]
+      (assert-version "1.2.1" results)))
+  (testing "version set with cake version bump --major --patch"
+    (let [results (cake "version" "bump" "--major" "--patch")]
+      (assert-version "2.2.2" results)))
+  (testing "version set with cake version bump --snapshot"
+    (let [results (cake "version" "bump" "--snapshot")]
+      (assert-version "2.2.2-SNAPSHOT" results)))
+  (testing "version set with cake version bump --major --snapshot"
+    (let [results (cake "version" "bump" "--major" "--snapshot")]
+      (assert-version "3.2.2-SNAPSHOT" results))))


Problem 0113.

Problem 0113.

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

--- src/project_euler/problem_0113.clj
+++ src/project_euler/problem_0113.clj
@@ -0,0 +1,59 @@
+(ns project-euler.problem_0113)
+
+;; Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number;
+;; for example, 134468.
+
+;; Similarly if no digit is exceeded by the digit to its right it is called a decreasing number;
+;; for example, 66420.
+
+;; We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number;
+;; for example, 155349.
+
+;; As n increases, the proportion of bouncy numbers below n increases such that
+;; there are only 12951 numbers below one-million that are not bouncy
+;; and only 277032 non-bouncy numbers below 10^10.
+
+;; How many numbers below a googol (10^100) are not bouncy?
+
+
+(defn add-one-digit-and-count [last-d [n-inc n-eq n-dec]]
+  (->> (range 10)
+       (map (fn [d]
+              (cond (< d last-d) [0              0    (+ n-dec n-eq)]
+                    (> d last-d) [(+ n-inc n-eq) 0    0             ]
+                    :else        [n-inc          n-eq n-dec         ]
+                    )))
+       ))
+
+(defn add-counts [cnts1 cnts2]
+  (map (fn [[x1 y1 z1] [x2 y2 z2]] [(+ x1 x2) (+ y1 y2) (+ z1 z2)])
+       cnts1
+       cnts2))
+
+(def init-counts
+  (->> (range 10)
+       (map (fn [d] (if (zero? d) [0 0 0] [0 1 0])))
+       (vec)
+       ))
+
+(def zero-counts
+  (->> (range 10)
+       (map (fn [d] [0 0 0]))
+       (vec)))
+
+(defn update-counts [cnts]
+  (reduce add-counts
+          zero-counts
+          (->> (range 10)
+               (map (fn [last-d] (add-one-digit-and-count last-d (nth cnts last-d))))
+               )
+          ))
+
+(defn solution []
+  (->> (iterate update-counts init-counts)
+       (take 100)
+       (flatten)
+       (reduce +)
+       ))
+
+;;-> 51161058134250


adding example for a one bar looping sequencer

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

--- test/example/one_bar_sequencer.clj
+++ test/example/one_bar_sequencer.clj
@@ -0,0 +1,31 @@
+(ns example.one-bar-sequencer
+  (:use overtone.live))
+
+(def metro (metronome 128))
+
+; Our bar is a map of beat to instruments to play
+
+(def bar {0   [kick]
+          0.5 [c-hat]
+          1   [kick snare]
+          1.5 [c-hat]
+          2   [kick]
+          2.5 [c-hat]
+          3   [kick snare]
+          3.5 [c-hat]})
+
+; For every tick of the metronome, we loop through all our beats
+; and find the apropriate one my taking the metronome tick mod 4.
+; Then we play all the instruments for that beat.
+
+(defn player
+  [tick]
+  (dorun
+    (for [k (keys bar)]
+      (let [beat (Math/floor k)
+            offset (- k beat)]
+           (if (= 0 (mod (- tick beat) 4))
+               (let [instruments (bar k)]
+                    (dorun
+                      (for [instrument instruments]
+                         (at (metro (+ offset tick)) (instrument))))))))))


seed orders

seed orders

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


Version 0.4.0-SNAPSHOT

Version 0.4.0-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject lein-droid/lein-droid "0.3.6-SNAPSHOT"
+(defproject lein-droid/lein-droid "0.4.0-SNAPSHOT"
   :description "Plugin for easy Clojure/Android development and deployment"
   :url "https://github.com/clojure-android/lein-droid"
   :license {:name "Eclipse Public License"


preparation for release

preparation for release

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


cljs and figwheel versions

cljs and figwheel versions

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


Revert "version upgrade"

Revert "version upgrade"

This reverts commit d0dc1fb831a4423106ad791eed450087c5cb4551.

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/meandor/aim-pipeline.git/'


Adding nippy to development dependencies.

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


Release version 0.2.4

Release version 0.2.4

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


avoid lein warning 'Implicit AOT of :main'

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


Update deps to latest

Update deps to latest

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


Remove base java-agents

Remove base java-agents

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


add improved version

add improved version

error: pathspec '004-clojure-game-of-life/team1/src/coderetreat_sandbox/gol-improved.clj' did not match any file(s) known to git

--- 004-clojure-game-of-life/team1/src/coderetreat_sandbox/gol-improved.clj
+++ 004-clojure-game-of-life/team1/src/coderetreat_sandbox/gol-improved.clj
@@ -0,0 +1,48 @@
+(ns coderetreat-sandbox.gol-improved)
+
+(defn rules
+  [state no-of-neighbours]
+  (or
+    (and (= state :alive)
+         (<= 2 no-of-neighbours 3))
+    (and (= state :dead)
+         (= no-of-neighbours 3))))
+
+(defn get-state
+  [location world]
+  (if (contains? world location)
+    :alive
+    :dead))
+
+(defn get-neighbours-coords
+  [[x y]]
+  (for
+    [dx [-1 0 1]
+     dy [-1 0 1]
+     :when (not (= dx dy 0))]
+    [(+ x dx)
+     (+ y dy)]))
+
+(defn rules-for-world
+  [world]
+  (fn
+    [[location count]]
+    (let
+      [state (get-state location world)]
+      (if (rules state count)
+        location
+        nil))))
+
+(defn next-step
+  [world]
+  (let
+    [counts (->> world
+                 (map get-neighbours-coords)
+                 (apply concat)
+                 frequencies)
+     rules (rules-for-world world)]
+
+    (->> counts
+         (filter #(rules %1))
+         (map first)
+         (into #{}))))


Stringify header keys

Stringify header keys


Reaper: reload service correctly when :keep-keys changes.

Fixes #173

--- src/riemann/core.clj
+++ src/riemann/core.clj
@@ -210,7 +210,7 @@
    (let [interval  (* 1000 (or interval 10))
          keep-keys (get opts :keep-keys [:host :service])]
      (service/thread-service
-       ::reaper interval
+       ::reaper [interval keep-keys]
        (fn worker [core]
          (Thread/sleep interval)


Require riemann.streams, folds, test/io, test/tap in tests.

--- src/riemann/test.clj
+++ src/riemann/test.clj
@@ -172,7 +172,9 @@
   (let [old-ns (ns-name *ns*)
         new-ns (symbol (str old-ns "-test"))]
     `(do (ns ~new-ns
-           ~'(:require [riemann.test :refer [deftest inject!]]
+           ~'(:require [riemann.test :refer [deftest inject! io tap]]
+                       [riemann.streams :refer :all]
+                       [riemann.folds :as folds]
                        [clojure.test :refer [is are]]))
          ~@body
          (ns ~old-ns))))


add server util

add server util

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

--- src/server/util.cljs
+++ src/server/util.cljs
@@ -0,0 +1,20 @@
+(ns server.util)
+
+(defn log
+  "Log a Clojure thing."
+  [thing]
+  (.log js/console (pr-str thing)))
+
+(defn js-log
+  "Log a JavaScript thing."
+  [js-thing]
+  (.log js/console js-thing))
+
+(defn- now []
+  (.toTimeString (js/Date.)))
+
+;; TODO: better timestamp format here
+(defn tlog
+  "Timestampped log."
+  [msg]
+  (js-log (str (now) " - " msg)))


Fix http uploads saving promoted file

Fix http uploads saving promoted file

Previously the http uploads would save the file and then check
if it could update the database. That would cause an error to be
returned since promoted artifacts should be immutable.  The
classic repo would then have a pom with a possible checksum error
and be out of sync with the releases repo.

--- src/clojars/repo.clj
+++ src/clojars/repo.clj
@@ -43,22 +43,26 @@
                           :version version}
                     file (io/file (config :repo) group
                                   artifact version filename)]
-                (try
-                  (if (.endsWith filename ".pom")
-                    (let [contents (slurp body)
-                          pom-info (merge (maven/pom-to-map
-                                           (StringReader. contents)) info)]
+                (if (.endsWith filename ".pom")
+                  (let [contents (slurp body)
+                        pom-info (merge (maven/pom-to-map
+                                         (StringReader. contents)) info)]
+                    (if (find-jar groupname artifact version)
+                      (update-jar account pom-info)
+                      (add-jar account pom-info))
+                    (try
                       (save-to-file file contents)
-                      (if (find-jar groupname artifact version)
-                        (update-jar account pom-info)
-                        (add-jar account pom-info)))
-                    (do
+                      (catch java.io.IOException e
+                        (.delete file)
+                        (throw e))))
+                  (do
+                    (when-not (find-jar groupname artifact version)
+                      (add-jar account info))
+                    (try
                       (save-to-file file body)
-                      (when-not (find-jar groupname artifact version)
-                        (add-jar account info))))
-                  (catch java.io.IOException e
-                    (.delete file)
-                    (throw e))))
+                      (catch java.io.IOException e
+                        (.delete file)
+                        (throw e))))))
               {:status 201 :headers {} :body nil}
               (catch Exception e
                 (pst e)


Add user to sms-form log messages

Add user to sms-form log messages

Makes it easier to trace the transaction for a given user.

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


CMR-4467 - Added provider-id & new constraints to metadata-db.

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

--- metadata-db-app/src/migrations/064_add_provider_id_to_services_table.clj
+++ metadata-db-app/src/migrations/064_add_provider_id_to_services_table.clj
@@ -0,0 +1,54 @@
+(ns migrations.064-add-provider-id-to-services-table
+  "Adds `provider_id` column to services table."
+  (:require
+   [clojure.java.jdbc :as j]
+   [cmr.metadata-db.services.provider-validation :as provider-validation]
+   [config.mdb-migrate-helper :as h]))
+
+(defn- drop-old-constraint
+  []
+  (h/sql
+   "ALTER TABLE METADATA_DB.cmr_services DROP CONSTRAINT services_con_rev"))
+
+(defn- add-new-constraint
+  []
+  (h/sql (str "ALTER TABLE METADATA_DB.cmr_services "
+              "ADD CONSTRAINT services_con_p_n_r "
+              "UNIQUE (native_id, revision_id, provider_id) "
+              "USING INDEX (CREATE UNIQUE INDEX services_idx_p_n_r "
+              "ON cmr_services (provider_id, native_id, revision_id))")))
+
+(defn- drop-new-constraint
+  []
+  (h/sql
+   "ALTER TABLE METADATA_DB.cmr_services DROP CONSTRAINT services_con_p_n_r"))
+
+(defn- re-add-old-constraint
+  []
+  (h/sql (str "ALTER TABLE METADATA_DB.cmr_services "
+              "ADD CONSTRAINT services_con_rev "
+              "UNIQUE (native_id, revision_id) "
+              "USING INDEX (CREATE UNIQUE INDEX services_ucr_i "
+              "ON cmr_services (native_id, revision_id))")))
+
+(defn up
+  "Migrates the database up from version 63 to 64."
+  []
+  (println "migrations.064-add-provider-id-to-services-table up...")
+  ;; At this point in time, UMM-Services support is still being developed, so we
+  ;; don't care about what's in the database right now, and the new field can't
+  ;; be null, so:
+  (h/sql "TRUNCATE TABLE METADATA_DB.cmr_services")
+  (h/sql (format (str "ALTER TABLE METADATA_DB.cmr_services "
+                      "ADD provider_id VARCHAR(%s) NOT NULL")
+                 provider-validation/PROVIDER_ID_MAX_LENGTH))
+  (drop-old-constraint)
+  (add-new-constraint))
+
+(defn down
+  "Migrates the database down from version 64 to 63."
+  []
+  (println "migrations.064-add-provider-id-to-services-table down...")
+  (drop-new-constraint)
+  (re-add-old-constraint)
+  (h/sql "ALTER TABLE METADATA_DB.cmr_services DROP COLUMN provider_id"))


Start building out discovered app conf

Start building out discovered app conf

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


Basic details view.

Basic details view.

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

--- src/cljs/hatti/views/details.cljs
+++ src/cljs/hatti/views/details.cljs
@@ -0,0 +1,35 @@
+(ns hatti.views.details
+   (:require-macros [cljs.core.async.macros :refer [go]])
+   (:require [om.core :as om :include-macros true]
+             [sablono.core :as html :refer-macros [html]]
+             [hatti.views :refer [form-details details-page]]))
+
+(defmethod form-details :default
+  [form owner]
+  "Form section of the Details page, very basic."
+  (om/component
+   (let [{:keys [title description downloadable id_string editing?]} form]
+     (html
+      [:form {:id "settings-form" :class "pure-form pure-form-aligned" }
+       [:fieldset
+        [:div.pure-control-group
+         [:label "Name"]
+         [:span {:class "detail-form-name"} title]]
+        [:div.pure-control-group
+         [:label "Description"]
+         [:span {:class "detail-form-description"} description]]
+        [:div.pure-control-group
+         [:label "Form ID"]
+         [:span {:class "detail-form-id"} id_string]]
+        [:div.pure-control-group
+         [:label {:for "form-status"} "Status"]
+         [:span {:class "detail-form-active"}
+          (if downloadable "Active" "Inactive")]]]]))))
+
+(defmethod details-page :default
+  [{:keys [dataset-info]} owner]
+  "Om component for the whole details page."
+  (om/component
+   (html
+    [:div.container
+     (om/build form-details dataset-info)])))


more notes

more notes

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


updated to iterate over the pixel array

updated to iterate over the pixel array

--- src/gif_to_html/convert.clj
+++ src/gif_to_html/convert.clj
@@ -8,23 +8,20 @@
 (def ascii [\# \@ \O \% \$ \i \o \c \* \; \: \+ \! \^ \' \- \. \space])
 (def max-items (dec (count ascii)))

-(defn ascii-color [^BufferedImage img ^Integer y ^Integer x]
-  (let [pixel (.getRGB img x y)
-        r (bit-and (bit-shift-right pixel 16) 0x000000FF)
+(defn pixel->ascii [^Integer pixel]
+  (let [r (bit-and (bit-shift-right pixel 16) 0x000000FF)
         g (bit-and (bit-shift-right pixel 8) 0x000000FF)
         b (bit-and pixel 0x000000FF)
         max-color (Math/sqrt (+ (* r r 0.241) (* g g 0.691) (* b b 0.068)))
         idx (if (zero? max-color) max-items (int (* max-items (/ max-color 255))))]
     (nth ascii (max idx 0))))

-(defn to-ascii [^BufferedImage img ^Integer size]
-  (let [width  (.getWidth img)
-        height (.getHeight img)
-        sb     (StringBuilder. size)]
-    (dotimes [y height]
-      (dotimes [x width]
-        (.append sb (ascii-color img y x)))
-      (.append sb \newline))
+(defn to-ascii [^BufferedImage img ^Integer w ^Integer h]
+  (let [^ints pixels (.. img getRaster getDataBuffer getData)
+        sb (StringBuilder. (int (+ h (* h w))))]
+    (dotimes [i (count pixels)]
+      (.append sb (pixel->ascii (aget pixels i)))
+      (when (zero? (mod i w)) (.append sb \newline)))
     (.toString sb)))

 (defn scale [a b]
@@ -62,7 +59,7 @@
                   [:pre
                    {:id (str "frame-" i)
                     :style "font-size:5pt;line-height:5pt;letter-spacing:1px;font-weight:bold;display:none;font-family:monospace;"}
-                   (to-ascii (scale-image (.read ^ImageReader rdr i) w h) (+ h (* h w)))])
+                   (to-ascii (scale-image (.read ^ImageReader rdr i) w h) w h)])
                (range frame-count))])
        :delay  (* 10 (if (pos? frame-delay) frame-delay 10))
        :frames frame-count})))


added Figwheel repl script

added Figwheel repl script

error: pathspec 'cljx/plongeur-cljs/script/fig_repl.clj' did not match any file(s) known to git

--- cljx/plongeur-cljs/script/fig_repl.clj
+++ cljx/plongeur-cljs/script/fig_repl.clj
@@ -0,0 +1,3 @@
+; cmd-shift L to load in REPL
+(use 'figwheel-sidecar.repl-api)
+(cljs-repl)


Make check-field a bit more nuanced in what it's looking for.

--- src/clojars/promote.clj
+++ src/clojars/promote.clj
@@ -27,8 +27,8 @@
     (conj blockers "Snapshot versions cannot be promoted")
     blockers))

-(defn check-field [blockers info field]
-  (if (field info)
+(defn check-field [blockers info field pred]
+  (if (pred (field info))
     blockers
     (conj blockers (str "Missing " (name field)))))

@@ -41,7 +41,7 @@
     (let [{:keys [exit out err]} (sh/sh "gpg" "--homedir" temp-home
                                         "--verify" (str sig-file) (str file))]
       (doseq [f (reverse (file-seq (io/file temp-home)))] (.delete f))
-      (zero? exit))))
+      (or (zero? exit) (println "GPG error:" out "\n" err)))))

 (defn signed? [blockers file keys]
   (let [sig-file (str file ".asc")]
@@ -66,23 +66,21 @@
         info (try (maven/pom-to-map pom)
                   (catch Exception e
                     (.printStackTrace e) {}))]
-    ;; TODO: convert this to a lazy seq for cheaper qualification checks
     (-> []
         (check-version version)
         (check-file jar)
         (check-file pom)

-        ;; TODO: check contents, not just presence
-        (check-field info :description)
-        (check-field info :url)
-        (check-field info :licenses)
-        (check-field info :scm)
+        (check-field info :description (complement empty?))
+        (check-field info :url (partial re-find #"http:"))
+        (check-field info :licenses seq)
+        (check-field info :scm identity)

         (signed? jar keys)
         (signed? pom keys)
         (unpromoted? info))))

-(def releases {:url "s3://clojars/releases/"
+(def releases {:url (config :releases-url)
                :username (config :releases-access-key)
                :passphrase (config :releases-secret-key)})


Formatting

Formatting

--- tests/test_core.cljx
+++ tests/test_core.cljx
@@ -76,7 +76,9 @@
     #+clj
     (testing "It can lift a function to a Monad Transformer"
       (let [maybe-sequence-monad (maybe/maybe-transformer sequence-monad)]
-        (is (= [(maybe/just 1) (maybe/just 2) (maybe/just  3) (maybe/just  4) (maybe/just  5) (maybe/just 6)]
+        (is (= [(maybe/just 1) (maybe/just 2)
+                (maybe/just 3) (maybe/just 4)
+                (maybe/just 5) (maybe/just 6)]
                (m/with-monad maybe-sequence-monad
                  (monad+ [(maybe/just 0) (maybe/just 2) (maybe/just 4)]
                          [(maybe/just 1) (maybe/just 2)]))))))))


Don't require core.async

Don't require core.async

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/dignati/om-charts.git/'


remaning file added to the repo

remaning file added to the repo

error: pathspec 'src/clj/hellhound/system/core.clj' did not match any file(s) known to git

--- src/clj/hellhound/system/core.clj
+++ src/clj/hellhound/system/core.clj
@@ -0,0 +1,18 @@
+(ns hellhound.system.core
+  "All the functions for managing system state live in this namespace")
+
+
+;; Main storage for system data.
+(def system (atom {}))
+
+(defn get-system
+  []
+  @system)
+
+(defn update-system!
+  [fn]
+  (swap! system fn))
+
+(defn reset-system!
+  [value]
+  (reset! system value))


use pred-cond to eliminate final condp's

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


normals!

normals!

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


Log translate response

Log translate response

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/lobodin/slack-translate.git/'


[EN] Enhance start-event-handler!

[EN] Enhance start-event-handler!

We may want to know when and why the message handler thread
stopped. start-event-handler! now returns a channel that signals why it
stopped when it stops.

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


New module: git-utils

New module: git-utils

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

--- src/emender_service/git_utils.clj
+++ src/emender_service/git_utils.clj
@@ -0,0 +1,73 @@
+(ns emender-service.git-utils)
+
+(require '[clj-jgit.porcelain         :as jgit])
+(require '[emender-service.file-utils :as file-utils])
+
+(def home-directory
+    (System/getProperty "user.home"))
+
+(defn slurp-file-from-homedir-
+    [file-name]
+    (slurp (str home-directory "/" file-name)))
+
+(defn get-origin-for-git-directory
+    [git-directory]
+    (try
+        (jgit/with-repo (.getAbsolutePath git-directory)
+            (-> repo
+                (.getRepository)
+                (.getConfig)
+                (.getString "remote" "origin" "url")))
+        (catch Exception e
+            (println "*** Exception *** " e)
+            {:error (.getMessage e)})))
+
+(defn clone-repository
+    "Clone repository into specified directory."
+    [url directory]
+    (try
+        (binding [jgit/*ssh-prvkey* (slurp-file-from-homedir- ".ssh/id_rsa")
+                  jgit/*ssh-pubkey* (slurp-file-from-homedir- ".ssh/id_rsa.pub")]
+            (jgit/git-clone url directory))
+        (catch Exception e
+            (println "*** Exception *** " e)
+            {:error (.getMessage e)})))
+
+(defn checkout-branch
+    [repo branch-name]
+    (try
+        (jgit/git-checkout repo branch-name)
+        true
+        (catch Exception e
+            (println "*** Exception *** " e)
+            nil)))
+
+(defn checkout-origin-branch
+    [repo branch-name]
+    (checkout-branch repo (str "origin/" branch-name)))
+
+(defn clone-remote-repository
+    [repository-url branch]
+    (println repository-url)
+    (println branch)
+    (let [temporary-repodir (file-utils/make-temporary-directory)
+          clone-repo-result (clone-repository repository-url temporary-repodir)]
+          (if (:error clone-repo-result)
+              (do
+                  ;(file-utils/remove-directory temporary-repodir)
+                  {:directory nil
+                   :status "Failure"
+                   :message (str "can not clone repository: " (:error clone-repo-result))})
+              (do
+                  (jgit/with-repo temporary-repodir
+                      (if (not (checkout-origin-branch repo branch))
+                          (do
+                              ;(file-utils/remove-directory temporary-repodir)
+                              {:directory nil
+                               :status "Failure"
+                               :message (str "unable to checkout branch '" branch "'")})
+                          {:directory temporary-repodir
+                           :status "OK"
+                           :message "clone ok"})))
+          )))
+


There's not really any advantage to making `get-db-file` a function, if we want to override settings down the road we can use a dynamic variable instead

--- src/metabase/db.clj
+++ src/metabase/db.clj
@@ -8,24 +8,21 @@
             [korma.db :refer :all]
             [metabase.config :refer [app-defaults]]))

+(def db-file
+  "Path to our H2 DB file from env var or app config."
+  (str "file:" (or (:database-file env)
+                   (:database-file app-defaults))))
+(log/info (str "Using H2 database file: " db-file))

-(defn get-db-file
-  "Check config/environment to determine the path to the h2 db file we want to use"
-  []
-  (str "file:" (or (env :database-file) (get app-defaults :database-file))))
-
-
-(defdb db (do
-            (log/info (str "Using H2 database file: " (get-db-file)))
-            (h2 {:db (get-db-file)
-                 :naming {:keys str/lower-case
-                          :fields str/upper-case}})))
+(defdb db (h2 {:db db-file
+               :naming {:keys str/lower-case
+                        :fields str/upper-case}}))

 (defn migrate
   "Migrate the database :up or :down."
   [direction]
   (let [conn (jdbc/get-connection {:subprotocol "h2"
-                                   :subname (get-db-file)})]
+                                   :subname db-file})]
     (case direction
       :up (com.metabase.corvus.migrations.LiquibaseMigrations/setupDatabase conn)
       :down (com.metabase.corvus.migrations.LiquibaseMigrations/teardownDatabase conn))))


Not sure I'll need this but here it is

Not sure I'll need this but here it is

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

--- src/oxcart/vars.clj
+++ src/oxcart/vars.clj
@@ -0,0 +1,20 @@
+;;   Copyright (c) Reid McKenzie, Rich Hickey & contributors. The use
+;;   and distribution terms for this software are covered by the
+;;   Eclipse Public License 1.0
+;;   (http://opensource.org/licenses/eclipse-1.0.php) which can be
+;;   found in the file epl-v10.html at the root of this distribution.
+;;   By using this software in any fashion, you are agreeing to be
+;;   bound by the terms of this license.  You must not remove this
+;;   notice, or any other, from this software.
+
+(ns oxcart.vars
+  (:refer-clojure :exclude [*loaded-libs*]))
+
+
+(def ^:dynamic *loaded-libs*
+  "A set, being those namespaces which have been loaded in compilation
+  context. Note that this set has no relationship with
+  clojure.core/*loaded-libs*, meaning that mod aliasing concerns
+  compilation occurs in a different loading context than compiler
+  execution."
+  (atom #{}))


add core.clj

add core.clj

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

--- src/main/clojure/trellis/core.clj
+++ src/main/clojure/trellis/core.clj
@@ -0,0 +1,2 @@
+(ns trellis.core)
+


Added simple tests for alfresco.transact.

error: pathspec 'lambdalf/src/test/clojure/alfresco/test/transact.clj' did not match any file(s) known to git

--- lambdalf/src/test/clojure/alfresco/test/transact.clj
+++ lambdalf/src/test/clojure/alfresco/test/transact.clj
@@ -0,0 +1,47 @@
+;
+; Copyright (C) 2012 Peter Monks
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;     http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+(ns alfresco.test.transact
+  (:use [clojure.test]
+        [clojure.tools.nrepl]
+        [alfresco.test])
+  (:require [clj-http.client :as http]))
+
+(defn init-fixture [f]
+  (start-nrepl)
+  (let [c (client (connect :port 7888) 1000)]
+    (message c {:op :eval :code (code (require '[alfresco.auth :as a]))})
+    (message c {:op :eval :code (code (require '[alfresco.nodes :as n]))})
+    (message c {:op :eval :code (code (require '[alfresco.transact :as t]))})
+    (f)))
+
+(use-fixtures :once init-fixture)
+
+(defftest transact-ftests
+  (do
+    (are [result f expr] (= result (f (repl-eval client (code expr))))
+
+         ; Run a simple clojure expression within an Alfresco txn
+         2 repl-value ((t/in-ro-tx-as (a/admin) (+ 1 1)))
+
+
+         ; Get the name of Company Home within an Alfresco txn
+         "Company Home" repl-value (t/in-ro-tx-as (a/admin)
+                                    (n/property (n/company-home)
+                                                :cm/name))
+
+         ; Grab the first Share site and validate that it is indeed a Share site
+         true repl-value (t/in-ro-tx-as (a/admin) (n/site? (first (n/children (n/sites-home)))))
+    ))


fix test

fix test

--- test/clj_http/test/core.clj
+++ test/clj_http/test/core.clj
@@ -182,7 +182,7 @@
             :uri "/post"
             :server-name "localhost"
             :server-port 18080}
-           (dissoc (:request resp) :body :http-req)))
+           (dissoc (:request resp) :body :http-req :body-type)))
     (is (instance? HttpPost (-> resp :request :http-req)))))

 (deftest parse-headers


More idiomatic hashmap merge

More idiomatic hashmap merge

--- src/clj_http/links.clj
+++ src/clj_http/links.clj
@@ -54,6 +54,5 @@
                              [link-headers])]
           (assoc response
                  :links
-                 (apply merge (for [link-header link-headers]
-                                (read-link-headers link-header)))))
+                 (into {} (map read-link-headers link-headers))))
         response))))


Kibit

Kibit

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


moving deployment code out

moving deployment code out

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/narkisr/fpm-barbecue.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/mprokopov/privat24-manager.git/'


will be overwritten

will be overwritten

--- src/hydrofoil/core.clj
+++ src/hydrofoil/core.clj
@@ -17,6 +17,9 @@

 (defn -main [& args]
   (new-indv(NACA-design 50 50 50)))
+
+(+ (Math/PI) 1)
+(+ 1 1)

 ;;(defn generate-random-design


Adds optional user name to TeamMembership

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


Removed flakyness

Removed flakyness

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


java/install options

java/install options

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


Fix assoc-authority-if-missing

Fix assoc-authority-if-missing

We only want the authority's id here, and we should assoc nils.


Add EAVT keys/values

Add EAVT keys/values

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/leif47/immutabledb-experimental.git/'


add button-group for service field positioning

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


erabiltzaile-zuzena txukundu

erabiltzaile-zuzena txukundu

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


Give ping interceptor a namespaced name

Give ping interceptor a namespaced name

This will be helpful if we start adding sub-resource ping endpoints and
is a good practice to do consistently in here anyway.

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


escape error stacktrace in outcome

escape error stacktrace in outcome

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


update jackson and lein-nvd

update jackson and lein-nvd

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


Update libs

Update libs

Signed-off-by: selmeci <bb938fc7591901d0e874df22e3ae174886bcb931@infones.com>

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


Version 1.13.0

Version 1.13.0


Version 1.7.1-SNAPSHOT

Version 1.7.1-SNAPSHOT


Update 05_maps.clj

Update 05_maps.clj

"Often you will need to get the keys, but the order is undependable"
The keys value pairs are already ordered by key. Why not make the original map un-ordered to force the user to think about sorting them?

"You can get the values in a similar way"
Two of the three values are already provided in the answer, the answer to this challenge can be arrived at by providing the missing one through process of elimination without thinking about sorting.

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/croeder/clojure-koans-work.git/'


Begin a new namespace with cleaner implementation, based entirely around the path->url mapping.

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

--- src/pubhouse/site.clj
+++ src/pubhouse/site.clj
@@ -0,0 +1,41 @@
+(ns pubhouse.site
+  (:require [me.raynes.fs :as fs]))
+
+(defn relative-path
+  "Returns the sub-string of path relative to the current-value of *cwd*.
+  Assumes that path is a equal to or a child of *cwd*"
+  [path]
+  (->> (fs/split path)
+       (drop (count (fs/split fs/*cwd*)))
+       (clojure.string/join "/")))
+
+(defn strip-extensions
+  "Strips all extensions from the path string."
+  [path]
+  (if-let [ext (fs/extension path)]
+    (recur (clojure.string/replace path ext ""))
+    path))
+
+(defn canonical-url
+  "Given some url, ensures that it is an absolute url. Also, if
+   the url has the form path/to/category/index, then /path/to/category/
+   will be returned."
+  [url]
+  (str "/" (clojure.string/replace url "index" "")))
+
+(defn path->url
+  "Convert a path to a url, with paths relative to the current value of *cwd*"
+  [path]
+  (-> path (relative-path) (strip-extension) (canonical-url)))
+
+(defn file-mapping
+  [root file]
+  (let [path (.getPath file)]
+    (fs/with-cwd root [path (path->url path)])))
+
+(defn site-mapping
+  [source-file? path]
+  (let [root (fs/with-cwd path (fs/with-cwd "content" (fs/file ".")))]
+    (->> (file-seq root)
+         (filter source-file?)
+         (map (partial file-mapping root)))))


finish scaffolding for catalogs view

finish scaffolding for catalogs view


De-duplicate images in emails

De-duplicate images in emails

--- src/metabase/email/messages.clj
+++ src/metabase/email/messages.clj
@@ -63,11 +63,18 @@
     (.close fos)
     file))

+(defn- find-byte-array
+  [needle haystack]
+  (first (keep-indexed #(when (java.util.Arrays/equals %2 needle) %1) haystack)))
+
 (defn render-pulse-email
   "Take a pulse object and list of results, returns an array of attachment objects for an email"
   [pulse results]
   (let [images       (atom [])
-        render-img   (fn [bytes] (reset! images (conj @images bytes)) (str "cid:IMAGE_" (-> @images count dec)))
+        render-img   (fn [bytes]
+                        (let [index (or (find-byte-array bytes @images) (count @images))]
+                          (if (= index (count @images)) (reset! images (conj @images bytes)))
+                          (str "cid:IMAGE_" index)))
         body         (apply vector :div (mapv (partial render-pulse-section render-img true) results))
         data-quote   (rand-nth q/quotations)
         message-body (stencil/render-file "metabase/email/pulse"


truncate /var/log/messages in teardown as well


import of pathfind test

import of pathfind test

error: pathspec 'test/infinitelives/utils/pathfind_test.cljs' did not match any file(s) known to git

--- test/infinitelives/utils/pathfind_test.cljs
+++ test/infinitelives/utils/pathfind_test.cljs
@@ -0,0 +1,163 @@
+(ns infinitelives.utils.pathfind-test
+  (:require [cljs.test :refer-macros [deftest is]]
+            [infinitelives.utils.pathfind :as pf]))
+
+(deftest manhattan-test
+  (is (= (pf/manhattan 0 0) 0))
+  (is (= (pf/manhattan 1 4) 5))
+  (is (= (pf/manhattan 1 -4) 5))
+  (is (= (pf/manhattan -1 4) 5))
+  (is (= (pf/manhattan -1 -4) 5)))
+
+(deftest chebyshev-test
+  (is (= (pf/chebyshev 0 0) 0))
+  (is (= (pf/chebyshev 1 4) 4))
+  (is (= (pf/chebyshev 1 -4) 4))
+  (is (= (pf/chebyshev -1 4) 4))
+  (is (= (pf/chebyshev -1 -4) 4)))
+
+(deftest euclid-test
+  (is (= (pf/euclid 0 0) 0))
+  (is (= (pf/euclid 3 4) 5))
+  (is (= (pf/euclid 3 -4) 5))
+  (is (= (pf/euclid -3 4) 5))
+  (is (= (pf/euclid -3 -4) 5)))
+
+(deftest distance-between-test
+  (is (= (pf/distance-between pf/manhattan [0 0] [-3 4]) 7))
+  (is (= (pf/distance-between pf/chebyshev [0 0] [-3 4]) 4))
+  (is (= (pf/distance-between pf/euclid    [0 0] [-3 4]) 5)))
+
+(deftest state-add-neighbour-test
+  (is (=
+       (pf/state-add-neighbour
+        (pf/->state #{} #{} {} {} {})
+        [0 0]
+        [1 1])
+       (pf/->state #{} #{[1 1]} {[1 1] [0 0]} {} {}))))
+
+(deftest state-add-open-test
+  (is (=
+       (pf/state-add-open
+        (pf/->state #{} #{} {} {} {})
+        [0 0])
+       (pf/->state #{} #{[0 0]} {} {} {}))))
+
+(deftest state-open-to-closed-test
+  (is (=
+       (pf/state-open-to-closed
+        (pf/->state #{} #{[0 0]} {} {} {})
+        [0 0])
+       (pf/->state #{[0 0]} #{} {} {} {}))))
+
+(deftest reduce-state-over-neighbours
+  (is (=
+       (pf/reduce-state-over-neighbours
+        (pf/->state #{} #{[0 0]} {} {} {})
+        [0 0]
+        [[0 1] [0 -1] [1 0] [-1 0] [1 1] [-1 1] [1 -1] [-1 -1]])
+       (pf/->state
+        #{}
+        #{[0 0] [0 1] [0 -1] [1 0] [-1 0] [1 1] [-1 1] [1 -1] [-1 -1]}
+        {[0 1] [0 0]
+         [0 -1] [0 0]
+         [1 0] [0 0]
+         [-1 0] [0 0]
+         [1 1] [0 0]
+         [-1 1] [0 0]
+         [1 -1] [0 0]
+         [-1 -1] [0 0]
+         }
+        {} {}))))
+
+(deftest calculate-open-fscore-test
+  (let [{:keys [g-score f-score]}
+        (pf/calculate-open-fscore
+         (pf/->state
+          #{} #{[0 1] [0 0] [-1 1] [1 1] [1 -1] [1 0] [-1 0] [-1 -1] [0 -1]}
+          {[0 1] [0 0], [0 -1] [0 0], [1 0] [0 0], [-1 0] [0 0], [1 1] [0 0], [-1 1] [0 0], [1 -1] [0 0], [-1 -1] [0 0]}
+          {}, {})
+         [0 0] [10 10])]
+    (is (= g-score
+           {[0 1] 10
+            [0 0] 0
+            [-1 1] 14
+            [1 1] 14
+            [1 -1] 14
+            [1 0] 10
+            [-1 0] 10
+            [-1 -1] 14
+            [0 -1] 10}))
+    (is (= f-score
+           {[0 1] 200
+            [0 0] 200
+            [-1 1] 214
+            [1 1] 194
+            [1 -1] 214
+            [1 0] 200
+            [-1 0] 220
+            [-1 -1] 234
+            [0 -1] 220}))))
+
+(deftest lowest-f-score-open-cell-test
+  (is
+   (#{[0 1] [1 1]}
+    (->
+     (pf/->state
+      #{} #{[0 1] [0 0] [-1 1] [1 1] [1 -1] [1 0] [-1 0] [-1 -1] [0 -1]}
+      {[0 1] [0 0], [0 -1] [0 0], [1 0] [0 0], [-1 0] [0 0], [1 1] [0 0], [-1 1] [0 0], [1 -1] [0 0], [-1 -1] [0 0]}
+      {}, {})
+     (pf/calculate-open-fscore [0 1] [10 10])
+     (pf/lowest-f-score-open-cell)))))
+
+(deftest A*-step-test
+  (let [start [0 0]
+        end [10 10]
+        [{:keys [open-set came-from g-score] :as state} next-cell]
+        (-> (pf/->state #{} #{start} {} {start 0} {start 10})
+            (pf/A*-step (constantly true) start end))]
+    (is (= open-set #{[-1 -1] [0 -1] [1 -1] [-1 0] [1 0] [-1 1] [0 1] [1 1]}))
+    (is (= came-from
+           {
+            [-1 -1] [0 0]
+            [0 -1] [0 0]
+            [1 -1] [0 0]
+            [-1 0] [0 0]
+            [1 0] [0 0]
+            [-1 1] [0 0]
+            [0 1] [0 0]
+            [1 1] [0 0]
+            }))
+    (is (= g-score
+           {[0 -1] 10
+            [-1 0] 10
+            [0 1] 10
+            [1 0] 10
+            [-1 -1] 14
+            [-1 1] 14
+            [1 -1] 14
+            [1 1] 14
+            [0 0] 0
+            }))))
+
+(deftest A*-test
+  (is (= (pf/A* (constantly true) [0 0] [10 5])
+         '([0 0] [1 1] [2 2] [3 3] [4 4] [5 5] [6 5] [7 5] [8 5] [9 5] [10 5]))))
+
+(deftest A*-obstacle-test
+  (let [passable? (fn [pos]
+                    (-> pos #{[3 3] [3 4] [4 4] [4 3]} boolean not))]
+    (is (= (pf/A* passable? [0 0] [10 5] :corner-cut)
+           '([0 0] [1 1] [2 2]
+             [3 2] [4 2] [5 3]
+             [6 4] [7 5] [8 5]
+             [9 5] [10 5])))))
+
+(deftest A*-obstacle-no-diags-test
+  (let [passable? (fn [pos]
+                    (-> pos #{[3 3] [3 4] [4 4] [4 3]} boolean not))]
+    (is (= (pf/A* passable? [0 0] [10 5])
+           '([0 0] [1 1] [2 2]
+             [3 2] [4 2] [5 2]
+             [6 3] [7 4] [8 5]
+             [9 5] [10 5])))))


Fixed question.

Fixed question.

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


set property, don't just "add" it

set property, don't just "add" it


Support dommy style shorthand for div

Support dommy style shorthand for div

--- src/sablono/util.cljx
+++ src/sablono/util.cljx
@@ -68,12 +68,17 @@
   "Match `s` as a CSS tag and return a vector of tag name, CSS id and
   CSS classes."
   [s]
-  (let [[tag-name & matches] (re-seq #"[#.]?[^#.]+" (name s))]
-    (if tag-name
-      [tag-name
-       (first (map strip-css (filter #(= \# (first %1)) matches)))
-       (vec (map strip-css (filter #(= \. (first %1)) matches)))]
-      (throw (ex-info (str "Can't match CSS tag: " s) {:tag s})))))
+  (let [matches (re-seq #"[#.]?[^#.]+" (name s))
+        [tag-name matches] (cond (empty? matches)
+                                 (throw (ex-info (str "Can't match CSS tag: " s) {:tag s}))
+                                 (#{\# \.} (ffirst tag-name)) ;; shorthand for div
+                                 ["div" matches]
+                                 :default
+                                 [(first matches) (rest matches)])]
+    [tag-name
+     (first (map strip-css (filter #(= \# (first %1)) matches)))
+     (vec (map strip-css (filter #(= \. (first %1)) matches)))]))
+

 (defn normalize-element
   "Ensure an element vector is of the form [tag-name attrs content]."


Add matrix library abstraction.

Add matrix library abstraction.

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

--- src/uxbox/matrix.cljs
+++ src/uxbox/matrix.cljs
@@ -0,0 +1,40 @@
+(ns uxbox.matrix
+  "A lightweight abstraction over Matrix library
+  of the Google Closure Library."
+  (:import goog.math.Matrix
+           goog.math.Size))
+
+(extend-type Matrix
+  cljs.core/ICounted
+  (-count [v]
+    (let [^Size size (.getSize v)]
+      (* (.-width size)
+         (.-height size))))
+
+  cljs.core/IDeref
+  (-deref [v]
+    (js->clj (.toArray v)))
+
+  IPrintWithWriter
+  (-pr-writer [v writer _]
+    (->> (str "#goog.math.Matrix " (js->clj (.toArray v)))
+         (cljs.core/-write writer))))
+
+(defn matrix
+  "Create a matrix instance from coll.
+  The size is determined by the number
+  of elements of the collection."
+  [coll]
+  {:pre [(coll? coll)
+         (coll? (first coll))
+         (= (count coll)
+            (count (first coll)))]}
+  (Matrix. (clj->js coll)))
+
+(defn multiply
+  ([n] n)
+  ([n m]
+   (.multiply n m))
+  ([n m & more]
+   (reduce multiply (.multiply n m) more)))
+


remove debug code to delete sample dataset on launch :sweat:

--- src/metabase/core.clj
+++ src/metabase/core.clj
@@ -140,7 +140,6 @@
 (def ^:private ^:const sample-dataset-filename "sample-dataset.db.mv.db")

 (defn- add-sample-dataset! []
-  (db/cascade-delete Database :name sample-dataset-name)
   (when-not (db/exists? Database :name sample-dataset-name)
     (try
       (log/info "Loading sample dataset...")


Well, that's a workaround

Well, that's a workaround


port relevant parts of cljs.analyzer

port relevant parts of cljs.analyzer

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


[EN] Remove done TODO comment.

[EN] Remove done TODO comment.

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


Print service map on http/start

Print service map on http/start


Run go test from within clojure.test

Run go test from within clojure.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/shaunstanislaus/cljs2go.git/'


ensure eval response value is always a string

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


test shell for suspendable states

test shell for suspendable states

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

--- test/check/suspend_resume_test.clj
+++ test/check/suspend_resume_test.clj
@@ -0,0 +1,27 @@
+(ns check.suspend-resume-test
+  (:require [mount.core :as mount :refer [defstate]]
+            [app.config :refer [app-config]]
+            [app.nyse :refer [conn]]
+            [app :refer [nrepl]]
+            [clojure.test :refer :all]))
+
+(deftest suspendable
+
+  ;; lifecycle
+  (testing "should suspend _only suspendable_ states that are currently started")
+  (testing "should resume _only suspendable_ states that are currently suspended")
+  (testing "should start all the states, except the ones that are currently suspended, should resume them instead")
+  (testing "should stop all: started and suspended")
+
+  ;; start-with
+  (testing "when replacing a non suspendable state with a suspendable one,
+            the later should be able to suspend/resume,
+            the original should not be suspendable after resume and preserve its lifecycle fns after rollback/stop")
+
+  (testing "when replacing a suspended state with a non suspendable one,
+            the later should not be suspendable,
+            the original should still be suspended and preserve its lifecycle fns after the rollback/stop")
+
+  (testing "when replacing a suspended state with a suspendable one,
+            the later should be suspendable,
+            the original should still be suspended and preserve its lifecycle fns after the rollback/stop"))


Note the evil.

Note the evil.

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


Add rotating seq to onyx for experimentation.

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

--- src/rotating_seq/core.clj
+++ src/rotating_seq/core.clj
@@ -0,0 +1,18 @@
+(ns rotating-seq.core)
+
+(defn create-r-seq [bucket-lifetime expire-interval]
+  (assert (zero? (mod bucket-lifetime expire-interval)) "Bucket lifetime must divide evenly over expiration interval")
+  (let [n-buckets (int (Math/ceil (/ bucket-lifetime expire-interval)))]
+    (vec (repeat n-buckets (list)))))
+
+(defn add-to-head [r-seq elements]
+  (assoc r-seq 0 (into (r-seq 0) elements)))
+
+(defn update-head [r-seq f & args]
+  (update-in r-seq [0] (fn [x]
+                         (let [result (f (concat x args))]
+                           (if-not (coll? result)
+                             [result] result)))))
+
+(defn expire-bucket [r-seq]
+  (vec (conj (butlast r-seq) (list))))


Add a session namespace and basic accessing code

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

--- src/cljs/comic_reader/session.cljs
+++ src/cljs/comic_reader/session.cljs
@@ -0,0 +1,16 @@
+(ns comic-reader.session
+  (:refer-clojure :exclude [get])
+  (:require [reagent.core :as reagent :refer [atom]]))
+
+(def state (atom {}))
+
+(defn get [k & [default]]
+  (clojure.core/get @state k default))
+
+(defn put! [k v]
+  (swap! state assoc k v))
+
+(defn update-in! [ks f & args]
+  (clojure.core/swap!
+   state
+   #(apply (partial update-in % ks f) args)))


Extract sequence-m test from maybe test

Extract sequence-m test from maybe test

--- tests/tests_cats.cljx
+++ tests/tests_cats.cljx
@@ -29,6 +29,13 @@
                  :when (> i 2)]
                  (m/return i)))))

+(deftest test-sequence-m
+  (testing "It works with Maybe values"
+    (is (= (m/sequence-m [(t/just 2) (t/just 3)])
+           (t/just [2 3])))
+    (is (= (m/sequence-m [(t/just 2) (t/nothing)])
+           (t/nothing)))))
+
 (deftest test-lift-m
   (testing "It can lift a function to the Maybe monad"
     (let [monad+ (m/lift-m +)]
@@ -58,10 +65,4 @@
     (let [m1 (t/just 1)
           m2 (t/nothing)]
       (is (= (m/fmap inc m1) (t/just 2)))
-      (is (= (m/fmap inc m2) (t/nothing)))))
-
-  (testing "sequence-m"
-    (is (= (m/sequence-m [(t/just 2) (t/just 3)])
-           (t/just [2 3])))
-    (is (= (m/sequence-m [(t/just 2) (t/nothing)])
-           (t/nothing)))))
+      (is (= (m/fmap inc m2) (t/nothing))))))


Remove debug print.

Remove debug print.

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


more Without Repetitions

more Without Repetitions

Clojure

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/nikai3d/ce-challenges.git/'


Problem 0091.

Problem 0091.

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

--- src/project_euler/problem_0091.clj
+++ src/project_euler/problem_0091.clj
@@ -0,0 +1,30 @@
+(ns project-euler.problem_0091)
+
+;; The points P (x1, y1) and Q (x2, y2) are plotted at integer co-ordinates and are joined to the origin,
+;; O(0,0), to form ΔOPQ.
+
+;; There are exactly fourteen triangles containing a right angle that can be formed when
+;; each co-ordinate lies between 0 and 2 inclusive;
+;; that is, 0 ≤ x1, y1, x2, y2 ≤ 2.
+
+;; Given that 0 ≤ x1, y1, x2, y2 ≤ 50, how many right triangles can be formed?
+
+(defn contains-right-angle? [x1 y1 x2 y2]
+  (zero? (* (+ (* x1 x2) (* y1 y2))
+            (+ (* x1 (- x2 x1)) (* y1 (- y2 y1)))
+            (+ (* x2 (- x1 x2)) (* y2 (- y1 y2))))))
+
+(defn solution-for [n]
+  (->> (for [x1 (range n), y1 (range n), x2 (range n), y2 (range n)] [x1 y1 x2 y2])
+       (remove (fn [[x1 y1 x2 y2]] (or (and (== 0 x1) (== 0 y1))
+                                       (and (== 0 x2) (== 0 y2))
+                                       (and (== x1 x2) (== y1 y2)))))
+       (filter (fn [ps] (apply contains-right-angle? ps)))
+       (count)
+       ((fn [cnt] (/ cnt 2)))
+       ))
+
+(defn solution []
+  (solution-for 51))
+
+;;-> 14234


Add `date-picker` component

Add `date-picker` component

it's customizable!

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


(Hopefully) fixed api-key issue

(Hopefully) fixed api-key issue

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


Added alcovegas

Added alcovegas

error: pathspec 'src/priceous/provider/alcovegas.clj' did not match any file(s) known to git

--- src/priceous/provider/alcovegas.clj
+++ src/priceous/provider/alcovegas.clj
@@ -0,0 +1,106 @@
+(ns priceous.provider.alcovegas
+  (:require [net.cgrand.enlive-html :as html]
+            [taoensso.timbre :as log]
+            [priceous.utils :as u]
+            [priceous.provider :as p]
+            [priceous.selector-utils :as su]))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn- get-categories [provider]
+  (->>
+   [["Виски" "http://alcovegas.com.ua/c36424-viski.html"]
+    ["Абсент" "http://alcovegas.com.ua/c36361-absent.html"]
+    ["Бренди" "http://alcovegas.com.ua/c36421-brendi.html"]
+    ["Вермут" "http://alcovegas.com.ua/c36422-vermut.html"]
+    ["Вино" "http://alcovegas.com.ua/c112689-vino.html"]
+    ["Водка" "http://alcovegas.com.ua/c36425-vodka.html"]
+    ["Граппа" "http://alcovegas.com.ua/c217212-grappa.html"]
+    ["Джин" "http://alcovegas.com.ua/c36426-dzhin.html"]
+    ["Кальвадос" "http://alcovegas.com.ua/c343826-kalvados-calvados.html"]
+    ["Коньяк" "http://alcovegas.com.ua/c36427-konyak.html"]
+    ["Ликер" "http://alcovegas.com.ua/c36428-liker.html"]
+    ["Настойка" "http://alcovegas.com.ua/c41228-nastoyka.html"]
+    ["Ром" "http://alcovegas.com.ua/c36429-rom.html"]
+    ["Самбука" "http://alcovegas.com.ua/c36430-sambuka.html"]
+    ["Текила" "http://alcovegas.com.ua/c36431-tekila.html"]
+    ["Шампанское" "http://alcovegas.com.ua/c36432-shampanskoe.html"]]
+   (mapv (fn [[name url]] {:name name :template (str url "?view=all")}))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn- node->document
+  [provider nodemap]
+  (su/with-selectors provider nodemap
+    (let [spec (->> [(q*? [:.dl-horizontal :dt])
+                     (q*? [:.dl-horizontal :dd])]
+                    (apply mapv (fn [a b] [(-> a html/text u/cleanup)
+                                           (-> b html/text u/cleanup)]))
+                    (into {}))]
+      (-> {}
+          (assoc :provider (p/pname provider))
+          (assoc :name (text+ [:h4]))
+          (assoc :link (some-> (q+ [:h4 :a])
+                               (get-in [:attrs :href])
+                               (#(u/full-href provider %))))
+          (assoc :image (some-> (q? [:.thumbnails :img])
+                                (get-in [:attrs :src])
+                                (#(u/full-href provider %))))
+          (assoc :type (str (p/category-name provider) " " (spec "Тип:")))
+          (assoc :timestamp (u/now))
+          (assoc :country (spec "Страны:"))
+          (assoc :alcohol (some-> (spec "Крепость:") (u/smart-parse-double)))
+          (assoc :volume  (some-> (spec "Обьем:") (u/smart-parse-double)))
+          (assoc :available (boolean (q? [:.exists])))
+          (assoc :product-code (str (p/pname provider) "_" (text? [:span4 :.code])))
+
+          ((fn [doc]
+             (let [price (some-> (text? [:.price])
+                                 (u/smart-parse-double))
+                   oldprice (some-> (text? [:.price-old])
+                                    (u/smart-parse-double))
+                   sale (boolean oldprice)
+                   sale-desc (if sale (format "старая цена %.2f" oldprice))]
+               (-> doc
+                   (assoc :price price)
+                   (assoc :sale sale)
+                   (assoc :sale-description sale-desc)))))
+
+          ))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(def provider
+  {
+   :info {
+          :name          "Alcovegas"
+          :base-url      "http://alcovegas.com.ua/"
+          :icon          "http://alcovegas.com.ua/uploads/2173/images/logo-alkovegas%20logo1.png"
+;;          :icon-width    "263"
+;;          :icon-height   "84"
+          }
+
+   ;; provider state, will be changed by flow processor
+   :state {
+           :page-current   1
+           :page-processed 0
+           :page-template  :category-manageed
+           :category       :no-category
+           :page-limit     Integer/MAX_VALUE
+           :done           false
+           :current-val    1
+           :init-val       1
+           :advance-fn     inc
+           }
+
+   :configuration {
+                   :categories-fn      get-categories
+                   :threads            8
+                   :strategy           :light
+                   :node->document     node->document
+                   :node-selector      [:.itemlist]
+                   :last-page-selector [:.invalid-class] ;; TODO we don't use paging
+                   }
+   })
+
+


add confirmation step to reassign confirmation


STORM-635. logviewer returns 404 if storm_home/logs is a symlinked dir.

--- storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -258,7 +258,9 @@
     (let [file (.getCanonicalFile (File. root-dir fname))
           file-length (.length file)
           path (.getCanonicalPath file)]
-      (if (.exists file)
+      (if (and (= (.getCanonicalFile (File. root-dir))
+                  (.getParentFile file))
+               (.exists file))
         (let [default-length 51200
               length (if length
                        (min 10485760 length)


sane implementation of field seq -> type

--- src/metabase/driver/mongo/util.clj
+++ src/metabase/driver/mongo/util.clj
@@ -52,7 +52,8 @@
   [values-seq]
   {:pre [(sequential? values-seq)]}
   (or (->> values-seq
-           (filter identity)
+           (filter identity)             ; TODO - why not do a query to return non-nil values of this column instead
+           (take 1000)                   ; it's probably fine just to consider the first 1,000 non-nil values when trying to type a column instead of iterating over the whole collection
            (group-by type)
            (map (fn [[type valus]]
                   [type (count valus)]))


json-serialize wonky Postgres array types

--- src/metabase/middleware/format.clj
+++ src/metabase/middleware/format.clj
@@ -20,6 +20,9 @@

 ;; stringify Postgres binary objects (e.g. PostGIS geometries)
 (add-encoder org.postgresql.util.PGobject encode-str)
+
+;; Do the same for PG arrays
+(add-encoder org.postgresql.jdbc4.Jdbc4Array encode-str)

 ;; serialize sql dates (i.e., QueryProcessor results) like YYYY-MM-DD instead of as a full-blown timestamp
 (add-encoder java.sql.Date (fn [^java.sql.Date date ^com.fasterxml.jackson.core.JsonGenerator json-generator]


Bump version

Bump version

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


Version 1.5.1-SNAPSHOT

Version 1.5.1-SNAPSHOT


Upgrade to the latest Kehaaaaar

Upgrade to the latest Kehaaaaar

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


Fix typo

Fix typo

--- project.clj
+++ project.clj
@@ -1,5 +1,5 @@
 (defproject re-frame/lein-template "0.1.0-SNAPSHOT"
-  :description "A basic template for a Reagent based web app based that implements the re-frame pattern."
+  :description "A basic template for a Reagent web app that implements the re-frame pattern."
   :url "http://example.com/FIXME"
   :license {:name "MIT"}
   :eval-in-leiningen true)


bump parinfer lib version for #29

bump parinfer lib version for #29

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


update lein-git-version match

update lein-git-version match

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


simpler reference to Clojure

simpler reference to Clojure

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


Adding logging host

Adding logging host

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


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


parinfer lib bump

parinfer lib bump


bump core version to 3.5.0

bump core version to 3.5.0


protocol ideas

protocol ideas

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

--- src/ceres_collector/protocols.clj
+++ src/ceres_collector/protocols.clj
@@ -0,0 +1,39 @@
+(ns ceres-collector.protocols
+  (:require [ceres-collector.db :refer [db]]
+            [monger.collection :as mc]))
+
+
+(defprotocol Entity
+  (store [entity] "Stores entity in database"))
+
+
+(defrecord Unknown [source target]
+  Entity
+  (store [entity]
+    (mc/insert-and-return @db "unknown" (assoc entity :ts (t/now)))))
+
+
+(defrecord Reply [source target]
+  Entity
+  (store [entity]
+    (mc/insert-and-return @db "replies" (assoc entity :ts (t/now)))))
+
+(defrecord Retweet [source target]
+  Entity
+  (store [entity]
+    (mc/insert-and-return @db "unknown" (assoc entity :ts (t/now)))))
+
+(defrecord Unknown [source target]
+  Entity
+  (store [entity]
+    (mc/insert-and-return @db "unknown" (assoc entity :ts (t/now)))))
+
+(defrecord Unknown [source target]
+  Entity
+  (store [entity]
+    (mc/insert-and-return @db "unknown" (assoc entity :ts (t/now)))))
+
+(defrecord Unknown [source target]
+  Entity
+  (store [entity]
+    (mc/insert-and-return @db "unknown" (assoc entity :ts (t/now)))))


Allow caching of CORS preflight requests for up to 5 min

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


Add spec for items

Add spec for items

Previously, I thought I had added a spec for checking the todo items -
but it turned out that I had added an optional one for a key that
would never be associated with the app-state (in preparation for a new
app-state strucure that enables lists of lists). The current todo-items
are now properly checked after each event handler.

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


Melody construction using intervals

Melody construction using intervals

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

--- src/tenor/melody.clj
+++ src/tenor/melody.clj
@@ -0,0 +1,47 @@
+;; tenor/melody.clj
+;; Core functions to create the melody.
+
+(ns tenor.melody
+  (:use [overtone.live]))
+
+;; --- Melody using intervals --- ;;
+
+(defn perfect-unison [degree]
+  "Identical notes. No interval jump."
+  (+ 0 degree))
+
+(defn up-step [degree]
+  "One step up in the scale (Whole note or half, depending on degree)."
+  (inc degree))
+
+(defn down-step [degree]
+  "One step down in the scale (Whole note or half, depending on degree)."
+  (dec degree))
+
+(defn up-leap [degree]
+  "One leap up in the scale (More than 2 semitones)."
+  (+ (rand-nth [2 3 4 5 6 7]) degree))
+
+(defn down-leap [degree]
+  "One leap down in the scale (More than 2 semitones)."
+  (- (rand-nth [2 3 4 5 6 7]) degree))
+
+(defn up-octave [degree]
+  "One perfect octave up (Example: C3 to C4)."
+  (+ 8 degree))
+
+(defn down-octave [degree]
+  "One perfect octave down (Example: C4 to C3)."
+  (- 8 degree))
+
+(defn weighted-random-interval-jumps [scale degree]
+  "Generate an interval jump using weighted random selection,
+  from the current note until another compatible note is reached.
+  The chances of steps, leaps and octave transitions vary."
+  (let [movements '(perfect-unison up-step down-step up-leap down-leap up-octave down-octave)
+        current-move (weighted-choose movements '(0.06 0.35 0.35 0.08 0.08 0.04 0.04))
+        temp-degree ((resolve current-move) degree)]
+    (if (and (> temp-degree 0) (>= (count scale) temp-degree))
+      temp-degree
+      (weighted-random-interval-jumps scale temp-degree))))
+