Skip to content

Instantly share code, notes, and snippets.

View chenillen's full-sized avatar
🤩

Allen C. chenillen

🤩
View GitHub Profile
{
//// Bezier 2 Drawing
UIBezierPath* bezier2Path = UIBezierPath.bezierPath;
[bezier2Path moveToPoint: CGPointMake(97.5, 68.12)];
[bezier2Path addCurveToPoint: CGPointMake(93.5, 83.12) controlPoint1: CGPointMake(97.5, 68.12) controlPoint2: CGPointMake(99.79, 80.7)];
[bezier2Path addCurveToPoint: CGPointMake(108.5, 74.12) controlPoint1: CGPointMake(87.21, 85.54) controlPoint2: CGPointMake(105.36, 86.23)];
[UIColor.darkGrayColor setStroke];
bezier2Path.lineWidth = 1;
[bezier2Path stroke];
# current version of git
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
北京|Beijing|CN
上海|Shanghai|CN
广州|Guangzhou|CN
深圳|Shenzhen|CN
西安|Xian|CN
成都|Chengdu|CN
重庆|Chongqing|CN
天津|Tianjin|CN
武汉|Wuhan|CN
沈阳|Shenyang|CN
Andorra|AD|Andorra la Vella
United Arab Emirates|AE|Abu Dhabi
Afghanistan|AF|Kabul
Antigua and Barbuda|AG|St. John's
Anguilla|AI|The Valley
Albania|AL|Tirana
Armenia|AM|Yerevan
Netherlands Antilles|AN|Willemstad
Angola|AO|Luanda
Antarctica|AQ|
台北|Taipei|TW
高雄|Kaohsiung|TW
台中|Taichung|TW
台南|Tainan|TW
板橋|Banqiao|TW
中和|Zhonghe|TW
新竹|Hsinchu|TW
新莊|Xinzhuang|TW
桃園|Taoyuan|TW
基隆|Keelung|TW
## Want a route like http://example.com/:id/photos in Rails 3
# I have a username route below
class User < ActiveRecord::Base
def to_param
screen_name
end
end
match ':id' => 'users#show', :as => 'user_profile'
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 example.com
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
艺术|Art
喜剧|Comedy
漫画|Comics
舞蹈|Dance
设计|Design
时尚|Fashion
电影与视频|Film-and-Video
食品|Food
游戏|Games
新闻|Journalism
@chenillen
chenillen / hosts
Created February 10, 2011 08:25
My Hosts
# Twitter
65.49.26.99 twitter.com
65.49.26.98 si0.twimg.com
65.49.26.98 si1.twimg.com
65.49.26.98 si2.twimg.com
65.49.26.98 si3.twimg.com
65.49.26.98 si4.twimg.com
65.49.26.98 si5.twimg.com
65.49.26.97 api.twitter.com
@chenillen
chenillen / klasses.rb
Created November 9, 2011 09:11
polymorphic counter cache problem
class Allen < ActiveRecord::Base
has_many :joins, :as => :resource
...
end
class Bob < ActiveRecord::Base
has_many :joins, :as => :resource
...
end