2013-05-05

Sublime Text 入門

Sublime Text 是多數開發者喜愛的編輯工具
跨平台(Windows/Mac/Linux)
自訂性高(可自己改出一個自己專用 Sublime)
插件多(插件是用 Python 寫的)
部分插件還可自訂
線上資源
官網
文件(hot key)
Sublime Text 手冊
Sublime Text 台灣(fackbook)
Sublime Text 台灣(Google+)
簡易的筆記一下
  1. install package control
    Ctrl +`(打字區左上的~)
    input
    import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
  2. main setting
    Preferences->Settings-Default
    "default_encoding": "UTF-8"
    "default_line_ending": "unix"
    "tab_size": 4
    "translate_tabs_to_spaces": true
    "save_on_focus_lost": true
    "highlight_line": true

  3. other setting
    "ensure_newline_at_eof_on_save": true
    "trim_trailing_white_space_on_save": true
    "use_simple_full_screen": true

2013-05-04

web performance

最近在做一些關於 web 的效能測試,稍微紀錄一下所用的工具與方法,其實還有許多 test case 或 unit test 的工具與方法,但沒時間去逐一去試。
jsPerf — JavaScript performance playground
超實用的 javascript 效能測試,但 test case 不好寫,還在學習要如何去寫。
HTML5 test
測試各個 browser 對 HTML5 的支援度
JavaScript Benchmark
javascript 的跑分測試
timestamp
//jQuery
console.time("timerName");
function();
console.timeEnd("timerName");
view raw gistfile1.js hosted with ❤ by GitHub
//javascript
var startTime = new Date().getTime();
function();
var endTime = new Date().getTime();
var totalTime = endTime - startTime;
console.log("TotalTime:" + totalTime + "ms");
view raw gistfile2.js hosted with ❤ by GitHub

要注意的是 timestramp 的方法中,結束的時間必須是要測試的 function 結束,上例只是範例,部分的情況不會是用上例的寫法
這些測試都可在 mobile device 上測試

My Mac zshrc

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
export ZSH_THEME="candy"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want disable red dots displayed while waiting for completion
# DISABLE_COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
# mysql
export PATH="/usr/local/mysql/bin:$PATH"
# Short command aliases
alias 'l=ls'
alias 'la=ls -a'
alias 'll=ls -l'
alias 'sshdev=ssh ted_shiu@192.168.79.162'
# java
export PATH=/opt/local/bin:/opt/local/sbin:$PATH:/path/to/java/bin
view raw .zshrc hosted with ❤ by GitHub