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
166:nanite blakemizerany$ ./bin/nanite | |
"advertise_services" | |
[] | |
/Users/blakemizerany/.gems/gems/amqp-0.5.9/lib/amqp/client.rb:72:in `connection_completed': Disconnected from server (AMQP::Error) | |
from /Users/blakemizerany/.gems/gems/amqp-0.5.9/lib/amqp/client.rb:80:in `call' | |
from /Users/blakemizerany/.gems/gems/amqp-0.5.9/lib/amqp/client.rb:80:in `unbind' | |
from /Users/blakemizerany/.gems/gems/eventmachine-0.12.2/lib/eventmachine.rb:932:in `call' | |
from /Users/blakemizerany/.gems/gems/eventmachine-0.12.2/lib/eventmachine.rb:932:in `run_deferred_callbacks' | |
from /Users/blakemizerany/.gems/gems/eventmachine-0.12.2/lib/eventmachine.rb:932:in `times' | |
from /Users/blakemizerany/.gems/gems/eventmachine-0.12.2/lib/eventmachine.rb:932:in `run_deferred_callbacks' |
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
Thread.new do | |
until EM.reactor_running? | |
sleep 1 | |
end | |
AMQP.start :host => the_ip, :user => 'myuser', :pass => 'sompass!', | |
:vhost => '/nanite' | |
Nanite.identity = Nanite.gensym | |
Nanite.mapper = Nanite::Mapper.new(15) | |
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
class String | |
def space_case | |
gsub(/([a-z]|[A-Z]+)([A-Z])/){ "#{$1} #{$2}" } | |
end | |
def snake_case | |
gsub(/\B[A-Z][^A-Z]/, '_\&').downcase.gsub(' ', '_') | |
end | |
end | |
class Graph |
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' | |
require 'json' | |
EM.run do | |
AMQP.start(:vhost => '/heroku', | |
:user => 'face', | |
:pass => 'thisisheroku!') | |
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 File.dirname(__FILE__) + "/../myapp.rb" | |
disable :run, :reload | |
set :env, :production | |
run Sinatra.application |
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 'eventmachine' | |
module TapsClient | |
def post_init | |
send_data("hey!") | |
end | |
def receive_data(data) | |
p [Time.now, data] |
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
sudo env ARCHFLAGS="-arch i386" gem install pg -- --with-pgsql-lib=/opt/local/lib/postgresql83 --with-pgsql-include=/opt/local/include/postgresql83 |
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
# meh is a rainy day experiment with atom and twitter | |
#---------------------------------------------------- | |
#use latest version of sinatra | |
$:.unshift File.dirname(__FILE__) + '/sinatra/lib' | |
require 'rubygems' | |
require 'sinatra' | |
require 'net/http' | |
require 'uri' |
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
# RAILS_ROOT/racked.rb | |
require File.dirname(__FILE__) + '/config/environment' | |
require 'thin' | |
# Sinatra stuff | |
require 'tiny' | |
# Make sinatra play nice | |
set :env, :production | |
disable :run, :reload |
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 File.dirname(__FILE__) + "/../main" | |
Blog.admin_password = 'supersecret' | |
set :app_file, File.expand_path(File.dirname(__FILE__) + '/../main.rb') | |
set :public, File.expand_path(File.dirname(__FILE__) + '/../public') | |
set :views, File.expand_path(File.dirname(__FILE__) + '/../views') | |
set :env, :production | |
disable :run, :reload | |