Skip to content

Instantly share code, notes, and snippets.

View MageMasher's full-sized avatar

Joe Lane MageMasher

View GitHub Profile
@MageMasher
MageMasher / web-component-v1.cljs
Created April 9, 2019 13:45 — forked from thheller/web-component-v1.cljs
create web-component v1 in cljs without class
(defn component []
(js/Reflect.construct js/HTMLElement #js [] component))
(set! (.-prototype component)
(js/Object.create (.-prototype js/HTMLElement)
#js {:connectedCallback
#js {:configurable true
:value
(fn []
(this-as this
@MageMasher
MageMasher / deps.edn
Created December 26, 2018 20:54 — forked from bmaddy/deps.edn
Playing around with caching
{:deps
{org.clojure/clojure {:mvn/version "1.10.0-RC5"}
#_#_org.clojure/spec.alpha {:mvn/version "0.2.176"}
#_#_org.clojure/test.check {:mvn/version "0.10.0-alpha3"}
org.clojure/core.cache {:mvn/version "0.7.1"}
org.clojure/core.memoize {:mvn/version "0.7.1"}
}}
@MageMasher
MageMasher / interceptor.clj
Created June 19, 2018 01:35 — forked from ohpauleez/interceptor.clj
An example of how to make conditional interceptors that enqueue new interceptors
;; Let's start with a simple conditional interceptor that works with functions...
(defn conditional-context
"Given a keyword name and any variable predicate and terminator function pairs,
return an interceptor that will apply the terminator function paired to the first
truthy predicate. Predicates and terminators are both given the context as
the only argument.
If all predicates fail, the original context is returned."
[name-kw & pred-terms]