Skip to content

Instantly share code, notes, and snippets.

View johnantoni's full-sized avatar

John Griffiths johnantoni

View GitHub Profile
function addScript(url) {
var script = document.createElement('script');
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
}
or
script/generate cucumber :setup cucumber in your app
cucumber features -n :test against /features
script/generate rspec_model Article title:string content:text
..generate rspec model + db migrations
rake db:migrate :migrate database
rake db:test:clone :clone migrations to test database
script/generate rspec_controller articles index
script/generate integration_test authentication
..generate integration test 'authentication'
rake test:integration :run integration tests
add to: config/environments/test.rb
config.gem "rspec", :lib => false, :version => '>=1.2.2'
config.gem "rspec-rails", :lib => false, :version => '>=1.2.2'
config.gem "webrat", :lib => false, :version => ">=0.4.3"
config.gem "cucumber", :lib => false, :version => '>=0.2.2'
sudo rake gems:install :install gems
sudo rake gems:install RAILS_ENV=test :install gems for [test] env
sudo rake gems:build :build gems needing native extensions
export PATH=${PATH}:/opt/local/bin
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
branching how-to
----------------
1. grab the master
git clone git@github.com:indiehead/matilda.git
2. go into the master
cd matilda
3. create your branch
rake rails:freeze:edge RELEASE=2.3.2
@johnantoni
johnantoni / ^2.3
Created April 29, 2009 11:39
rails version
if Rails.version ~= /^2.3/
0
+ app_filename = "#{RAILS_ROOT}/app/controllers/application_controller.rb"
0
+ else
0
+ app_filename = "#{RAILS_ROOT}/app/controllers/application.rb"
0
+ end
Absolute must-do for any new git users out there: set your name and email, so people can know who did what in the code!
git config --global user.name "John Doe"
git config --global user.email "john.doe@company.com"
Also, if you’re a command-line user (and who isn’t?!), make sure you configure it to add a splash of colour to its output. It’s really useful.
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
@johnantoni
johnantoni / mysql privelidges
Created May 4, 2009 18:12
mysql priviledges
GRANT ALL PRIVILEGES ON `testdb\_%` . * TO 'test'@'localhost';
SHOW GRANTS FOR 'test'@'localhost';