Skip to content

Instantly share code, notes, and snippets.

View hui's full-sized avatar
🏃‍♂️

Hui Zheng hui

🏃‍♂️
View GitHub Profile
@hui
hui / gist:7186
Created August 26, 2008 00:48 — forked from defunkt/gist:6443
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M001599
Supported options
:primary_key
Specify the method that returns the primary key used for the association. By default this is id.
git clone git://github.com/nex3/haml.git
cd haml
rake install
# config.ru
require 'rubygems'
# Uncomment if your app uses bundled gems
#gems_dir = File.expand_path(File.join(File.dirname(__FILE__), 'gems'))
#Gem.clear_paths
#$BUNDLE = true
#Gem.path.unshift(gems_dir)
require 'merb-core'
# MacPorts Installer addition on 2009-01-02_at_18:10:26: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# MacPorts Installer addition on 2009-01-02_at_18:10:26: adding an appropriate MANPATH variable for use with MacPorts.
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.
sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
git config --global branch.autosetupmerge true
@hui
hui / gist:58790
Created February 5, 2009 16:17 — forked from rails/gist:58761
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript
</IfModule>