Skip to content

Instantly share code, notes, and snippets.

group :development, :test do
if RUBY_PLATFORM =~ /darwin/i
gem 'growl', '1.0.3'
gem 'rb-fsevent', '0.4.3.1'
end
end
PUBNUB_QUEUE = GirlFriday::WorkQueue.new(:pubnub, size: 3) do |msg|
pubnub = Pubnub.new(TestApp::Application.config.pubnub_publish_key, TestApp::Application.config.pubnub_subscribe_key, TestApp::Application.config.pubnub_secret_key, false)
pubnub.publish({'channel' => msg[:channel], 'message' => msg[:message]})
end
# Here's how I push to the queue:
PUBNUB_QUEUE.push(channel: "room/123", message: {text: 'hello'})
# This is the gem code:
https://github.com/pubnub/pubnub-api/tree/master/ruby/
begin
timeout(3) do
GirlFriday::Batch.new(friends, size: 3) do |friend|
# perform some long running stuff
end
end
rescue Timeout::Error
# clean up needed?
end
doc = { "id": "4e57f6b213a773d89d000001", "full_name": "Fredrik Bjork", "nickname": "fbjork", "provider": "twitter", "friend_ids": "4e57f6b213a773d89d000002 4e57f6b213a773d89d000003"}
@fbjork
fbjork / gist:3455387
Created August 24, 2012 20:41 — forked from kapso/gist:3455336
Paths
{
"connections": [
{
"user_id": "4e4b1547a876e66e41000033",
"friend_id": "4e4b1547a876e66e41000011",
"providers": [
"facebook",
"twitter"
]
},

Keybase proof

I hereby claim:

  • I am fbjork on github.
  • I am fbjork (https://keybase.io/fbjork) on keybase.
  • I have a public key whose fingerprint is C4C8 667A 8114 4A79 8A62 9F33 378A 352B 7574 5FB6

To claim this, I am signing this object: