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 / 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]
@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} " 等字串改寫技巧取代不需要的字串加法。
" 解决在编辑文件时底部出现\ No newline at end of file的问题
au BufWritePre * :set binary | set noeol
au BufWritePost * :set nobinary | set eol
#
# © 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
@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 )
@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: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 / rcd
Created July 23, 2011 01:46
batch open iTerm tab with same path
#!/usr/bin/osascript
#
# Install
# copy this file to a directory which is one of your system PATH
# chmod +x filename
#
# Usage
# rcd ~/Download 3
# argv 1: the path which you want to "cd"
# argv 2: the count of new tab.
@ilstar
ilstar / dropbox_back.sh
Created May 15, 2012 03:39
利用Dropbox自动备份VPS的数据,无需安装dropbox
#!/bin/bash
DROPBOX_USER="Your Dropbox username"
DROPBOX_PASS="Your Dropbox password"
DROPBOX_DIR="Directory in your dropbox account to store the backups, e.g. /backups"
BACKUP_SRC="/home /var/www /var/git /etc /root"
BACKUP_DST="/tmp"
MYSQL_SERVER="127.0.0.1"
MYSQL_USER="root"
MYSQL_PASS="Your MySQL password"
@ilstar
ilstar / 3.css
Created May 29, 2012 08:07
3列固定的页面布局
/* ------------------------------
HTML Redefine Tags
------------------------------ */
body{font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:20px; padding:0;}
input, form, textarea
h1, h2, h3, h4, h5, h6{margin:0; padding:0;}
h1{font-size:18px;}
h2{font-size:14px; color:#999999;}
h3{font-size:13px; border-bottom:solid 1px #DEDEDE; padding:4px 0; margin-bottom:10px;}