[Git] git bisect

git bisect,可以快速找到壞掉的 commit # step.1 $ git bisect start # step.2 $ git bisect good <commit> # step.3 $ git bisect bad <commit> Ref: 二分法查找 (Binary Search) »

[GIT] git cherry-pick

git cherry-Pick,抓取別的 branch commit,並在目前 branch 建立新 commit $ git cherry-Pick <commit> 若有 conflict 一樣解完後 $ git add <file_name> $ git cherry-Pick --continue Ref: Git - git-cherry-pick Documentation »

[GIT] git patch

git patch可以將 commit 匯出為更新檔 將要匯出的 commit,存成 patch 檔 $ git format-patch <base_commit> OR $ git format-patch -n3 <top_commit> OR # 使用 現在所在位置跟 master 所在位置,最近共同根部 $ git format-patch master 將 patch 檔放在要匯入的 branch 後,下指令匯入 # 只有匯入,須自行 commit $ git apply »

[CSS] 權重 (Specificity)

寫 css 的時候,有時候會遇到套用樣式後。效果卻沒有出現,或是被覆蓋掉 這時候就是 css 優先權的問題 優先權: !important > inline style > id > class > element 計算 * 如果元素具有 inline style,(1,0,0,0) * 每個 id,(0,1,0,0) * 每個 class (或偽類或屬性選擇器),(0,0,1,0) * 每個 element,(0,0,0,1) margin 和 padding 不能被繼承 Ref »

[Ruby] method 後的驚嘆號(exclamation mark)

method 後面有驚嘆號,表示直接對這個物件做修改 method 後面沒驚嘆號,則是建立一個新物件 Example: 使用 reverse (反轉陣列順序) 做示範 無驚嘆號 做完 reverse 後,array 的值跟建立時是一樣的 有驚嘆號 做完 reverse 後,array 被修改了 Ref: Why are exclamation marks used in Ruby methods? »

[Ruby] sub 與 gsub

sub 會換掉 “第一個” 符合的 string gsub 則會換掉 “全部” 符合條件的 string Example: sub gsub Ref: Ruby Sub, gsub: Replace String - Dot Net Perls »