Skip to content

Instantly share code, notes, and snippets.

View gnepud's full-sized avatar

Peng Du gnepud

  • Grenoble, France
View GitHub Profile
@gnepud
gnepud / .gitconfig
Created May 31, 2012 13:46
Git config
[color]
ui = true
[alias]
lg1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%cr)%C(reset) %C(white)%s%C(reset) %C(bold white)— %cn%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
lg2 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%cD%C(reset) %C(bold green)(%cr)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %cn%C(reset)' --abbrev-commit
lg = !"git lg1"
@gnepud
gnepud / gist:2843503
Last active October 5, 2015 17:18
Show the current git branch in terminal
# Show the current git branch in terminal
COLOR_RESET="\e[0m"
RED="\e[1;31m"
YELLOW="\e[1;33m"
GREEN="\e[1;32m"
CYAN="\e[1;36m"
PS1="\[$YELLOW\]\u \[$COLOR_RESET\]at \[$CYAN\]\h \[$RED\]\W"
PS1+='$(__git_ps1 " \[$GREEN\](%s)") '
PS1+="\[$COLOR_RESET\]\$ "
@gnepud
gnepud / Custom.css
Created May 8, 2012 08:10 — forked from star-szr/Custom.css
IR_Black Theme (with sidebar and view-source colors) for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@gnepud
gnepud / gist:2603827
Created May 5, 2012 16:30 — forked from ybart/gist:1070803
Google +1 Bookmarklet (Top Left)
javascript:(function(){div=document.createElement('div');e=document.createElement('g:plusone');div.style.position='fixed';div.style.top='8px';div.style.left='8px';div.style.zIndex=9999;div.appendChild(e);document.body.appendChild(div);e=window.document.createElement('script');e.setAttribute('src','https://apis.google.com/js/plusone.js');document.body.appendChild(e);})();
@gnepud
gnepud / gist:2483913
Created April 24, 2012 21:21
Désactiver la fonction de sauvegarde automatique des documents Pixelmator
defaults -currentHost write com.pixelmatorteam.pixelmator "disableAutosave" -bool YES
@gnepud
gnepud / singleton.js
Created April 12, 2012 09:50
javascript singleton
function singleton() {
var instance = (function() {
var privateVar;
function privateMethod () {
// ...
}
return { // public interface
publicMethod1: function () {
@gnepud
gnepud / gist:2331772
Created April 7, 2012 20:08
A simple template parser
function simple_template(str, obj) {
return str.replace(/\{\s*(\w+)\s*\}/g, function(_i, _1) {
return obj[_1] != null ? obj[_1] : '';
});
};
@gnepud
gnepud / test_helper.rb
Created April 6, 2012 08:57 — forked from sethbro/test_helper.rb
MiniTest::Spec with Rails 3.2 setup
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/pride'
require 'capybara/rails'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
@gnepud
gnepud / gist:2047292
Created March 15, 2012 22:06 — forked from dx7/gist:1333785
Installing ruby-debug with ruby-1.9.3-p0
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1333785)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@gnepud
gnepud / gist:2032596
Created March 13, 2012 23:25
Removing .DS_Store files on Mac OS X
find . -name ".DS_Store" -depth -exec rm {} \;