Skip to content

Instantly share code, notes, and snippets.

View dan0's full-sized avatar

Dan Drayne dan0

View GitHub Profile
@dan0
dan0 / test.html
Last active October 30, 2015 13:27
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Van Morrison on Spotify</title>
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta name="google" value="notranslate">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-itunes-app" content="app-id=324684580, app-argument=https://open.spotify.com/artist/44NX2ffIYHr6D4n7RaZF7A">
@dan0
dan0 / addevent.js
Created March 12, 2012 16:05
Add event
var addEvent = function() {
if (window.addEventListener) {
return function(el, type, fn) {
el.addEventListener(type, fn, false);
};
} else if (window.attachEvent) {
return function(el, type, fn) {
var f = function() {
fn.call(el, window.event);
};
while read line; do echo $line; sleep 2; done
while read line; do echo $line; sleep 2; done
@dan0
dan0 / gist:1816239
Created February 13, 2012 11:41
Show current branch in terminal prompt
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/'
}
export
PS1='\u\[\e[1;37m\]@\[\e[1;32m\]\h\[\e[1;37m\]:\[\e[1;31m\]\W\[\e[1;33m\]$(parse_git_branch)\[\e[0;39m\] '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'
@dan0
dan0 / gist:1816235
Created February 13, 2012 11:40
Show current branch in terminal
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/'
}
export
PS1='\u\[\e[1;37m\]@\[\e[1;32m\]\h\[\e[1;37m\]:\[\e[1;31m\]\W\[\e[1;33m\]$(parse_git_branch)\[\e[0;39m\] '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'
@dan0
dan0 / gist:1816232
Created February 13, 2012 11:39
Show current git branch in terminal
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/'
}
export
PS1='\u\[\e[1;37m\]@\[\e[1;32m\]\h\[\e[1;37m\]:\[\e[1;31m\]\W\[\e[1;33m\]$(parse_git_branch)\[\e[0;39m\] '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'
@dan0
dan0 / snippet.html
Created October 15, 2011 23:20
st2 test 2
<html>
<head>
<title></title>
</head>
<body>
<div>
</div>
</body>
</html>
@dan0
dan0 / snippet.txt
Created October 15, 2011 23:19
st2 send
<html>
<head>
<title></title>
</head>
<body>
<div>
</div>
</body>
</html>
import mongoengine
from django.conf import settings
from django.core.exceptions import MiddlewareNotUsed
class MongoEngineConnectionMiddleware(object):
''' Ensure that a separate mongoengine connection is made per thread.
See: http://groups.google.com/group/mongoengine-users/browse_thread/thread/1aa3f9d65627c04
Assumes the following is your Django settings. Tweak as needed.
MONGODB = {