I hereby claim:
- I am mbuczko on github.
- I am mbuczko (https://keybase.io/mbuczko) on keybase.
- I have a public key whose fingerprint is 0639 2B57 8F68 B2F8 7CE9 861E EA1C F2EE 7389 EE0E
To claim this, I am signing this object:
(import '[org.opencv.core Mat Size CvType] '[org.opencv.highgui Highgui] '[org.opencv.imgproc Imgproc]) | |
(clojure.lang.RT/loadLibrary org.opencv.core.Core/NATIVE_LIBRARY_NAME) | |
(def angelina (Highgui/imread "resources/angelina.jpg")) | |
(def blurred (Mat. 960 1280 CvType/CV_8UC3)) | |
(Imgproc/GaussianBlur angelina blurred (Size. 5 5) 3 3) | |
(Highgui/imwrite "resources/images/blurred.png" blurred) |
(ns sagaz-back.validation) | |
; Helper functions | |
(defn validate* [field value regexp] | |
(if-not (re-matches regexp value) | |
(keyword (str "invalid-" (name field))))) | |
(defn validate [data criteria] | |
(-> (reduce-kv (fn [acc k re] (conj acc (validate* k (k data) re))) |
I hereby claim:
To claim this, I am signing this object:
(defmacro assert-all | |
[& pairs] | |
`(do (when-not ~(first pairs) | |
(throw (IllegalArgumentException. | |
(str (first ~'&form) " requires " ~(second pairs) " in " ~'*ns* ":" (:line (meta ~'&form)))))) | |
~(let [more (nnext pairs)] | |
(when more | |
(list* `assert-all more))))) | |
(defmacro when-let* |
(defmacro with-mock [vr & body] | |
`(with-redefs [~vr (with-meta | |
(fn [& ~'args] (swap! (-> ~vr meta :args) conj ~'args)) | |
{:args (atom [])})] | |
(do ~@body))) | |
(defmacro make-mock | |
([m] `(make-mock ~m nil)) | |
([m stub] |
(defn remote-req [result] | |
(Thread/sleep 1000) | |
result) | |
(defmacro plet [bindings & body] | |
(let [bents (partition 2 (destructure bindings)) | |
smap (into {} (map (fn [[b _]] | |
[b `(deref ~b)]) | |
bents)) | |
bindings (vec (mapcat (fn [[b v]] |
(deftype Employee [name id] | |
Object | |
(equals [a b] (= (.id a) (.id b))) | |
(hashCode [this] (.hashCode (.id this))) | |
(toString [this] (.name this))) | |
(def vince (Employee. "Vince" 42)) | |
(def vincent (Employee. "Vincent" 42)) |
:graphql-url = https://api.github.com/graphql | |
:github-token := (auth-source-pass-get "token" "web/github") | |
:headers = << | |
Authorization: Bearer :github-token | |
User-Agent: Emacs | |
# | |
:query-repos := << |