Skip to content

Instantly share code, notes, and snippets.

(deftemplate accounts-view
[accounts]
[:h1 "This is a simple template Brendan!"]
[:h2 "Accounts go here...!"]
(for [a accounts]
[:div.account-info
[:h2 (:name a)]
[:p (str a)]]))
(append! (sel1 :#content) (accounts-view @(account)))
(deftemplate accounts-info
[accounts]
[:div#account-info
[:h1 "Remember this template...? It's back!"]
[:h2 [:strong "And better than ever!"]]
[:h2 "Accounts go here...!"]
(when (zero? (count accounts))
[:p "Aww, shucks. No accounts have been fetched yet!"])
(for [a (sort-by :name accounts)]
[:div.account-info
(defcomponent Metric [resource entity metric-name metric]
ui/IComponent
(-create-dom
[this]
[:ul.list-group
[:li.list-group-item
[:h5.metric-header.list-group-item-heading (str "0 " metric-name)]]
[:li.list-group-item [:small.list-group-item-text "$0.00 CPE"]]
[:li.list-group-item
[:small.list-group-item-text "$0.00 " "Engagement Rate"]]])
(defn make-scrollable
[]
(let [matching-rules (clojure.set/select #(= (.-selectorText %) "html, body")
(set (css/getAllCssStyleRules)))
rule (first matching-rules)]
(set! (-> rule .-style .-overflowY) "auto")))
(defn fix-body
[kvs]
(-> (reduce-kv (fn [init k v]
(assoc init (clojure.string/replace (name k) #"-" "_") v))
{} kvs)
(clj->js)
(JSON.stringify)))
if (this.document == null || this.document == undefined) {
if (typeof COMPILED == 'undefined') {
CLOSURE_BASE_PATH = '../cljs/goog/';
}
importScripts(
'./webworkers.js',
CLOSURE_BASE_PATH + 'base.js',
CLOSURE_BASE_PATH + 'deps.js',
(defn render-event-enter [r [_ path transform-name messages] input-queue]
(let [control-id (render/get-id r (conj path "control"))
button-id (render/new-id! r (conj path "control" transform-name))]
(let [messages (map (partial msg/add-message-type transform-name) messages)
syms (msg/message-params messages)]
(assert input-queue "Input-Queue is nil")
(d/append! (d/by-id control-id)
(str "<a class='btn btn-primary' style='margin-top:5px;margin-right:5px;' "
"id='" button-id "'>"
(def b1 '[3 - - - - 5 - 1 -
- 7 - - - 6 - 3 -
1 - - - 9 - - - -
7 - 8 - - - - 9 -
9 - - 4 - 8 - - 2
- 6 - - - - 5 - 1
- - - - 4 - - - 6
- 4 - 7 - - - 2 -
- 2 - 6 - - - - 3])
(defn get-square [rows x y]
(for [x (range x (core/+ x 3))
y (range y (core/+ y 3))]
(get-in rows [x y])))
(defn init [vars hints]
(if (seq vars)
(let [hint (first hints)]
(all
(if-not (zero? hint)
(deftest unify-nil-object-1
(is (= (l/unify empty-s nil 1) nil)))
;;... and more tests
;; interactively run tests in the REPL
(run-tests)
;; returns this
Ran 340 tests containing 368 assertions.
0 failures, 0 errors.