Skip to content

Instantly share code, notes, and snippets.

View zhengjia's full-sized avatar

Zheng Jia zhengjia

  • Sport Ngin
  • Minneapolis
View GitHub Profile
sudo fs_usage -w -f filesys ruby | grep -i open
%w(
activerecord
actionmailer
activeresource
activesupport
actionpack
activemodel
railties
).each do |framework|
$:.unshift "/Users/zjia/code/rails3/#{framework}/lib"
#!/usr/bin/env ruby
# Command line util for acquiring a one-off Twitter OAuth access token
# Based on http://blog.beefyapps.com/2010/01/simple-ruby-oauth-with-twitter/
require 'rubygems'
require 'oauth'
puts <<EOS
Set up your application at https://twitter.com/apps/ (as a 'Client' app),
@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