diff options
Diffstat (limited to 'src/mulk/benki/util.clj')
-rw-r--r-- | src/mulk/benki/util.clj | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mulk/benki/util.clj b/src/mulk/benki/util.clj new file mode 100644 index 0000000..5b2e484 --- /dev/null +++ b/src/mulk/benki/util.clj @@ -0,0 +1,26 @@ +(ns mulk.benki.util + (:refer-clojure) + (:use [hiccup core page-helpers] + noir.core)) + + +(def fmt clojure.pprint/cl-format) + + +(defonce #^:private finished-initializations (atom #{})) + +(defmacro do-once [key & body] + `(while (not (@(deref #'finished-initializations) key)) + (let [fininit-copy# @(deref #'finished-initializations)] + (when (compare-and-set! (deref #'finished-initializations) + fininit-copy# + (conj fininit-copy# key)) + (do ~@body))))) + + +;; defpartial is just defn + html. +(defpartial layout [title & content] + (html5 + [:head [:title title]] + [:body [:h1 title] + content])) |