This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [: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)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (def bigrams (bucket/new | |
| {:type :bdb :merge (partial merge-with +) | |
| :flush-freq 60})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"Prismatic" {"runs" 1},"runs" {"on" 1}, | |
| "on" {"coffee" 1}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =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 |