刘洪江的流水帐

拾起点点滴滴, 聚沙成石.

一个连咖啡都要趁热一饮而尽的男子

Greasemonkey Script

| Tags: javascript

没什么内容,慎看。

how to write a Greasemonkey script

Greasemonkey是火狐下面的一个扩展应用,通过它安装一些用户自定义的脚本,这脚本可以在浏览器运行的时候,对网页进行实时的改变。在chrome上也有一个对应的插件Tampermonkey。 这个工具很强大,我们可以添加自己脚本,来年完成一些我们自己想要完成的功能。

下面用给一个例子来介绍写这个脚本相关的知识。

Git Crlf

| Tags: git

跨平台的情况下,windows和unix的换行符谁不一样的。这个和git结合起来的时候有点烦哈。

如何将git的所有crlf文件转换成lf格式

将git库中的crlf转换为lf

下面这个脚本可以将库中的所有文件中的crlf去掉

Git Workflow

| Tags: git

参考了网上的多篇文章,然后结合现在自己参与的项目,总结了一个关于项目的git workflow的流程。 基本上是参考了gitflow的这篇文章。A successful Git branching model

重点是下面这一张图片。

名词

以上图片中的各个分支的解释。

  • master分支

    master分支保存了最新的发布代码,是稳定分支。永久保存。

  • develop分支

    保存了最新的下一个版本要发布的feature和bugfix的代码,是稳定分支,但是可以运行在一定时间内不稳定。永久保存。

    在没有创建release分支的时候,可以提交bugfix的代码(bug的fix version填写下一个版本的版本号)。一但创建了release分支,那么只能提交下一个版本的feature和bugfix代码。

Sublime Tips

显示cjk

安装了sublime以后,默认字体对cjk(中文,韩文,日文)支持不是很好,可以使用 YaHei Consolas Hybrid字体。 下载 YaHei Consolas Hybrid,可使用链接:

从google code下载

从github下载

放入windows下面的font目录。

在sublime里面: preferences->settings - User, 加入下面一行

1
"font_face": "YaHei Consolas Hybrid",

Sqlite

| Tags: sqlite

sqlite是一个非常小的数据库,适合小的应用,或者是app之类的.

install

  • windows command line

下载SQLite, 下载的文件是sqlite-shell-win32-x86-3081001.zip

下载后将sqlite3.exe放入到windows系统的path路径中,或者在pathe路径中加入sqlite3.exe所在的目录。

  • windows SqliteBrowser

可以使用GUI工具, 这个应该更方便

Git Tips

| Tags: git

how to pull after forced update

1
git reset origin/master --hard

this willResets the index and working tree. Any changes to tracked files in the working tree since are discarded.

当前工作目录的index和本地修改,都会被丢弃(丢弃的修改包括已经提交到本地的commit)

Git Reference

| Tags: git

git ref

可以使用下面的命令查看ref

1
git show HEAD

HEAD vs ORIG_HEAD

HEAD is (direct or indirect, i.e. symbolic) reference to the current commit. It is a commit that you have checked in the working directory (unless you made some changes, or equivalent), and it is a commit on top of which “git commit” would make a new one. Usually HEAD is symbolic reference to some other named branch; this branch is currently checked out branch, or current branch. HEAD can also point directly to a commit; this state is called “detached HEAD”, and can be understood as being on unnamed, anonymous branch.

ORIG_HEAD is previous state of HEAD, set by commands that have possibly dangerous behavior, to be easy to revert them. It is less useful now that Git has reflog: HEAD@{1} is roughly equivalent to ORIG_HEAD (HEAD@{1} is always last value of HEAD, ORIG_HEAD is last value of HEAD before dangerous operation).

“pull” or “merge” always leaves the original tip of the current branch in ORIG_HEAD.

HEAD is a moving pointer. Sometimes it means the current branch, sometimes it doesn’t.

Git Commit Message Convention

| Tags: git

I collect all information for internet, I did not write a single word.

A well-crafted git commit message is the best way to communicate context about a change to fellow developers (and indeed to their future selves)

examples

example of commit messages:

Capitalized, short (50 chars or less) summary

More detailed explanatory text, if necessary.  Wrap it to about 72
characters or so.  In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body.  The blank
line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the 
two together.
   
- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, followed by a
  single space, with blank lines in between, but conventions vary here
- Use a hanging indent