Skip to content

Instantly share code, notes, and snippets.

View pengwynn's full-sized avatar

Wynn Netherland pengwynn

View GitHub Profile
# include this in application controller
module Authentication
protected
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
end
# Returns true or false if the user is signed in.
# Set up .gitignore
file '.gitignore', <<-GITIGNORE
config/database.yml
log/*.log
tmp/**/*
.DS\_Store
.DS_Store
db/test.sqlite3
db/development.sqlite3
/log/*.pid
run "rm public/index.html"
generate(:rspec)
generate(:cucumber)
plugin 'resource_controller', :git => 'git://github.com/jamesgolick/resource_controller.git'
plugin 'flash-message-conductor', :git => 'git://github.com/planetargon/flash-message-conductor.git'
gem "formtastic"
gem "pickle"
gem "machinist"

Rails Dev Stack on Snow Leopard

(from a scratch install). Kinda, I imported my user home (~) from a Time Machine backup.

Homebrew

sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
# with homebrew
mysql_install_db # set it up
cd /usr/local/Cellar/mysql/5.1.41 ; /usr/local/Cellar/mysql/5.1.41/bin/mysqld_safe & # start it
sudo gem uninstall mysql
# specify ARCHFLAGS and homebrew mysql_config location
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/Cellar/mysql/5.1.41/bin/mysql_config
# see http://github.com/intridea/oauth2
require 'rubygems'
require 'sinatra'
require 'oauth2'
require 'json'
class ConnectionLogger < Faraday::Middleware
def call(env)
env[:response].on_complete do |env|
puts "RESULT: #{env[:status]}\n#{env[:body]}"
SELECT "drawings".* FROM "drawings"
INNER JOIN "assignment_tag_drawings" ON ("drawings"."id" = "assignment_tag_drawings"."drawing_id")
INNER JOIN "assignment_tags" ON ("assignment_tags"."id" = "assignment_tag_drawings"."assignment_tag_id")
WHERE (drawings.assignment_id = 12
AND assignment_tags.umbrella_category_id in ('29'))
GROUP BY drawings.id
HAVING count(DISTINCT umbrella_category_id) = 1
source :rubygems
gem 'sinatra', '1.0'
gem 'gowalla', '~> 0.2.0'
group :development do
gem 'shotgun'
end
$ bundle exec rake
(in /Users/erik/projects/twitter)
/opt/local/bin/ruby -I"lib:test" -rubygems "/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/twitter/base_test.rb" "test/twitter/geo_test.rb" "test/twitter/oauth_test.rb" "test/twitter/request_test.rb" "test/twitter/search_test.rb" "test/twitter/trends_test.rb" "test/twitter/unauthenticated_test.rb" "test/twitter_test.rb"
/Users/erik/projects/faraday-middleware/lib/faraday_middleware.rb:4: warning: already initialized constant VERSION
Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
EEEEEEEEEEEEEEEEEEEEEEEEEEE...EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE..........EFFFFFFFFFEEE........EE.EEEEEE........EE...E.E......E.EEEEE.E.EEEEEEEEEEEEE..EEEEEEFFFFEEE
Finished in 0.214691 seconds.
1) Error:
# 2010-10-01
#
# Mac OS X 10.6.3
# Homebrew 0.7
# Xcode 3.2.4
# Git 1.7.3.1
# RVM 1.0.12
# Ruby 1.9.2, 1.8.7
# Rails 3.0.0
# Passenger 3.0.0.pre4