Skip to content

Instantly share code, notes, and snippets.

@rtecco
rtecco / gist:9945119
Last active August 29, 2015 13:58
weird thing
/*
For readersCount == 4, you might see 4 "added reader" (0 through 3) or just one, or three, etc. Like it's blocking somewhere... The readers that do initialize process messages just fine. All of the nsqlookupd hosts respond to /ping.
*/
for i := 0; i < readersCount; i++ {
r, err := nsq.NewReader(topic, channel)
if err != nil {
log.Fatalln("nsq.NewReader:", err)
@rtecco
rtecco / destr.rb
Created November 22, 2011 17:58 — forked from blambeau/destr.rb
Fun destructuring in Ruby 1.9
class Hash
def with(&block)
block.call *block.parameters.map{|x| self[x.last]}
end
end
# Example
h = {:name => "blambeau", :hobby => "ruby"}