Skip to content

Instantly share code, notes, and snippets.

@dwwoelfel
Created August 1, 2014 06:31

Revisions

  1. dwwoelfel created this gist Aug 1, 2014.
    22 changes: 22 additions & 0 deletions utils.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    (defmacro html [body]
    `(if-not (:render-colors? initial-query-map)
    (html/html ~body)
    (let [body# ~body]
    (try
    (let [[tag# & rest#] body#
    attrs# (if (map? (first rest#))
    (first rest#)
    {})
    rest# (if (map? (first rest#))
    (rest rest#)
    rest#)]
    (html/html (vec (concat [tag# (assoc-in attrs# [:style :border] (str "5px solid rgb("
    (rand-int 255)
    ","
    (rand-int 255)
    ","
    (rand-int 255)
    ")"))]
    rest#))))
    (catch :default e#
    (html/html body#))))))