Colors in git diff

When I use git a diff function is really useful but by default it displays VT100 commands instead text coloring. This is solution how to enable colors in git diff.


add this line to your ~/.cshrc.user

setenv LESS -R

and source that file:

source ~/.cshrc.user

Remove multiple spaces in Erlang

I recently I ran into a problem in Erlang project and I had to find a way to Remove multiple spaces in string and leave only one one space.

Some string with     extra        spaces.


Here is solution how to remove it with simple re:replace

re:replace("Some string with     extra        spaces.", "(\\s+\\s+)", " ", [global,{return,list}]).

and the returned output is:

Some string with extra spaces.

Useful links: