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
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/sinatra/lib' | |
require 'sinatra' | |
Sinatra::Application.default_options.merge!( | |
:run => false, | |
:env => :development # ENV['RACK_ENV'] | |
) | |
require File.dirname(__FILE__) + '/../app/mailer.rb' | |
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 UsersController ... | |
def create | |
@user = User.create(params[:user]) | |
Notifier.deliver_activation(@user) | |
redirect_to :controller => :dashboard | |
rescue Exception => e | |
logger.error e | |
... | |
end | |
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
require File.dirname(__FILE__) + "/../app/mailer.rb" | |
set_option :run, false | |
set_option :env, ENV['APP_ENV'] || :development | |
run Sinatra.application | |
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
diff --git a/app/models/hot_slug.rb b/app/models/hot_slug.rb | |
index 9798a94..93718c0 100644 | |
--- a/app/models/hot_slug.rb | |
+++ b/app/models/hot_slug.rb | |
@@ -8,7 +8,14 @@ class HotSlug < ActiveRecord::Base | |
end | |
def railgun_slug | |
- RestClient::Resource.new("http://#{instance.local_ip}:1000/slugs/#{slug}", 'core', 'ASL938i54lDfU') | |
+ RestClient::Resource.new("http://#{instance.local_ip}:1000/slugs/#{slug}", :user => 'core', :password => 'ASL938i54lDfU', :headers => environment) |
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
# APP_ROOT/config/rackup.ru | |
require File.dirname(__FILE__) + "/../myapp" | |
set_option :run, false | |
set_option :env, :production | |
disable :reload | |
run Sinatra.application | |
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
remote = Rush::Box.new('root@ec2-75-101-233-253.compute-1.amazonaws.com') | |
remote.bash("ls") |
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 'sinatra' | |
require 'builder' | |
def home | |
content_type 'text/xml', :charset => 'utf-8' | |
builder do |xml| | |
xml.instruct! | |
xml.Response do | |
xml.Gather("numDigits" => "1", "action" => "press", "method" => "POST") do | |
xml.Say "For a good time, press 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 Post < Sequel::Model | |
one_to_many :taggings | |
many_to_many :tags, :join_table => :taggings | |
end | |
class Tag < Sequel::Model | |
one_to_many :taggings | |
end | |
class Tagging < Sequel::Model |
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
describe 'Bacon and Mocha sucks together' do | |
it "sucks when you have a spec using only mocha, not bacon, to assert something" do | |
str = 'a' | |
str.expects(:size) | |
str.size | |
end | |
end | |
# this raises Bacon::Error: empty specification | |
# after spending 20 minutes trying to fix I decided to just add |
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
var sys = require('sys'), | |
http = require('http'), | |
spawn = require('child_process').spawn | |
// this is a simple proxy | |
http.createServer(function(req, res) { | |
// and here is the problem: if I try to do any IO before | |
// proxying (like making another request or spawning) it | |
// freezes the whole thing. |
OlderNewer