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
begin | |
token = generate_random_token | |
end while User.find_by_token(token).nil? |
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
# install git | |
sudo apt-get install g++ curl libssl-dev apache2-utils libapache2-mod-wsgi | |
sudo apt-get install git-core | |
# download the Node source, compile and install it | |
git clone https://github.com/joyent/node.git | |
cd node | |
./configure | |
make | |
sudo make install | |
# install the Node package manager for later use |
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
#!/bin/bash | |
############################################################################ | |
# Script to open a directory in TextMate excluding certain directories that | |
# tend to slow down the Find in Project... function. | |
# | |
# Place in an executable loctation with a name of your choosing. | |
# I use `ate' and have it in ~/Local/bin (which has been added to $PATH) | |
# | |
# NTW: from here: https://gist.github.com/111999 |
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
module ActiveRecord | |
module Associations | |
class HasManyThroughAssociation < HasManyAssociation | |
protected | |
# added support for STI with polymorphism | |
def construct_conditions | |
table_name = @reflection.through_reflection.quoted_table_name | |
conditions = construct_quoted_owner_attributes(@reflection.through_reflection).map do |attr, value| | |
if attr =~ /_type$/ | |
construct_polymorphic_sql(table_name, attr) |
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
# allows the 'sc' commands to work for both Rails 2.x and Rails 3 | |
# not mine, found it somewhere online but can't remember where | |
function sc { | |
if [ -e script/rails ]; then | |
script/rails console $@ | |
else | |
script/console $@ | |
fi | |
} |
NewerOlder