Skip to content

Instantly share code, notes, and snippets.

@mchung
mchung / Gemfile-rails-2.3.8.rb
Created May 27, 2010 21:20
Rails! Featuring Bundler, Cucumber, RVM, Postgres, on Ruby-1.8.7
# Everything you need to do to get started with Rails 2.3.8
#
# As of June 14th, 2010 @ 2:30 p.m. MST
#
# This gist now features instructions to get Rails 3 up and running with:
# - Ruby 1.8.7-p174
# - Bundler 0.9.26
# - Cucumber 0.8.0
# - Rspec 1.3.0 + Rspec-Rails 1.3.2
# - RVM
# In your test_helper.rb
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
hadricus@solaris:~/Programming/Ruby/rails/rails3/lktysplt [blog*]$ AUTOFEATURE=true autotest
<internal:lib/rubygems/custom_require>:29: warning: loading in progress, circular require considered harmful - /Users/hadricus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb
from /Users/hadricus/.rvm/gems/ruby-1.9.2-p0@rails3/bin/autotest:12:in `<main>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /Users/hadricus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:1136:in `<top (required)>'
from /Users/hadricus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:968:in `load_plugins'
from /Users/hadricus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:968:in `each'
from /Users/hadricus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:976:in `block in load_plugins'
from /Users/hadricus/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:976:in `load'
class AppBuilder < Rails::AppBuilder
include Thor::Actions
include Thor::Shell
def test
append_test_gems
rspec
cucumber
jasmine
end
@guenter
guenter / move_to_rds.rb
Created November 11, 2010 02:14
A quick and dirty script to move a database into Amazon RDS (or any other database). Can transfer part of the data beforehand.
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
@trydionel
trydionel / backbone.rails.js
Created November 28, 2010 16:47
Makes Backbone.js play nicely with default Rails setup
//
// Backbone.Rails.js
//
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
//
// Load this file after backbone.js and before your application JS.
@chrisyoung
chrisyoung / gist:853968
Created March 4, 2011 01:14
Cucumber Environment
# RVM: ruby-1.8.7-p330
# Culerity runs JRuby V1.5.6
# Everything is 64 bit on OSX
###### custom_env.rb
require File.expand_path(File.dirname(__FILE__) + '/../../config/factories')
require 'delorean'
ActiveRecord::TestCase.use_concurrent_connections
@eric1234
eric1234 / 0_instructions.txt
Created April 9, 2011 01:12
Using Sprockets 2 in Rails 3.0.x with CoffeeScript & SASS
UPDATE: Please see some of the forks for an updated version of this guide. I
myself have moved onto the Rails 3.1 betas to get the asset pipeline. But if
you want to stay on stable there are other folks who are keeping this guide
relevant despite the changes constantly occurring on Sprockets 2. The comments
on this gist will lead you to the right forks. :)
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the
@patmaddox
patmaddox / My question.txt
Created April 11, 2011 23:07
Question about case-insensitive columns in Rails
Hola Rails people. I have a column in my database that I need to treat
as case-insensitive. The standard solution to this is to downcase the
value before inserting it into the database, and when doing
searches. My problems with this are:
1. I have to make calls to String#downcase in several places where I
*really* mean "this is case-insensitive"
2. I can only provide automatic-downcasing when going through the API
I provide. Anyone calling MyClass.where(:name => foo) has to know to
@drewlesueur
drewlesueur / sync_forked.md
Created April 17, 2011 04:28
How to sync your forked branch

This is how I synced my forked underscore.js repo with the original repo
From your forked repo:

git checkout -b upstream/master
git remote add upstream git://github.com/documentcloud/underscore.git
git pull upstream master
git checkout master                          // [my master branch]
git merge upstream/master (git rebase upstream/master ????)
git push origin master