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

~/.rvm/gems/ruby-1.9.2-p0/gems/ruby-debug-ide19-0.4.12/lib $ mate ruby-debug-ide.rb
#bt = debug_load(Debugger::PROG_SCRIPT, options.stop, options.load_mode)
sr = "~/code/rails3_test/myapp/script/rails"
bt = debug_load(sr, options.stop, options.load_mode)
@zhengjia
zhengjia / running on rails3 edge
Created September 9, 2010 04:05
running on rails3 edge
git submodule add git://github.com/rails/rails.git vendor/rails
git submodule add git://github.com/rack/rack.git vendor/rack
git submodule add git://github.com/rails/arel.git vendor/arel
ruby vendor/rails/bin/rails new . --dev
#Generated Gemfile
#gem 'rails', :path => '/Users/zjia/.rvm/gems/ruby-1.9.2-p0/gems'
#gem 'arel', :git => 'git://github.com/rails/arel.git'
# 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,
git config --global core.excludesfile ~/.git_global_ignore
def a
puts 'a'
end
ma = method :a
mma=ma.to_proc
mmma = Kernel.send :define_method ,:new_method, &mma
mmma2 = Kernel.send :define_method ,:new_method2, mma
new_method
new_method2
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 / crossdomain.xml
Created August 23, 2010 21:58
crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>