Skip to content

Instantly share code, notes, and snippets.

@hechien
hechien / fb_fanpage_checker.rb
Created September 20, 2011 08:16 — forked from hechien/fb_fanpage_checker.rb
Facebook fanpage checker.
#!/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)
@hechien
hechien / simple-firewall
Created April 10, 2012 08:08
iptables sample (for linode)
# 2012-04-10 新型 IP 即 ipv6 的部份,需要找時間微調
# 建議設定防火牆時,可先安裝 tcpdump 並下 tcpdump -eqnn -c 10 指令
# 當防火牆設定完成後,若是狀況可行,tcpdump 請暫時先移除
# 請不要在 Linode 的伺服器環境下,實作 Mac Layer 驗證
# 有些網路負載平衡與其他設備,內外的連線 Mac Address 都會一樣
# 參考:用於測試對照時所需要的清除指令
# # iptables -P INPUT ACCEPT
# # iptables -P OUTPUT ACCEPT
@hechien
hechien / buttons.css.scss
Created April 26, 2012 08:22 — forked from raecoo/buttons.css.scss
CSS3 Button Styles
@import "css3";
/* button
---------------------------------------------- */
.button {
display: inline-block;
zoom: 1; /* zoom and *display = ie7 hack for display:inline-block */
*display: inline;
vertical-align: baseline;
margin: 0 2px;
@hechien
hechien / export_wp.rb
Created May 9, 2012 03:12 — forked from wsargent/export_wp.rb
Export typo comments to disqus using Nokogiri
# 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/",
@hechien
hechien / Rails.md
Created July 6, 2012 12:31 — forked from xdite/gist:758319
Ruby / Rails Convention

Rails 開發注意要點

編輯器

  • 編輯器採用 Sublime Text 2 (等要收費再考慮其他的)
  • Tab size: 2
  • 一律使用空白當Tab鍵 (Sublime Text 2有設定可以改)

Ruby 語法

@hechien
hechien / brew_setup.sh
Created July 11, 2012 17:55 — forked from ericgibb/brew_setup.sh
Installs Brew, Ruby, MySql, and other helpful utilities
# 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
@hechien
hechien / rails31init.md
Created July 12, 2012 13:40 — forked from jraines/rails31init.md
Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and Simple Form

Install Rails 3.1 RC

gem install rails --pre

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@hechien
hechien / gist:3183649
Created July 26, 2012 18:27 — forked from ErneX/gist:3179774
OS X Mountain Lion clean install & Rails
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
# before
## model
class User
after_create : call_3rd_api
def call_3rd_api
xxx
end
end
@hechien
hechien / mountain-lion-brew-setup.markdown
Created August 21, 2012 06:28 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.