Git note

Git: How to view file diff before commit

You’re looking for git diff. Depending on your exact situation, there are three useful ways to use it:

It’ll work recursively on directories, and if no paths are given, it shows all changes.

Git: git ignore files only locally(Prevent local changes getting pushed in Git)

Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the $GIT_DIR/info/exclude file.

The .git/info/exclude file has the same format as any .gitignore file. You can also set core.excludesfile to the name of a file containing global patterns.

If you already have unstaged changes you must then run:

To get it back if one day you need it:

Note on $GIT_DIR: This is a notation used all over the git manual simply to indicate the path to the git repository. If the environment variable is set, then it will override the location of whichever repo you’re in, which probably isn’t what you want.

Git commads

Checkout remote branch



Is there any CRM for small business?

One of my friend asked me if I can build a website to manage his clients. I recommend he have a look CRM apps. So I did some search on google and tested some of them. Here is one I found very good.

And ZOHO has other products:

Which provided a free version for 10 users. with 1G space. Compare to others like insightly, this one looks cheaper and better.

HTTP Authentication with PHP running as CGI

When I used HTTP Basic Authentication for my API, I just found it is not working on the server, but it is working on my localhost.

The reason is HTTP Authorization does not work when your PHP is installed and working as CGI. It works perfectly when PHP is installed as a module though. You can check PHP info to find which way is you php installed.

But we always can have a solution.

reference article:

My code:



Need notice:

Depending on your apache version the variable you rewrite can be prepended with ‘REDIRECT_’.

That is if you’re using HTTP_AUTHORIZATION the real variable in _SERVER becomes REDIRECT_HTTP_AUTHORIZATION.

Final in PHP






Embed Twitter Feeds Into Your Website by Twitter V1.1 API

There is a project I did today that required to embed client’s twitter feed into the their site footer.

I don’t want using any plugin or twitter widget. Because that is hard to redesign or customise the looking.

After researched online for a while, then I found this answer is very useful:

So you want to use the Twitter v1.1 API? 

Just follow that, then you will go through easily.