Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Saturday, July 30, 2011

Javascript version compare

Wednesday, June 1, 2011

JavaScript array shuffle

/**
 * @function
 * @param {Boolean} $new Need a new array or shuffle this.
 * @return {Array}
 * @see http://www.hardcode.nl/subcategory_1/article_317-array-shuffle-function.htm
 * @see http://yelotofu.com/2008/08/jquery-shuffle-plugin/
 * @author Alexey Bass (albass)
 */
Array.prototype.shuffle = function($new) {
    $new = $new || false;
    
    var $a = !$new ? this : this.slice()
    ,   $len = $a.length, $i = $len
    ,   $p, $t;
    
    while ($i--) {
        $p = parseInt(Math.random() * $len);
        $t = $a[$i], $a[$i] = $a[$p], $a[$p] = $t;
    }
    
    return $a;
};

Also on GitHub

Wednesday, December 8, 2010

Thursday, January 21, 2010

Git aliases

I found this very useful in day-to-day git work.
[alias]
    a = add

    s = status --short
    ss = status

    b = branch -a
    ba = branch -a -vv
    bs = !git-branch-status
    bsi = !git-branch-status -i

    c = commit
    cm = commit -m

    co = checkout

    d = diff --color
    ds = diff --color --stat
    dsp = diff --color --stat -p
    # files changed between commits
    dn = diff --color --name-only

    l = log --color --decorate
    ls = log --color --stat --decorate
    ln = log --name-status --color
    lsp = log --color --stat -p --decorate
    lg = log --graph '--pretty=tformat:%Cblue%h%Creset %Cgreen%ar%Creset %Cblue%d%Creset %s'
    lga = log --graph '--pretty=tformat:%Cblue%h%Creset %Cgreen%ar%Creset %Cblue%d%Creset %s' --all
    l10 = log --graph '--pretty=tformat:%Cblue%h%Creset %Cgreen%ar%Creset %Cblue%d%Creset %s' --all -10
    # for complicated branches
    lsd = log --graph '--pretty=tformat:%Cblue%h%Creset %Cgreen%ar%Creset %Cblue%d%Creset %s' --all --simplify-by-decoration

    ru = remote update
    sb = show-branch --sha1-name

    ls-del = ls-files -d
    ls-mod = ls-files -m # including remote files
    ls-new = ls-files --exclude-standard -o
    ls-ign = ls-files --exclude-standard -o -i

Update (2012-11-11)
https://gist.github.com/4056358