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)
(cemerick.cljs.test/run-tests)
(reset! cemerick.cljs.test/registered-tests {})))
@noprompt
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 (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.RT.seq (RT.java:484)
clojure.core$seq.invoke (core.clj:133)
clojure.core$map$fn__4207.invoke (core.clj:2479)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
(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)
~@(clojure.core/map
(fn [sym]
`(p/selector ~sym))
(ns goog.css.datepicker
(:require [garden.stylesheet]
[garden.units]
[garden.def]))
(garden.def/defstyles datepicker
[".goog-date-picker"
".goog-date-picker th"
".goog-date-picker td"
{:font "13px Arial, sans-serif"}]
#!/usr/bin/env boot
#tailrecursion.boot.core/version "2.0.0"
(set-env!
:dependencies '[[org.clojure/tools.cli "0.3.1"]])
(require
'[clojure.string :as string]
'[clojure.tools.cli :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 http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
nREPL server started on port 57882 on host 127.0.0.1
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)))]
(list
args
(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."
[css-class]
(let [sym (symbol css-class)]
`(sablono.core/defhtml ~sym [& ~'content]
[:div {:class ~css-class} ~'content])))
(def
^{:doc "Generated code for bootstrap defhtml. Covers .row,
.container, and all .col-<size>-<n> classes."}
(extend-protocol ISwap
om/MapCursor
(-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))))