Skip to content

Instantly share code, notes, and snippets.

View travis's full-sized avatar

Travis Vachon travis

View GitHub Profile
(defbolt serialize-feed ["id" "feed"] [tuple collector]
(serialize tuple collector)
(ack! collector tuple))
(defbolt active-user-bolt ["id" "user-ids" "story"] {:prepare true}
[conf context collector]
(let [redii (redis/redii)]
(bolt
(execute [{id "id" story "story" :as tuple}]
(doseq [user-id (active-users redii)]
(emit-bolt! collector [id user-id story] :anchor tuple))
(ack! collector tuple)))))
(deref feed-atom)
=> {..digest datastructure..}
@feed-atom
=> {..digest datastructure..}
(swap! feed-atom
(fn [feed-atom] (update feed-atom)))
=> {..updated digest datastructure..}
(topology
{"actions" (spout-spec resque-spout)}
{"users" (bolt-spec {"actions" :shuffle}
user-bolt
:p 4)
"likes" (bolt-spec {"users" :shuffle}
like-interest-scorer
:p 12)
:dependencies [[tvachon/enlive "1.0.2"]
[compojure "1.1.1"]
[korma "0.2.1"]
[lobos "1.0.0-SNAPSHOT"]
[postgresql "9.0-801.jdbc4"]
[oauth-clj "0.0.7-SNAPSHOT"]
[clojurewerkz/urly "1.0.0"]
[org.clojure/clojure "1.4.0"]]
Test 1 2 3
==> riakc (compile)
Compiling src/riakclient.proto
=INFO REPORT==== 5-Jun-2012::02:03:08 ===
Writing header file to "riakclient_pb.hrl"
=INFO REPORT==== 5-Jun-2012::02:03:08 ===
Writing beam file to "riakclient_pb.beam"
Compiled src/riakc_obj.erl
Compiled src/riakc_pb.erl
@travis
travis / gist:2630164
Created May 7, 2012 20:23
moar plugin install s3-wagon-private
→ mv ~/.lein ~/.lein.bak
→ mv ~/.m2 ~/.m2.bak
→ lein --version
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3165k 100 3165k 0 0 42300 0 0:01:16 0:01:16 --:--:-- 83370
./bin/lein: line 144: sha1sum: command not found
WARNING: Clojure jar failed to download from http://build.clojure.org/releases/org/clojure/clojure/1.2.1/clojure-1.2.1.jar
@travis
travis / gist:2630078
Created May 7, 2012 20:09
lein plugin install s3-wagon-private 1.1.1
→ lein version
Leiningen 1.7.1 on Java 1.6.0_31 Java HotSpot(TM) 64-Bit Server VM
→ lein plugin install s3-wagon-private 1.1.1
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jline.ConsoleRunner.main(ConsoleRunner.java:69)
@travis
travis / gist:1717861
Created February 1, 2012 16:26
earliest per session
(let [x [[1 3 :a]
[1 4 :b]
[2 5 :c]
[2 6 :d]]]
(<- [?session-id ?time ?dataz]
;; do stuff
)) =>
;; gets the first from each group [defined by the first column] based on the
;; value of the second column, and carries the third column's data along
(produces [[1 3 :a] [2 5 :c]])