Skip to content

Instantly share code, notes, and snippets.

View sunfmin's full-sized avatar

Felix Sun sunfmin

View GitHub Profile
r.namespace :admin do |admin|
admin.match("/products/import").to(:controller => "products", :action => "import").name(:import_admin_products)
[:countries, :languages, :sports, :products].each do |res|
admin.resources res
end
end
sudo gem uninstall -Ia `gem list dm|grep dm|ruby -pe '$_ = $_.split(" ")[0].to_s + "\n"'`
@sunfmin
sunfmin / joyent_upgrade_to_postgresql83_history
Created September 19, 2008 04:35
Upgrade to PostgreSQL 8.3 on Joyent
svcadm disable postgresql
svcadm disable mongrel/facts
curl -O http://ftp7.us.postgresql.org/pub/postgresql//source/v8.3.3/postgresql-8.3.3.tar.gz
gunzip postgresql-8.3.3.tar.gz
tar -xvf postgresql-8.3.3.tar
cd postgresql-8.3.3/
export LDFLAGS="-R/opt/csw/lib/:/usr/lib/"
./configure --with-libraries=/opt/csw/lib/:/usr/lib/ --with-includes=/opt/csw/include/:/usr/include/
sudo make install
/usr/local/pgsql/bin/psql --version
@sunfmin
sunfmin / gist:11539
Created September 19, 2008 04:44 — forked from schacon/gist:1
This is gist.
There are many like it, but this one is mine.
It is my life.
I must master it as I must master my life.
Without me gist is useless.
Without gist, I am useless.
git rm `git status|grep deleted|cut -c 15-100`
http://discuss.joyent.com/viewtopic.php?id=23748
If you are on a new Accelerator with rubygems 1.1.0 and you're seeing the following error and you can't install any gems:
-bash-3.00$ sudo gem update --system
Password:
Updating RubyGems
@sunfmin
sunfmin / irc
Created September 26, 2008 08:17 — forked from anatole/irc
[asics@gmg6p9ab ~/src/do/do_mysql]$ rake install
(in /home/asics/src/do/do_mysql)
Building native extensions. This could take a while...
ERROR: Error installing pkg/do_mysql-0.9.6:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby18 extconf.rb install --local pkg/do_mysql-0.9.6 --no-update-sources
checking for mysql.h... yes
checking for main() in -lmysqlclient... yes
checking for mysql_query()... yes
require 'rubygems'
require 'mp3info'
from_folder = "/Users/sunfmin/Music/Music2"
mv_to_folder = "/Users/sunfmin/Music/Cleaned"
def fix(f)
Mp3Info.open(f, :encoding => "utf-8") do |mp3info|
print Iconv.iconv('utf-8', 'gbk', mp3info.tag.album)
merb : worker (port 9002) ~ undefined method `coerce' for false:FalseClass - (NoMethodError)
/opt/local/lib/ruby/1.8/rational.rb:134:in `+'
/opt/local/lib/ruby/1.8/date.rb:479:in `ajd_to_jd'
/opt/local/lib/ruby/1.8/date.rb:1026:in `__27705__'
(eval):4:in `jd'
/opt/local/lib/ruby/1.8/date.rb:1041:in `__37913__'
(eval):4:in `civil'
/opt/local/lib/ruby/1.8/date.rb:1056:in `year'
/opt/local/lib/ruby/1.8/date/format.rb:230:in `strftime'
/opt/local/lib/ruby/1.8/date/format.rb:201:in `gsub'
INCLUDE_PPC = -isysroot /Developer/SDKs/MacOSX10.3.9.sdk
INCLUDE_I386 = -isysroot /Developer/SDKs/MacOSX10.4u.sdk
...
LIBRARIES_PPC = -Wl,-syslibroot /Developer/SDKs/MacOSX10.3.9.sdk
LIBRARIES_I386 = -Wl,-syslibroot /Developer/SDKs/MacOSX10.4u.sdk
change to: