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
#!/bin/sh | |
cd backend && make test | |
if [ $? -ne 0 ]; then | |
echo 'There was an error -- aborting commit.' | |
exit 1; | |
fi |
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 | |
# Creates iCalendar (ical) format output containing commits from a Git repo. | |
# Save as a file and import into Google Calendar or iCal on Mac. | |
# Publish on a webserver and link to Google Calendar directly. | |
# Install & Use: | |
# gem install grit icalendar | |
# chmod +x gitcal | |
# ./gitcal /path/to/repo > commits.ical |
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
#!/bin/sh | |
# git post-commit hook | |
# uses gitcal (see http://gist.github.com/605303) to publish an icalendar format file to a server | |
# once on the web, you can easily link Google Calendar and see your commit log on GCal! | |
~/bin/gitcal | ssh [email protected] "sh -c 'cat > /var/www/htdocs/commits.ical'" |
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
Index: History.txt | |
=================================================================== | |
--- History.txt (revision 26) | |
+++ History.txt (working copy) | |
@@ -1,3 +1,7 @@ | |
+== 0.3.2 2010-10-18 | |
+* 1 minor enhancement: | |
+ * Removed Object#returning in favor of Ruby's built-in Object#tap. | |
+ | |
== 0.3.1 2008-04-03 |
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 Person < ActiveRecord::Base | |
default_scope where(:deleted => false) | |
end | |
Person.all | |
# => SELECT "people".* FROM "people" WHERE ("people"."deleted" = 'f') | |
Person.unscoped { Person.all } | |
# => SELECT "people".* FROM "people" |
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 Person < ActiveRecord::Base | |
cattr_accessor :current_site_id | |
default_scope where(:site_id => Person.current_site_id) | |
end | |
Person.current_site_id = 1 | |
Person.all | |
# => SELECT "people".* FROM "people" WHERE ("people"."site_id" IS NULL) |
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 Person < ActiveRecord::Base | |
cattr_accessor :current_site_id | |
default_scope lambda { where(:site_id => Person.current_site_id) } | |
end | |
Person.current_site_id = 1 | |
Person.all | |
# => SELECT "people".* FROM "people" WHERE ("people"."site_id" = 1) | |
Person.current_site_id = 2 |
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
# patch for Webrat::Selenium support on Rails 3 | |
# mongrel_rails won't run a Rails 3 app | |
module Webrat | |
module Selenium | |
module ApplicationServers | |
class Rails < Webrat::Selenium::ApplicationServers::Base | |
def start_command | |
"cd #{::Rails.root} && rails server -d --port=#{Webrat.configuration.application_port} --environment=#{Webrat.configuration.application_environment} --pid #{pid_file}" | |
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
# RVM support in Rails 3 app for multiple gemsets with Passenger | |
# config/setup_load_paths.rb | |
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) |
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 'oauth' | |
require 'oauth/consumer' | |
require 'oauth/signature/rsa/sha1' | |
APP_URL = 'http://example.com' | |
OAUTH_KEY = 'key' | |
OAUTH_SECRET = 'secret' | |
OAUTH_APP_NAME = 'MyAppName' | |
get '/auth' do |