2013年6月3日 星期一

F2E前端工程師面試問題集 - Front-end Job Interview Questions

Fork me on Github : Front-end-Developer-Interview-Questions

[OSX] dotfiles - zsh based Terminal editor and configuration files.

My dotfiles: https://github.com/hankwang/dotfiles

Image 1

Image 2

[OSX] copy last command by pbcopy - 複製上一個指令到剪貼簿

例如測試一行command是不是正確的, 確認之後我想複製起來做筆記或是貼到別地方, 這時候就可以透過pbcopy達到快速複製的效果, 不用再用滑鼠去框。

$ ps -awx

把上一個指令複製到剪貼簿

$ echo "!!" | pbcopy

把上一個指令的最後一個參數複製到剪貼簿

$ echo "!$" | pbcopy

2013年6月2日 星期日

[git] Syncing a fork - 同步原本repo的修改到fork出來的repo

  1. 加入新的遠端repo
  2. 取回遠端repo
  3. 合併repo到master
  4. 解決conflict的commits

列出目前的遠端repo

$ git remote -v 
origin https://github.com/user/repo.git (fetch)
origin https://github.com/user/repo.git (push)

加入一個新的遠端repo

$ git remote add upstream https://github.com/otheruser/repo.git

註: upstream 為加入的遠端repo名稱, 可以自取


查看新加入的遠端repo

$ git remote -v

origin https://github.com/user/repo.git (fetch)
origin https://github.com/user/repo.git (push)
upstream https://github.com/otheruser/repo.git (fetch)
upstream https://github.com/otheruser/repo.git (push)

取回新加入的遠端repo的所有分支(branches)

$ git fetch upstream

remote: Counting objects: 75, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 62 (delta 27), reused 44 (delta 9)
Unpacking objects: 100% (62/62), done.
From https://github.com/otheruser/repo
 * [new branch]      master     -> upstream/master

查看目前本機和遠端的所有分支(branches)

$ git branch -va

* master                  a422352 My local commit
  remotes/origin/HEAD     -> origin/master
  remotes/origin/master   a422352 My local commit
  remotes/upstream/master 5fdff0f Some upstream commit

合併upstream的master到目前repo的master

$ git merge upstream/master

Updating 34e91da..16c56ad
Fast-forward
README.md                 |    5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

如果merge時遇到conflict, 例如README.md conflict

$ git status

# You have unmerged paths.
#   (fix conflicts and run "git commit")
#
# Changes to be committed:
#
#   new file:   run.sh
#
# Unmerged paths:
#   (use "git add <file>..." to mark resolution)
#
#   both modified:      README.md

編輯README.md處理conflict的地方後, 重新commit

$ git add README.md
$ git rebase --continue

See also

Github - Syncing a fork

2013年5月22日 星期三

[Python] list pip installed packages - 列出pip已安裝的套件

List all installed packages - 列出所有已安裝的套件

$ pip freeze

Check specify package version - 查看某套件版本

$ pip freeze | grep Django

2013年5月10日 星期五

Related Posts Plugin for WordPress, Blogger...