Skip to content

Instantly share code, notes, and snippets.

View ilstar's full-sized avatar

Fred Liang ilstar

  • Instacart
  • San Francisco
View GitHub Profile
@ilstar
ilstar / gist:891932
Created March 29, 2011 07:16
Rspec View Test
require 'spec_helper'
# the string is your real path of view file.
describe "home/index" do
before do
login_as @user
template.stub('smart_link_to').and_return('')
@user = Factory(:user)
end
@ilstar
ilstar / tiny_mce config
Created March 14, 2011 09:00
tiny_mce config
theme: advanced
theme_advanced_toolbar_location : 'top'
theme_advanced_buttons1 : "fontselect, fontsizeselect,|, forecolor, backcolor, bold,italic,underline,strikethrough,|, justifyleft,justifycenter,justifyright,justifyfull,|, bullist,numlist,|, link,unlink,image,|, undo, redo, |, cleanup, code"
theme_advanced_buttons2: ""
theme_advanced_buttons3: ""
theme_advanced_toolbar_align : "left"
theme_advanced_statusbar_location: "bottom"
theme_advanced_fonts : "宋体=\'宋体\', sans-serif; 黑体=\'黑体\', sans-serif; 楷体=\'楷体_GB2312\', sans-serif; 隶书=\'隶书\', sans-serif;幼圆=\'幼圆\', sans-serif; 新宋体=\'新宋体\',sans-serif;微软雅黑=\'微软雅黑\', sans-serif; Arial=Arial; Arial Black=Arial Black; Arial Narrow=Arial Narrow; Brush Script MT=Brush Script MT; Century Gothic=Century Gothic; Comic Sans MS=Comic Sans MS; Courier=Courier; Courier New=Courier New; MS Sans Serif=MS Sans Serif; Script=Script; System=System; Times New Roman=Times New Roman; Verdana=Verdana; Wide Latin=Wide Latin; Wingdings=Wingdings;"
@ilstar
ilstar / gist:841931
Created February 24, 2011 08:47
当修改snippet脚本后,执行,rr可重新加载脚本,无需重启Vim
" 当修改snippet脚本后,执行,rr可重新加载脚本,无需重启Vim
function! ReloadSnippets( snippets_dir, ft )
if strlen( a:ft ) == 0
let filetype = "_"
else
let filetype = a:ft
endif
call ResetSnippets()
call GetSnippets( a:snippets_dir, filetype )
#
# © 2009 Andrew Coleman
# Released under MIT license.
# http://www.opensource.org/licenses/mit-license.php
#
# total hack to allow american style date parsing.
# does not allow european-ish date parsing, sorry.
#
# some credit from:
# http://talklikeaduck.denhaven2.com/2009/04/26/ruby-1-9-compatibility-for-ri_cal-what-it-took-and-some-side-thoughts
" 解决在编辑文件时底部出现\ No newline at end of file的问题
au BufWritePre * :set binary | set noeol
au BufWritePost * :set nobinary | set eol
@ilstar
ilstar / gist:768957
Created January 7, 2011 01:27 — forked from xdite/gist:758319

Rails 開發注意要點

About Ruby Syntax

  • 編輯器設定 soft tab (space=2),以 2 格空白符號做為程式內縮距離(不分語言)。
  • 函式如果只有一個參數,就不強制打()
  • 函式如果有二個以上的參數,通通都要有 ()
    • (避免發生奇怪的paser bug跟保持專案一致性)
  • 字串限定用雙引號包覆
  • 善用 "#{str1} #{str3} " 等字串改寫技巧取代不需要的字串加法。
@ilstar
ilstar / gitconfig
Created October 14, 2010 08:44
~/.gitconfig
[user]
name = your_name
email = [email protected]
[alias]
co = checkout
ci = commit
st = status
br = branch
last = log -p -1
[color]