Skip to content

Instantly share code, notes, and snippets.


Yehonathan Sharvit viebel

View GitHub Profile
viebel / spec_example.cljs
Last active Apr 27, 2017 — forked from bhb/spec-example.clj
Recursive spec with clojure.spec
View spec_example.cljs
(ns viebel.gist-57d9ebad3381e727c2f0a373e1bd4eec.raw.spec-example
(:require [cljs.spec :as s]))
(s/def ::tag (s/cat :type #{:div}
:attrs map?
:children (s/spec (s/* ::tag))))
(s/explain ::tag [:div {} [[:div {} []]]])
;; In: [2 0] val: [:div {} []] fails spec: _ at: [:children :type] predicate: #{:div}
viebel / regex_as_a_function.cljs
Last active Jun 10, 2016 — forked from alandipert/reinvoke.cljs
Make a regex behave like a function
View regex_as_a_function.cljs
; Make a regex behave like a function
; Inspired by:
(extend-type js/RegExp
(-invoke ([this s] (re-find this s))))
(#"clojure" "clojurescript")
You can’t perform that action at this time.