My Cheat Sheet

March 13th 2013 by Samuel Rossille

Docker

Remove all containers: docker rm $(docker ps -a -q)

Remove all images: docker rmi $(docker images -q)

Windows

Fichier hosts sous windows: C:\Windows\System32\drivers\etc

Installing apache on windows: 8637.InstallingApacheonWindows.pdf

Check current network connections: netstat -a -n -p tcp -b

Subversion

Revert a past commit in a Subversion working copy: svn merge -c -42

Git

Configure a bare repository on the server:

mkdir reponame.git
groupadd reponamegit
usermod -a -G reponamegit user
cd reponame.git
git init --bare --shared=0660
cd ..
chown -R root:reponamegit reponame.git

Clone the repository (configured above):

git clone ssh://user@server.com/path/to/git/repos/reponame.git

Clone a SVN repository

git svn clone -s http://url/of/repository

CSS

Prevent selection

/* from <http://stackoverflow.com/a/4407335/1060205> */
.unselectable {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

JavaScript

Make input's content selected on focus. The setTimeout is to workaround a bug in Chrome.

$(selector).focus(function() {
    var $input = $(this);
    setTimeout(function() {$input.select();});
});