Skip to content

Instantly share code, notes, and snippets.

View chucai's full-sized avatar

He Xudong chucai

  • 北京
View GitHub Profile
@chucai
chucai / rails_template_for_mongoid.rb
Created June 11, 2012 01:43 — forked from huacnlee/rails_template_for_mongoid.rb
A custom Rails template for Mongoid.
# coding: utf-8
# This is a Rails init template with MongoDB projects
#
# Mongoid, Devise, Bootstrap, jQuery, Redis, Cells, will_paginate, Carrierwave, simple_form, Settingslogic, Thin
#
# Usage
#
# $ rails new app_name -m https://raw.github.com/gist/2168014
#
@chucai
chucai / workers.rake
Created June 19, 2012 11:36 — forked from karmi/workers.rake
Rake taks to launch multiple Resque workers in development/production with simple management included
# Rake task to launch multiple Resque workers in development/production with simple management included
require 'resque/tasks' # Require Resque tasks
namespace :workers do
# = $ rake workers:start
#
# Launch multiple Resque workers with the Rails environment loaded,
# so they have access to your models, etc.
@chucai
chucai / new.rb
Created July 11, 2012 01:44 — forked from jferris/new.rb
Rails: FactoryGirl defined
FactoryGirl.define do
sequence :email do |n|
"user#{n}@example.com"
end
factory :user do
email
password "test"
aliased_as :author
end
@chucai
chucai / description
Created July 13, 2012 10:14 — forked from irrationalidiot/description
Cucumber, rspec and spork setup using watchr for rails
Gems:
gem 'cucumber'
gem 'cucumber-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'spork'
gem 'watchr'
@chucai
chucai / description
Created July 14, 2012 02:19 — forked from irrationalidiot/description
Cucumber, rspec and spork setup using watchr for rails
Gems:
gem 'cucumber'
gem 'cucumber-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'spork'
gem 'watchr'
# See http://m.onkey.org/running-rails-performance-tests-on-real-data
# START : HAX HAX HAX
# Load Rails environment in 'test' mode
RAILS_ENV = "test"
require File.expand_path('../../config/environment', __FILE__)
# Re-establish db connection for 'performance' mode
silence_warnings { RAILS_ENV = "performance" }
ActiveRecord::Base.establish_connection
@chucai
chucai / faye.rb
Created July 19, 2012 02:52 — forked from betamatt/faye.rb
Faye monit wrapper
#!/usr/env ruby
base_dir = File.expand_path("../..", __FILE__)
NAME="faye"
PID="#{base_dir}/tmp/pids/#{NAME}.pid"
COMMAND="bundle exec rackup -s thin -E production -p 3001 faye.ru"
case ARGV[0]
when "start"
@chucai
chucai / .railsrc
Created August 4, 2012 02:08 — forked from janlelis/.railsrc
13 Rails-specific hints for your rails 3 console.
# .railsrc for Rails 3, encoding: utf-8
# see http://rbjl.net/49-railsrc-rails-console-snippets
if !Rails.application then warn "Rails isn't loaded, yet... skipping .railsrc" else
# # #
def ripl?; defined?(Ripl) && Ripl.instance_variable_get(:@shell); end
# # #
# loggers
@chucai
chucai / haml
Created August 4, 2012 02:21
a template for rails: html5 , haml...else...
# Application Generator Template
# Modifies a Rails app to set up Haml with an HTML5 application layout and options for CSS with Twitter Bootstrap
# Usage: rails new APP_NAME -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-haml-html5-template.rb
# Generated using the rails_apps_composer gem:
# https://github.com/RailsApps/rails_apps_composer/
# Based on application template recipes by:
# Michael Bleigh https://github.com/mbleigh
# Daniel Kehoe https://github.com/DanielKehoe
@chucai
chucai / railsrc
Created August 4, 2012 02:30
my railsrc config page
-m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-haml-html5-template.rb
--old-style-hash
--skip-bundle
--skip-test-unit