This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM clojure:openjdk-15-tools-deps AS builder | |
WORKDIR /opt | |
ADD deps.edn deps.edn | |
RUN clj -Sdeps '{:mvn/local-repo "./.m2/repository"}' -e "(prn \"Downloading deps\")" | |
RUN clj -e :ok | |
COPY . . | |
RUN clj -e :ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[optional] Installing Libsodium - ONLY if you do not want nix to handle this - otherwise skip | |
git clone https://github.com/input-output-hk/libsodium | |
cd libsodium | |
git checkout 66f017f1 | |
./autogen.sh | |
./configure | |
make | |
sudo make install && cd .. | |
#Export and source ~/.bashrc | |
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; I think it would be a mistake to introduce temporal coupling to prevent typos. | |
;; The example program below lets you identify "missing" keys specs at | |
;; the time and place of your choosing, and then handle them as you | |
;; deem appropriate, without imposing those decisions on other | |
;; users of spec. | |
(require '[clojure.spec.alpha :as s] | |
'[clojure.set :as set]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[cemerick.url :as url] | |
'[clojure.spec.alpha :as s] | |
'[clojure.spec.gen.alpha :as gen] | |
'[clojure.string :as string]) | |
(def non-empty-string-alphanumeric | |
"Generator for non-empty alphanumeric strings" | |
(gen/such-that #(not= "" %) | |
(gen/string-alphanumeric))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; uses a web worker background thread | |
(let [metronome-worker-js "self.onmessage=function(e){setTimeout(function(){postMessage(e.data);},e.data.interval);};console.log('Metronome worker loaded.');" | |
worker-blob (js/Blob. (clj->js [metronome-worker-js]) {:type "application/javascript"}) | |
worker (js/Worker. (.createObjectURL js/URL worker-blob)) | |
call-id (atom 0)] | |
(defn make-worker-listener [id callback] | |
(fn [e] | |
(when (= e.data.id id) | |
(callback) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Based on https://clojuredocs.org/clojure.core/condp#example-542692cbc026201cdc326bea | |
(defn parse-arg [s] | |
(condp (comp next re-matches) s | |
#"([+-])(\w+)" :>> (fn [[f k]] [(keyword k) (= f "+")]) | |
#"(\w+)=(\w+)" :>> (fn [[k v]] [(keyword k) v]) | |
(throw (IllegalArgumentException. s)))) | |
(parse-arg "+foo") ;=> [:foo true] | |
(parse-arg "-foo") ;=> [:foo false] |
With a centralized workflow we expect the branch master
to be what's deployed /deployable to production. Changes are implemented on feature branches (typically named feature/<feature-name>
) and merged into master via Github Pull request UI workflow.
This works fine, but occasionally a developer can make an error and push to master
. We'd like to put some additional checks in place to protect against that.
Couldn't find the text of this for a while...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SimpleHTTPServer | |
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def send_head(self): | |
"""Common code for GET and HEAD commands. | |
This sends the response code and MIME headers. | |
Return value is either a file object (which has to be copied | |
to the outputfile by the caller unless the command was HEAD, | |
and must be closed by the caller under all circumstances), or |
NewerOlder