- 編輯器採用 Sublime Text 2 (等要收費再考慮其他的)
- Tab size: 2
- 一律使用空白當Tab鍵 (Sublime Text 2有設定可以改)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class FBFanPageChecker | |
require 'rubygems' | |
require 'koala' | |
include Koala::Facebook | |
def initialize(app_id, app_secret, callback_url='http://localhost') | |
@oauth = OAuth.new(app_id, app_secret, callback_url) | |
@rest = RestAPI.new(@oauth.get_app_access_token) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2012-04-10 新型 IP 即 ipv6 的部份,需要找時間微調 | |
# 建議設定防火牆時,可先安裝 tcpdump 並下 tcpdump -eqnn -c 10 指令 | |
# 當防火牆設定完成後,若是狀況可行,tcpdump 請暫時先移除 | |
# 請不要在 Linode 的伺服器環境下,實作 Mac Layer 驗證 | |
# 有些網路負載平衡與其他設備,內外的連線 Mac Address 都會一樣 | |
# 參考:用於測試對照時所需要的清除指令 | |
# # iptables -P INPUT ACCEPT | |
# # iptables -P OUTPUT ACCEPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RAILS_ENV=production bundle exec rails runner ./script/wp_export.rb >! blog.wxr | |
# Require nokogiri in Gemfile here | |
site_link = "http://tersesystems.com/" | |
site_name = "Terse Systems" | |
builder = Nokogiri::XML::Builder.new do |xml| | |
xml.rss('version' => "2.0", | |
'xmlns:content' => "http://purl.org/rss/1.0/modules/content/", | |
'xmlns:wfw' => "http://wellformedweb.org/CommentAPI/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if ask "Do you want to do something?"; then | |
# echo "Yes" | |
# else | |
# echo "No" | |
# fi | |
# | |
# # Default to No if the user presses enter without giving an answer: | |
# if ask "Do you want to do something?" N; then | |
# echo "Yes" | |
# else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OS X Mountain Lion clean install Rails development environment setup using MySQL, imagemagick, homebrew and rvm. Rough steps, your mileage or your needs may vary: | |
- Install XCode from the App Store. | |
- Launch XCode > Preferences > Downloads > Install the Command Line Tools | |
- Install XQuartz version 2.7.2 http://xquartz.macosforge.org/trac/wiki/X112.7.2 | |
- Install git, I used git-osx-installer version 1.7.11.3 http://code.google.com/p/git-osx-installer/downloads/list | |
- Install Ruby 1.9.3 with rvm, run this command on a terminal and follow the instructions: curl -L https://get.rvm.io | bash -s stable --ruby | |
- Install MySQL using the DMG installer, I used version 5.1.63 found here http://dev.mysql.com/downloads/mysql/5.1.html I use this to get the files needed for the mysql2 gem to install, I don't install the prefpane or the init script since I use MAMP as my MySQL server on my Mac. | |
- Install homebrew: https://github.com/mxcl/homebrew/wiki/installation | |
- Install ghostscript, from a terminal: brew install ghosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# before | |
## model | |
class User | |
after_create : call_3rd_api | |
def call_3rd_api | |
xxx | |
end | |
end |
OlderNewer