Skip to content

Instantly share code, notes, and snippets.

View zhengjia's full-sized avatar

Zheng Jia zhengjia

  • Sport Ngin
  • Minneapolis
View GitHub Profile
@zhengjia
zhengjia / r3.rb
Created September 24, 2010 04:00 — forked from Lytol/ultemplate.rb
# Rails application template for Rails 3 + Git + haml + JQuery + Rspec + Cucumber + Capybara + FactoryGirl
# by Brian Smith <bsmith@swig505.com>
# Create a default README
remove_file "README"
file "README.md", <<-EOF
#{app_const}
#{"=" * app_const.length}
TODO: description
@zhengjia
zhengjia / bundler.md
Created September 23, 2010 01:30 — forked from nzoschke/bundler.md

Install the pre-release of bundler. When 1.0 is final the --pre flag will not be necessary.

$ gem install bundler --version=1.0.0.rc.2
Successfully installed bundler-1.0.0.rc.2
1 gem installed

Modify your Gemfile, and locally re-bundle you app with the new bundler options. If bundler complains about the Gemfile format, fix it according to the directions on http://gembundler.com/v1.0/index.html. If you have an old bundler gem defined in your Gemfile, make sure to un-pin it from 0.9.x.

$ echo >> Gemfile

$ bundle install --path vendor/bundle

# Main sinatra app
require 'sinatra'
require 'activerecord'
require 'activesupport'
include ActionView::Helpers::DateHelper # add the required helpers here.
require 'controllers.rb'
# controllers.rb
@zhengjia
zhengjia / lisp.rb
Created September 3, 2010 00:15 — forked from dahlia/lisp.rb
# 30 minutes Lisp in Ruby
# Hong MinHee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,
require 'rubygems'
IRB.conf[:AUTO_INDENT] = false
IRB.conf[:USE_READLINE] = true
class Object
# easy way to list an object's methods without clutter
def local_methods
(methods - Object.instance_methods).sort
end
end
@zhengjia
zhengjia / gist:395021
Created May 9, 2010 08:29 — forked from mbulat/gist:231022
rcov rake
# From http://github.com/jaymcgavren
#
# Save this as rcov.rake in lib/tasks and use rcov:all =>
# to get accurate spec/feature coverage data
#
# Use rcov:rspec or rcov:cucumber
# to get non-aggregated coverage reports for rspec or cucumber separately
require 'cucumber/rake/task'
require 'spec/rake/spectask'