Skip to content

Instantly share code, notes, and snippets.

Gal Dolber galdolber

View GitHub Profile
View designer.html
<link rel="import" href="../code-mirror/code-mirror.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
:host {
position: absolute;
galdolber / macro-binding.clj
Last active Aug 29, 2015
Compile time bindings
View macro-binding.clj
(use 'clojure.walk)
(def ^:dynamic clazz)
(defmacro defout [& other]
(binding [clazz (first other)]
(let [other (mapv macroexpand-all other)]
(defmacro defin [& other]
galdolber / loc.clj
Created Mar 28, 2014
LOC metrics in clojure
View loc.clj
(use '[])
(defn walk [dirpath pattern]
(doall (filter #(re-matches pattern (.getName %))
(file-seq (file dirpath)))))
(->> (walk "src" #".*\.clj")
(map #(with-open [rdr (reader (file (.getPath %)))]
(count (line-seq rdr))))
galdolber / gist:5564961
Created May 12, 2013
Creates a clojure bimap from an map atom
View gist:5564961
(defn bimap [map-atom]
(let [inv-atom (atom {})]
(add-watch map-atom :bimap
(fn [k r old cur]
(let [o (set (keys old))
n (set (keys cur))]
(doseq [removed (difference o n)]
(swap! inv-atom dissoc (old removed)))
(doseq [added (difference n o)]
(swap! inv-atom assoc (cur added) added)))))
You can’t perform that action at this time.