Skip to content

Instantly share code, notes, and snippets.

View noprompt's full-sized avatar
The choice to have discipline is a programmer's worst enemy.

Joel Holdbrooks noprompt

The choice to have discipline is a programmer's worst enemy.
View GitHub Profile
(defn do-tests []
(when (seq @cemerick.cljs.test/registered-tests)
(reset! cemerick.cljs.test/registered-tests {})))
noprompt / gist:9196002
Created February 24, 2014 20:09
NPE with CLJS-0.0-2173 and austin
java.lang.NullPointerException: null
at clojure.core$complement$fn__4048.invoke (core.clj:1357)
clojure.core$filter$fn__4226.invoke (core.clj:2529)
clojure.lang.LazySeq.sval (
clojure.lang.LazySeq.seq (
clojure.lang.RT.seq (
clojure.core$seq.invoke (core.clj:133)
clojure.core$map$fn__4207.invoke (core.clj:2479)
clojure.lang.LazySeq.sval (
clojure.lang.LazySeq.seq (
(defn- do-selector-fn []
(let [fn-sym (gensym "f")
arg (gensym "x")
invoke-specs (clojure.core/map
(fn [i syms]
(let [argslist (vec (take i syms))
body `(~fn-sym (str (p/selector ~arg)
(fn [sym]
`(p/selector ~sym))
(ns goog.css.datepicker
(:require [garden.stylesheet]
(garden.def/defstyles datepicker
".goog-date-picker th"
".goog-date-picker td"
{:font "13px Arial, sans-serif"}]
#!/usr/bin/env boot
#tailrecursion.boot.core/version "2.0.0"
:dependencies '[[org.clojure/tools.cli "0.3.1"]])
'[clojure.string :as string]
'[ :refer [parse-opts]])
out.noprompt=> lein repl
Retrieving org/clojure/tools.cli/0.2.4/tools.cli-0.2.4.pom from central
log4j:WARN No appenders could be found for logger (util.config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See for more info.
nREPL server started on port 57882 on host
REPL-y 0.3.0
Clojure 1.5.1
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
(defmacro defntraced
"Define a function with it's inputs and output logged to the console."
[sym & body]
(let [[_ _ [_ & specs]] (macroexpand `(defn ~sym ~@body))
new-specs (map
(fn [[args body]]
(let [prns (for [arg args]
`(js/console.log (str '~arg) "=" (pr-str ~arg)))]
(defmacro defmemmethod [sym k & body]
(let [[d s m k f] (macroexpand `(defmethod ~sym ~k ~@body))]
`(~d ~s ~m ~k (memoize ~f))))
(defn css-class->defhtml
"Given a css class return code for a defhtml."
(let [sym (symbol css-class)]
`(sablono.core/defhtml ~sym [& ~'content]
[:div {:class ~css-class} ~'content])))
^{:doc "Generated code for bootstrap defhtml. Covers .row,
.container, and all .col-<size>-<n> classes."}
(extend-protocol ISwap
(-swap! [this f]
(om/transact! this f))
(-swap! [this f a]
(om/transact! this #(f a)))
(-swap! [this f a b]
(om/transact! this #(f a b)))
(-swap! [this f a b xs]
(om/transact! this #(apply f a b xs))))