I hereby claim:
- I am telekid on github.
- I am hz (https://keybase.io/hz) on keybase.
- I have a public key whose fingerprint is F082 2071 15C0 9FFE 7BE7 A564 44FB E872 507C B25C
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
.c { | |
color: blue; | |
.b & { | |
color: red; | |
} | |
} | |
.test { | |
color: green; |
A Pen by Jake Zerrer on CodePen.
function factory() { | |
return { | |
method: method, | |
}; | |
var name = "hello"; | |
function method() { | |
console.log(name); | |
} |
{'myGeopoint': | |
{'$geoWithin': | |
{'$box': | |
[ | |
[sw_longitude, sw_latitude], | |
[ne_longitude, ne_latitude] | |
] | |
} | |
} | |
} |
{'preferences.myGeoPolygon': | |
{'$geoIntersects': | |
{'$geometry': | |
{'type': 'Point', | |
'coordinates': [job.longitude, job.latitude] | |
} | |
} | |
} | |
} |
;; Spec's global ns registry makes it challenging to declare multiple instances | |
;; of the same concept in the same ns. For example, say I want to define specs | |
;; for multiple continents in (ns models.geography.continent). Different continents | |
;; have different animal populations, so they require different animal counts: | |
(ns models.geography.continent | |
(:require [models.animals :as animals])) | |
;; First, we define a spec for Antarctica: |
(require '[clojure.spec.alpha :as s] | |
'[clojure.spec.test.alpha :as spec.test]) | |
;; In Clojure, multimethods are designed to be open for extension. That means that | |
;; a library author can define a function, and then consumers of that library | |
;; can extend it arbitrarily by defining additional implementations of that function. | |
;; | |
;; However, there isn't a ton of documentation floating around that describes how | |
;; to properly spec functions in an open way. This gist provides an example of doing | |
;; just that; it defines a function called `magic`, and then extends it with two |
(ns automatic-differentiation | |
"Perform simple automatic differentiation with dual numbers using the | |
technique described here: | |
https://blog.demofox.org/2014/12/30/dual-numbers-automatic-differentiation/" | |
(:require [clojure.walk :refer [postwalk postwalk-replace]])) | |
(defn dual-add [[ar ad] [br bd]] | |
[(+ ar br) (+ ad bd)]) | |
(defn dual-subtract [[ar ad] [br bd]] |
(defn hi [name] (println "hello " name)) | |
(s/def ::hi-args (s/cat :name string?)) | |
(def registry {`hi ::hi-args}) | |
(defn instrument [] | |
(s/check-asserts true) | |
(for [[sym spec] registry] | |
(alter-var-root (find-var sym) |