Skip to content

Instantly share code, notes, and snippets.

View eculver's full-sized avatar
🧠
Braining

Evan Culver eculver

🧠
Braining
View GitHub Profile
@eculver
eculver / .gitconfig
Created October 19, 2009 21:38
A sample ~/.gitconfig for coloring and other fanciness.
[alias]
st = status
diffstat = diff --stat -r
c = commit
co = checkout
[color]
ui = auto
[color "branch"]
function dumpProps(obj, parent) {
// Go through all the properties of the passed-in object
for (var i in obj) {
// if a parent (2nd parameter) was passed in, then use that to
// build the message. Message includes i (the object's property name)
// then the object's property value on a new line
if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }
// Display the message. If the user clicks "OK", then continue. If they
// click "CANCEL" then quit this level of recursion
if (!confirm(msg)) { return; }
@eculver
eculver / Python SMTP server one-liner
Created October 27, 2009 16:54
Python SMTP server one-liner
python -m smtpd -n -c DebuggingServer localhost:1025
@eculver
eculver / Dump single MySQL column data
Created November 20, 2009 02:51
Dump single MySQL column data
mysql -h <HOST> -u <USER> -p <DB> -Bse"select column from table;" >> file.dmp
@eculver
eculver / set custom headers with jquery $.ajax
Created November 20, 2009 23:12
set custom headers with jquery $.ajax
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Content-Type","application/json");
xhrObj.setRequestHeader("Accept","application/json");
}
type: "POST",
url: "/someurl",
processData: false,
data: jsonData,
dataType: "json",
@eculver
eculver / Auto-refresh bookmarklet
Created January 2, 2010 01:02
Auto-refresh bookmarklet
// origin: http://www.google.com/support/forum/p/Chrome/thread?tid=1a37ccbdde5902fd&hl=en
javascript:
timeout=prompt("Set timeout [s]");
current=location.href;
if(timeout>0)
setTimeout('reload()',1000*timeout);
else
location.replace(current);
function reload(){
@eculver
eculver / get newest directory
Created January 31, 2010 20:24
get newest directory
ls -lt | awk 'NR==2 {print $8}'
@eculver
eculver / .vimrc
Created February 9, 2010 00:11
.vimrc
"---- General Settings ----
syntax on
set showmatch
set number
set ruler
set incsearch
set hlsearch
set ignorecase
set cursorline " Highlight current line
@eculver
eculver / remove all .pyc files bash alias
Created February 18, 2010 20:47
remove all .pyc files bash alias
alias rmpyc="find . -name '*.pyc' -exec rm {} \;"
@eculver
eculver / start memcached locally
Created February 19, 2010 04:16
start memcached locally
memcached -m 64 -p 11211 -u `whoami` -l 127.0.0.1