Skip to content

Instantly share code, notes, and snippets.

[:head
[:meta {:charset "UTF-8"}]
[:title "Prismatic"]
(element/include-css "/style/landing.css")]
[:body
[:img.product {:src "/img/landing.jpg"}]
(map element/javascript-tag scripts)]
head
meta(charset= 'UTF-8')
title Prismatic
link(rel="stylesheet", type="text/css", href=cdnAsset("/style/landing.css"), media="all")
body
img.product(src=cdnAsset("/img/landing.jpg"))
- each file in scripts
script(type='text/javascript', src=cdnAsset(file))
@aria42
aria42 / fnk_examples.clj
Created October 1, 2012 21:29 — forked from w01fe/fnk_examples.clj
Bring on the fnk
(defnk foo [x y [s 1]]
(+ x (* y s)))
(foo {:x 2 :y 3 :s 2})
;; ==> 8
(foo {:x 2 :y 3})
;; 's' defaulted to 1
;; ==> 5
(defn map-reduce [map-fn reduce-fn n xs]
(let [bspec {:type :mem :merge reduce-fn}
bs (repeatedly n #(bucket/new bspec))
work (fn [b x]
(doseq [[k v] (map-fn x)]
(bucket/merge b k v)))
;; each worker gets own bucket
;; so no contention
workers (map #(partial work %) bs)]
;; workers process xs in par, blocking
(def bigrams (bucket/new
{:type :bdb :merge (partial merge-with +)
:flush-freq 60}))
{"Prismatic" {"runs" 1},"runs" {"on" 1},
"on" {"coffee" 1}}
(defn map-reduce [map-fn reduce-fn n xs]
(let [bspec {:type :mem :merge reduce-fn}
bs (repeatedly n #(bucket/new bspec))
work (fn [b x]
(doseq [[k v] (map-fn x)]
(bucket/merge b k v)))
workers (map #(partial work %) bs)]
;; workers process xs in par, blocking
(do-work workers xs)
;; merge all bucket users
;; bigrams bucket: keys are words,
;; values are map of word counts
(def bigrams
(bucket/new
{:type :mem
;; merge value maps with +
:merge (partial merge-with +)}))
;; For each word, count following words
(doseq [[word next-word]
;; bigrams key is a word and value
;; is a map of word counts
;; merge operation is merging map values with +
(def bigrams
(bucket/new
{:type :mem
:merge (partial merge-with +)}))
;; For each word, count following words
(doseq [[before after]
=ERROR REPORT==== 29-Apr-2011::04:46:03 ===
[{application,mochiweb},"Accept failed error","{error,emfile}"]
=CRASH REPORT==== 29-Apr-2011::04:46:03 ===
crasher:
initial call: mochiweb_acceptor:init/3
pid: <0.3715.4>
registered_name: []
exception exit: {error,accept_failed}
in function mochiweb_acceptor:init/3
in call from proc_lib:init_p_do_apply/3