Git 命令备忘

有些git命令总是记不住,在我这台 Ubuntu 使用 web 版 OneNote 不方便,那就把他们记到 Blog 里吧,需要的时候翻看一下。

git remote

git remote -v                 # 查看当前位置的远程代码库
<!-- more -->
git remote remove origin # 取消远程仓库
git remote add orgin git@github.com:shenxianpeng/nightwatch.git # 关联新的仓库

git log

# 得到某一时段提交日志
git log --after='2017-12-04' --before='2017-12-08' --author=xshen --pretty=oneline --abbrev-commit

git tag

git tag -a v1.6.700 -m 'Release v1.6.700'

# 给前面的提交补上 tag
git log --pretty=oneline
git tag -a v1.6.700 -m 'Release v1.6.700' e454ad98862

git push tag
git push origin --tag

设置 npm install 代理

npm config set proxy=http://10.17.201.60:8080       # 设置代理
npm config set proxy null # 取消代理

设置 cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install [name]
cnpm sync connect
cnpm info connect

Nightwatch 使用 VS code 进行调试

除了通过增加

<!-- more -->
console.log('===========')

来调试 Nightwatch 代码,如何通过配置 VS code 来 Debug Nightwatch 代码?

Ctrl+Shift+D 打开 Debug 界面,配置如下:

{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"type": "node",
"request": "launch",
"name": "npm test",
"program": "${workspaceRoot}/node_modules/nightwatch/bin/runner.js",
"args": [
"tests/DQA/DQA-221/login.js"
]
}
]
}

Nightwatch 打开多个窗口

如果想打开两个窗口并控制那个窗口怎么办?

<!-- more -->
var url = process.env.BASE_URL, newWindow;

client.execute(function (url, newWindow) {
window.open(url, newWindow, 'height=768,width=1024');
}, [url, newWindow]);

client.window_handles(function(result) {
this.verify.equal(result.value.length, 2, 'There should be 2 windows open');
newWindow = result.value[1];
this.switchWindow(newWindow);
})

度过工作中挫折心结

对于一个不善于言表的我工作中遇到过

  • 过度理解在与同事之间的Email和Chat中的意思;
  • 同事之间的沟通中出现的分歧事后还会继续琢磨;
  • 十分关注自己的工作失与得在上级领导中的看法。

以下方式对我来说还比较有效的

Read More

Change Hexo code highlight

Hexo 默认主题代码高亮是黑色的,如果想换个风格?具体操作如下:

# 修改 highlight.styl 文件,路径
themes/landscape/source/css/_partial/highlight.styl
<!-- more -->

修改默认代码主题 Tomorrow Night Eighties

highlight-background = #2d2d2d
highlight-current-line = #393939
highlight-selection = #515151
highlight-foreground = #cccccc
highlight-comment = #999999
highlight-red = #f2777a
highlight-orange = #f99157
highlight-yellow = #ffcc66
highlight-green = #99cc99
highlight-aqua = #66cccc
highlight-blue = #6699cc
highlight-purple = #cc99cc

为主题 Tomorrow

highlight-background = #ffffff
highlight-current-line = #efefef
highlight-selection = #d6d6d6
highlight-foreground = #4d4d4c
highlight-comment = #8e908c
highlight-red = #c82829
highlight-orange = #f5871f
highlight-yellow = #eab700
highlight-green = #718c00
highlight-aqua = #3e999f
highlight-blue = #4271ae
highlight-purple = #8959a8

更多详情请参考 tomorrow-theme 修改。