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 / .gitignore
Created July 20, 2010 03:01
.gitignore
config/database.yml
config/s3_credentials.yml
tmp/**/*
.DS_Store
doc/api
doc/app
doc/plugins
doc/*.dot
coverage/*
db/*.sqlite3
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"
@zhengjia
zhengjia / footnotes
Created July 26, 2010 00:56
footnote
RAILS_ROOT/config/environments/development.rb
config.gem "rails-footnotes"
environment.rb or
in an initializer do:
if defined?(Footnotes)
Footnotes::Filter.prefix = 'txmt://open?url=file://%s&line=%d&column=%d'
@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>
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
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
git config --global core.excludesfile ~/.git_global_ignore
@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,
# 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 / 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'