This file contains 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
From bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001 | |
From: Ilya Grigorik <[email protected]> | |
Date: Thu, 10 Jun 2010 00:46:48 -0400 | |
Subject: [PATCH] async rails3 | |
--- | |
Gemfile | 6 ++++++ | |
app/controllers/widgets_controller.rb | 6 ++++++ | |
app/models/widget.rb | 2 ++ | |
config.ru | 1 + |
This file contains 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
class SomeMigrator | |
def migrator | |
lambda do |some_object| | |
{:previous_object => some_object} | |
end | |
end | |
end | |
migrators = [SomeMigrator.new.migrator, SomeMigrator.new.migrator] | |
original_object = "original object" |
This file contains 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
module Praized | |
module Slingshot | |
module Retryable | |
# execute retryable code block | |
# thanks to http://blog.codefront.net/2008/01/14/retrying-code-blocks-in-ruby-on-exceptions-whatever/ fo original idea | |
# @param [Hash] options retryable options | |
# @option options [Fixnum] :tries retries to perform, default 1. | |
# @option options [Exception] :on exception on which a retry will be performed, defaults is Exception, which retries on any Exception. |
This file contains 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
{ | |
hose_name => [ | |
{ | |
hose: hose_name, | |
title: 'Atlanta twitter content search', | |
entries_samples: [1,...], | |
polls_samples: [1,...], | |
entries_total : 345211, | |
polls_total : 44556 | |
}, |
This file contains 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
module App | |
module Global | |
extend self | |
def self.configure(&block) | |
instance_eval(&block) | |
end | |
def [](key) | |
config[key] |
This file contains 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
#!/usr/bin/env jruby | |
# | |
# | |
require 'rubygems' | |
require 'spoon' | |
EXEC = '/tmp/exec.rb' | |
PID_PATH = '/tmp/exec.pid' | |
WORK_PATH = '/tmp/' |
This file contains 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
require 'rubygems' | |
require 'benchmark' | |
line_count = 0 | |
elapsed = Benchmark.realtime do | |
while (line = $stdin.gets) | |
puts(line) | |
line_count += 1 | |
end |
This file contains 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
# this is to demonstrate the partial multipart message reception problem. | |
# in my environment, items will be dropped as expected and also | |
# partial messages will be received which should not happen per 0MQ | |
# atomicity semantic. | |
# | |
# usage: ruby multipart.rb {pub|sub} | |
# | |
# tested using JRuby 1.6.0, 0MQ 2.1.3, ffi-rzmq 0.7.2 on OSX 10.6.7 | |
# | |
# Colin Surprenant [email protected], http://github.com/colinsurprenant |
This file contains 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
require 'rubygems' | |
require 'spoon' | |
Spoon.spawnp 'jruby', *ARGV |
This file contains 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
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
OlderNewer