The Daily Awesome Blog Thoughts, stories and ideas.

mongoimport csv, mongoexport json

git log - show commit history

SHA hash and commit message git log --pretty=oneline

912a2d1 Sun Sep 29 20:53:09 2013 -0400 - initial commit, var and media folders excluded [Vlad V] git log --pretty=format:"%h %ad - %s [%an]"

Show lines that were changed git log --oneline -p

Add to .bashrc alias gitlog='git log --pretty=format:"%h %ad - %s [%an]"' alias gitlogp='git log --pretty=format:"%h %ad - %s [%an]" -p'

Change email of all commits in Git

Callbacks and Scope


Vim Tip Of the Day

Undo Change, Redo Change
u, Control + r

Page Down, Page Up
Control + f, Control + b

Jump to End of File

Split screen/open another file
:vs  - split screen      :e  - open another file      

Ctrl + ww  - move from one screen to another
:sp - horizontal split

:tabe - open in a new tab     gt - move from one tab to another

Run shell command in vi
:sh - show command line   Control + D - go back to vi
control-z - will suspend the process and get back to your     shell
fg - will resume suspended vim
ps - list foreground processes

Tab selected text, Repeat last command
Shift + >, .

Jump to End of a curly brace
Shift + %

Visual select, Copy selection, Copy current line
v, gyy, yy

Paste text

Move to the begining of the line and insert mode

Move to the end of the line and insert mode

Search and Replace
Find word under cursor
forward: Shift + 8 (*), back: Shift + 3 (#)

First occurrence on current line, Globally (all) on current line
:s/OLD/NEW, :s/OLD/NEW/g

Forwad, Back
n, N

Between two lines #,#:                 

Every occurrence in file:
:%s/foo/bar/gc Change each 'foo' to 'bar', but ask for confirmation first.

:%s/foo/bar/gci Change each 'foo' (case insensitive) to 'bar'; ask for confirmation.

The g flag means global – each occurrence in the line is changed

Turn off escape chars
%sno/regex/new_text/g or \V

Cut text
cw - word
ci" - delete inside quote
cit - inside tag


m and any of the caps letters

jump to mark