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
Warden::Manager.serialize_into_session{|user| user.id } | |
Warden::Manager.serialize_from_session{|id| User.get(id) } | |
Warden::Manager.before_failure do |env,opts| | |
# Sinatra is very sensitive to the request method | |
# since authentication could fail on any type of method, we need | |
# to set it for the failure app so it is routed to the correct block | |
env['REQUEST_METHOD'] = "POST" | |
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
Warden::Strategies.add(:bcrypt) do | |
def valid? | |
params[:username] || params[:password] | |
end | |
def authenticate! | |
return fail! unless user = User.first(:username => params[:username]) | |
if user.encrypted_password == params[:password] | |
success!(user) |
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/model.rb b/app/models/model.rb | |
new file mode 100644 | |
index 0000000..14c4620 | |
--- /dev/null | |
+++ b/app/models/model.rb | |
@@ -0,0 +1,2 @@ | |
+class Model < Sequel::Model | |
+end | |
\ No newline at end of file | |
diff --git a/config/application.rb b/config/application.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
PID_DIR = '/srv/myapp/shared/pids' | |
RAILS_ENV = ENV['RAILS_ENV'] = 'production' | |
RAILS_ROOT = ENV['RAILS_ROOT'] = '/srv/myapp/current' | |
BIN_PATH = "/home/rails/.rvm/gems/ree-1.8.7-2010.02/bin" | |
God.log_file = "#{RAILS_ROOT}/log/god.log" | |
God.log_level = :info | |
%w(unicorn resque).each do |config| | |
God.load "#{RAILS_ROOT}/config/god/#{config}.god" |
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 'spec/runner/formatter/progress_bar_formatter' | |
class NescafeFormatter < Spec::Runner::Formatter::ProgressBarFormatter | |
def example_failed(example, counter, failure) | |
super | |
dump_failure(counter, failure) | |
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
#!/usr/bin/env ruby | |
begin | |
require 'rev' | |
rescue LoadError | |
puts "############## WARNING!!! ##############" | |
puts "You do not have the rev gem installed.\nIt is highly recommended to install this." | |
puts "The rev gem uses filesystem events rather than cpu polling to see if files have changed." | |
puts "\n" | |
puts "Please run `gem install rev` to install" |
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' | |
['wirble-0.1.3', 'awesome_print-0.2.1'].each do |g| | |
$:.unshift("/usr/local/lib/ruby/gems/1.8/gems/#{g}/lib") | |
end | |
require 'ap' | |
require 'wirble' | |
Wirble.init | |
Wirble.colorize |
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
# A sample Gemfile | |
source "http://rubygems.org" | |
gem "redis" | |
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git' | |
gem "em-hiredis" | |
# gem "em-synchrony" | |
gem "em-websocket" |
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
// NOTE: You need dotjs installed to use this: https://github.com/defunkt/dotjs | |
// | |
// You must name this file with your airbrakeapp subdomain prepended to the filename. | |
// Example: So myairbrakesubdomain.airbrakeapp.com.js | |
var login = "<GITHUB USERNAME>"; | |
var token = "<GITHUB TOKEN>"; | |
var title = $("#notice_heading h2").text(); | |
var link = document.location.href; |
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
// Adds a live filter box to the results screen on craigslist | |
// that filters the results that are currently on the page by | |
// the search term. Like Cmd-F, but better. | |
// NOTE: Requires dotjs. | |
// Cmd-F live search | |
var searchBox = $('<input type="text" id="result-search" />') | |
$("h4.ban:first").before(searchBox) |
OlderNewer