Skip to content

Instantly share code, notes, and snippets.


Zheng Jia zhengjia

  • Sport Ngin
  • Minneapolis
View GitHub Profile
zhengjia /
Created Jun 30, 2011 — forked from isaacs/
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh
View issue-139.rb
require 'mongoid'
require 'rspec'
Mongoid.configure do |config|
config.master ='testing')
config.autocreate_indexes = true
class User
include Mongoid::Document
View diff directories
diff -qr dirA dirB | grep -v -e '.git' | sort > diffs.txt
View textmate folder pattern
View template
// This can be moved to a separate file later so that it's instantiated at the right time
$(document).observe("dom:loaded", function() {
var tagPicker = new TagPicker();
function TagPicker(options) {
// to compensate for JS poor 'this' handling
var that = this;
View startup script
osascript <<END
activate application "Terminal"
tell application "Terminal"
do script "memcached -vv" in window 1
end tell
View fs_usage
sudo fs_usage -w -f filesys ruby | grep -i open
View dev load path
).each do |framework|
$:.unshift "/Users/zjia/code/rails3/#{framework}/lib"
View twitter_oauth_setup.rb
#!/usr/bin/env ruby
# Command line util for acquiring a one-off Twitter OAuth access token
# Based on
require 'rubygems'
require 'oauth'
puts <<EOS
Set up your application at (as a 'Client' app),
View r3.rb
# Rails application template for Rails 3 + Git + haml + JQuery + Rspec + Cucumber + Capybara + FactoryGirl
# by Brian Smith <>
# Create a default README
remove_file "README"
file "", <<-EOF
#{"=" * app_const.length}
TODO: description
You can’t perform that action at this time.