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
| require 'uri' | |
| require 'rubygems' | |
| require 'fiber' | |
| require 'eventmachine' | |
| require 'em-http' | |
| #require 'net/http' | |
| #require "rest_client" |
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
| module Chainable | |
| # Specify a block to be executed if and when the Deferrable object receives | |
| # a status of :succeeded. See #set_deferred_status for more information. | |
| # | |
| # Calling this method on a Deferrable object whose status is not yet known | |
| # will cause the callback block to be stored on an internal list. | |
| # If you call this method on a Deferrable whose status is :succeeded, the | |
| # block will be executed immediately, receiving the parameters given to the | |
| # prior #set_deferred_status call. | |
| # |
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
| require 'rubygems' | |
| require 'sinatra/async' | |
| require 'memcached' | |
| cache = Memcached.new("localhost:11211") | |
| cache.set "test:Action:/delay/30", "NOT delayed for 30 seconds" | |
| class AsyncTest < Sinatra::Base | |
| register Sinatra::Async |
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
| #!/usr/bin/env ruby | |
| forbidden = ["~","~/Desktop"].collect { |path| File.expand_path path } | |
| target = File.expand_path ARGV[0] | |
| if forbidden.include? target | |
| puts "You don't REALLY want to open #{target} in TextMate, do you?" | |
| exit 1 | |
| else |
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
| / I'm horizontally scalable and naturally \ | |
| \ concurrent. / | |
| ----------------------------------------- | |
| \ | |
| \ \ | |
| \ /\ | |
| ( ) | |
| .( o ). |
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
| require 'rubygems' | |
| require 'mq' | |
| EM.error_handler {|e| | |
| p [:exception, e] | |
| if e.kind_of? AMQP::Error | |
| EM.add_timer(1) { | |
| AMQP.conn.reconnect | |
| } | |
| end |
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
| From a7b7aec29c5ac203c4f85d68fb9139fa05718107 Mon Sep 17 00:00:00 2001 | |
| From: Dane Jensen <[email protected]> | |
| Date: Fri, 19 Feb 2010 11:29:35 -0800 | |
| Subject: [PATCH 1/2] extconf.rb: hack arch for 32-bit karmic | |
| --- | |
| ext/extconf.rb | 5 ++++- | |
| 1 files changed, 4 insertions(+), 1 deletions(-) | |
| diff --git a/ext/extconf.rb b/ext/extconf.rb |
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
| I, [2010-02-25T20:12:46.175541 #25341] INFO -- : listening on addr=0.0.0.0:8080 fd=3 | |
| I, [2010-02-25T20:12:46.177609 #25341] INFO -- : Refreshing Gem list | |
| I, [2010-02-25T20:12:46.314437 #25341] INFO -- : Zbatery EventMachine worker_connections=100 | |
| I, [2010-02-25T20:12:46.314572 #25341] INFO -- : EventMachine: epoll=false kqueue=true | |
| sleepy.ru:9: [BUG] Segmentation fault | |
| ruby 1.9.2dev (2009-07-18 trunk 24186) [i386-darwin10.2.0] | |
| -- control frame ---------- | |
| c:0021 p:0007 s:0081 b:0081 l:001878 d:000080 LAMBDA sleepy.ru:9 | |
| c:0020 p:---- s:0078 b:0078 l:000077 d:000077 FINISH |
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
| pool = ::NB::FiberPool.new(10) | |
| ----------------------------- | |
| describe_instances | 2010-03-01 09:10:05 -0800 | 2010-03-01 09:10:08 -0800 | 2.784880 | |
| describe_key_pairs | 2010-03-01 09:10:05 -0800 | 2010-03-01 09:10:08 -0800 | 2.932863 | |
| describe_addresses | 2010-03-01 09:10:05 -0800 | 2010-03-01 09:10:08 -0800 | 2.936838 | |
| describe_regions | 2010-03-01 09:10:05 -0800 | 2010-03-01 09:10:08 -0800 | 2.946348 | |
| describe_volumes | 2010-03-01 09:10:05 -0800 | 2010-03-01 09:10:08 -0800 | 3.042942 | |
| describe_snapshots | 2010-03-01 09:10:05 -0800 | 2010-03-01 09:10:09 -0800 | 3.597881 | |
| describe_security_groups | 2010-03-01 09:10:05 -0800 | 2010-03-01 09:10:09 -0800 | 4.109160 | |
| describe_images | 2010-03-01 09:10:05 -0800 | 2010-03-01 09:10:21 -0800 | 16.524366 |
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
| module OptimisticLocking | |
| class StaleObjectError < Exception | |
| end | |
| def update | |
| dirty_attributes = self.dirty_attributes | |
| return true if dirty_attributes.empty? | |
| count = repository.update(dirty_attributes, to_query) | |
| if count == 1 | |
| return true |