Skip to content

Instantly share code, notes, and snippets.

Gal Dolber galdolber

Block or report user

Report or block galdolber

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fix.sh
killall ssh-agent gpg-agent
unset GPG_AGENT_INFO SSH_AGENT_PID SSH_AUTH_SOCK
eval $(gpg-agent --daemon --enable-ssh-support)
gpg --batch --decrypt ~/.lein/credentials.clj.gpg
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">
<template>
<style>
:host {
position: absolute;
@galdolber
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)]
`(~@other))))
(defmacro defin [& other]
@galdolber
galdolber / loc.clj
Created Mar 28, 2014
LOC metrics in clojure
View loc.clj
(use '[clojure.java.io])
(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
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.