Skip to content

Instantly share code, notes, and snippets.

["<li class=\"\"><a href=\"/how-it-works\">How</a></li>", "<li class=\"\"><a href=\"/how-it-works\">About</a></li>"]
generators = []
puts 'Spinning up a new app, captain!'
devise = yes?('Use Devise? (yes/no)')
jquery = yes?('Use jQuery? (yes/no)')
jquery_ui = yes?('Use jQuery UI? (yes/no)') if jquery
mongoid = yes?('Use mongoid? (yes/no)')
haml = yes?('Use haml? (yes/no)')
rspec = yes?('Use Rspec? (yes/no)')
set :sync_directories, ["public/system/images"]
set :sync_backups, 3
set :db_file, "mongoid.yml"
set :db_drop, '--drop' # drop database (rewrites everything)
Get notifications when there are migrations that need to be run in a Rails project:
https://img.skitch.com/20110418-c9y3ttap3tai7frc43f38qtb8e.jpg
In your Rails project edit the .git/config file to add the following:
[rails]
automigrate = false
automigrateforegroundcolor = yellow
automigratebackgroundcolor = black
@stevenkolstad
stevenkolstad / Gemfile
Created April 28, 2011 21:00 — forked from beathyate/Gemfile
Cloudmailin Rails 3 Mongoid CarrierWave GridFS
source :rubygems
gem 'rails', '3.0.3'
gem 'mongo', '1.1.5'
gem 'bson', '1.1.5'
gem 'bson_ext', '1.1.5'
gem 'mongoid', '2.0.0.beta.20'
gem 'carrierwave'
@stevenkolstad
stevenkolstad / prepare.txt
Created May 25, 2011 20:21 — forked from fortuity/gist:452364
Application generator template modifies a Rails app to use Mongoid & Devise
# Application Generator Template
# Modifies a Rails app to use Mongoid & Devise.
# Usage: rails new app_name -m http://gist.github.com/raw/991845/prepare.txt
# If you are customizing this template, you can use any methods provided by Thor::Actions
# http://rdoc.info/rdoc/wycats/thor/blob/f939a3e8a854616784cac1dcff04ef4f3ee5f7ff/Thor/Actions.html
# and Rails::Generators::Actions
# http://github.com/rails/rails/blob/master/railties/lib/rails/generators/actions.rb
puts "Modifying a new Rails app to use Mongoid & Devise..."
<p>Welcome some email!</p>
<p>You can confirm your account through the link below:</p>
<p><a href="http://localhost/admin/confirmation?confirmation_token=KSwxjJyzEZAWK4rx24jh">Confirm my account</a></p>
@stevenkolstad
stevenkolstad / attachment.rb
Created September 23, 2011 22:55 — forked from Paxa/attachment.rb
video encoder snippet
class Attachment < ActiveRecord::Base
belongs_to :post
mount_uploader :filename, PostAttachmentUploader
VIDEO_FORMATS = %W{ogv mp4 webm}
PREVIEW_FORMAT = "jpeg"
before_save :set_metas
after_create :start_encoding!, :if => :video?
@stevenkolstad
stevenkolstad / nginx_rails_3_1
Created March 1, 2012 14:44 — forked from shapeshed/nginx_rails_3_1
Nginx Config for Rails 3.1 with Unicorn and Asset Pipeline
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {
@stevenkolstad
stevenkolstad / gist:2032275
Created March 13, 2012 22:37 — forked from moneill/gist:1005105
Sample mongoid.yml generated from rails g mongoid:config (app name is 'appy')
defaults: &defaults
host: localhost
# slaves:
# - host: slave1.local
# port: 27018
# - host: slave2.local
# port: 27019
development:
<<: *defaults