Skip to content

Instantly share code, notes, and snippets.

View ihower's full-sized avatar
🎯
Focusing

Wen-Tien Chang ihower

🎯
Focusing
View GitHub Profile
Error during failsafe response: "\xE4" from ASCII-8BIT to UTF-8
/Users/ihower/github/rails/activesupport/lib/active_support/buffered_logger.rb:104:in `write'
/Users/ihower/github/rails/activesupport/lib/active_support/buffered_logger.rb:104:in `block in flush'
<internal:prelude>:10:in `synchronize'
/Users/ihower/github/rails/activesupport/lib/active_support/buffered_logger.rb:101:in `flush'
/Users/ihower/github/rails/activesupport/lib/active_support/buffered_logger.rb:121:in `auto_flush'
/Users/ihower/github/rails/activesupport/lib/active_support/buffered_logger.rb:66:in `add'
/Users/ihower/github/rails/activesupport/lib/active_support/buffered_logger.rb:77:in `fatal'
/Users/ihower/github/rails/actionpack/lib/action_dispatch/middleware/show_exceptions.rb:139:in `block in log_error'
/Users/ihower/github/rails/activesupport/lib/active_support/deprecation/reporting.rb:15:in `silence'
class Dragon
def test
"test"
end
end
d = Dragon.new
puts d.test # test
# 呼叫 super (1)
class Dragon; end
# 使用 def 定義 class method
Dragon.instance_eval do
def foo
puts "bar"
end
end
Dragon.foo # bar
<div class="map">
<iframe width="350" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&amp;source=embed&amp;hl=zh-TW&amp;msa=0&amp;msid=101908379901557595242.00047f68df8db5ba850ee&amp;ll=25.041749,121.613674&amp;spn=0.037326,0.054932&amp;z=14&amp;output=embed"></iframe>
</div>
<div class="info">
<div class="venue group">
<h2>Venue</h2>
<div class="description">
<h3>中央研究院 人文社會科學館 (人文館)</h3>
#!/usr/local/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'railties' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
# This is not serious benchmark, you should read:
#
# http://jan.prima.de/plok/archives/175-Benchmarks-You-are-Doing-it-Wrong.html
# http://jan.prima.de/plok/archives/176-Benchmarks-You-are-Doing-it-Wrong.html
# http://books.couchdb.org/relax/reference/high-performance
#
# CouchDB v0.10.0 (via CouchDBX) on Macbook Pro 2.2 (Snow Leopard)
#
# 1000 times
# Round 1
#!/bin/bash
# Install Guide:
# 1. Use http://www.virtualbox.org if you use Windows or OS X
# 2. Download http://www.ubuntu.com 9.04 Desktop Edition and install into VM.
# 3. In your ubuntu console:
# $ wget http://gist.github.com/raw/212749/dfc34bd47732d25da0715a52aef2158cfba99d71/ruby_install_script_on_ubuntu
# $ chmod 555 ruby_install_script_on_ubuntu
# $ ./ruby_install_script_on_ubuntu
@ihower
ihower / gist:202843
Created October 6, 2009 08:15
Rails app template
# rails foobar -m http://gist.github.com/202843.txt
run "rm README"
run "rm public/index.html"
run "rm -f public/javascripts/*"
run "rm -f publuc/images/*"
generate :controller, "welcome index"
route "map.root :controller => 'welcome'"
if yes?("Do you want to use BDD framework?")
@ihower
ihower / rails_install_script_on_ubuntu
Created September 4, 2009 09:54
Ubunbu 9.04 (minimal) install script for Ruby on Rails training purpose
#!/bin/bash
# Install Guide:
# 1. Use http://www.virtualbox.org if you use Windows or OS X
# 2. Download http://www.ubuntu.com 9.04 Desktop Edition and install into VM.
# 3. In your ubuntu console:
# $ wget http://gist.github.com/raw/180820/333b288a1b5df8df09842bfcfa248fa252f0cf3b/rails_install_script_on_ubuntu
# $ chmod 555 rails_install_script_on_ubuntu
# $ ./rails_install_script_on_ubuntu
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head