Skip to content

Instantly share code, notes, and snippets.

View lifeicd's full-sized avatar

Clyde Li lifeicd

  • Booking.com
  • Amsterdam
View GitHub Profile
@lifeicd
lifeicd / ps1.sh
Created December 4, 2012 04:11
vcs info on PS1
vcs() {
if [[ -d ".svn" ]] ; then
__svn_branch 2> /dev/null | \
awk '{ printf "svn:" $1 }'
elif [[ -d ".hg" ]] ; then
hg branch 2> /dev/null | \
awk '{ printf " hg:on " $1 }'
hg bookmarks 2> /dev/null | \
awk '/\*/ { printf " hg:at " $2 }'
elif [[ -d .git ]] ; then
@lifeicd
lifeicd / git.submodule.md
Created October 10, 2012 06:57
submodule

TL;DR: 什么时候要用再看吧…也许现在你的兴趣并不大

把这篇文章里的命令打完,就能明白git submodule了 http://git-scm.com/book/en/Git-Tools-Submodules

Submodules are for things such as commonly reused libraries. It should be self-contained.

要点:

  1. submodule在添加或改动时,在主文件夹内commit,会产生特别的submodule型changeset.
  2. git submodule update负责把submodule的HEAD移动到最近的submodule型changeset里记录的SHA的节点
@lifeicd
lifeicd / pubsub
Created November 26, 2011 05:34
PubSub
/*!
*
* * jQuery Tiny Pub/Sub - v0.3 - 11/4/2010
*
* * http://benalman.com/
*
* *
*
* * Copyright (c) 2010 "Cowboy" Ben Alman
*
@lifeicd
lifeicd / Class_lib
Created November 26, 2011 05:33
Class Lib
var Class = function(parent){
var klass = function(){
this.init.apply(this, arguments);
};
// Change klass' prototype
if (parent) {
var subclass = function() { };
subclass.prototype = parent.prototype;
klass.prototype = new subclass;