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
EventedNet::HTTP.get(URI.parse('http://www.google.com'), :callback => Proc.new {|status, body| puts "Status: #{status}, Body: #{body}" }) |
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
$ gem sources -a http://gems.github.com (you only have to do this once) | |
$ sudo gem install arunthampi-evented_net |
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
# To look at commits which haven't been pushed to remote | |
# I use an alias for lesser typing | |
$> alias grd='gitx origin/master..' | |
$> grd | |
# Another command I found helpful is git diff | gitx | |
# For which I use another alias gdm (this historically used to be an alias | |
# for git diff | mate) hence the m | |
$> alias gdm='git diff | gitx' | |
$> gdm |
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
puts "fart" |
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
function(doc) { | |
// This view gets all threads and its associated replies | |
if(doc.type == 'thread') { | |
emit([doc._id, doc.time_created], doc); | |
} else if(doc.type == 'reply') { | |
emit([doc.thread_id, doc.time_created], doc); | |
} | |
} |
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
{ | |
"rows": [ | |
{ "key" : "IDT1", "value" : { "Summary Object for Thread 1" }, | |
{ "key" : "IDT2", "value" : { "Summary Object for Thread 2" }, | |
{ "key" : "IDT3", "value" : { "Summary Object for Thread 3" }, | |
{ "key" : "IDT4", "value" : { "Summary Object for Thread 4" } | |
] | |
} |
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
IDT1 = ID of Thread 1, T1 = Thread 1, RT1 = Reply 1 to Thread 1, RT2 = Reply 2 to Thread 1, RT3 = Reply 3 to Thread 1, IDR1 = ID of Reply 1, IDR2 = ID of Reply 2, IDR3 = ID of Reply 3 | |
Remember that the inputs to a reduce function are like so: | |
Parameter 1: key : Array whose elements are of the form [key, id] where key is the key emitted by the map function and id is the ID of the document from which the key is generated | |
Parameter 2: values : Array of values returned by previous calls to the reduce function (OR) array of values emitted for respective elements in keys | |
Parameter 3: rereduce : Can be either true or false | |
Scenario 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
$ tar -zxf nginx-0.6.35.tar.gz | |
$ tar -xzf ngx_max_connections-0.0.5.tar.gz | |
$ cd nginx-0.6.35 | |
$ patch -p0 < ../ngx_max_connections-0.0.5/patches/nginx-0.6.35.patch | |
$ cd ../ngx_max_connections-0.0.5 | |
$ vim Makefile #### edit the first line! | |
$ make configure | |
$ make | |
$ make test #### requires ruby, rubygems, rack, and httperf |
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
$> patch -p0 < ../ngx_max_connections-0.0.5/patches/nginx-0.6.35.patch |
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
$> ./configure --add-module=../ngx_max_connections-0.0.5 | |
$> make | |
$> sudo make install |