As configured in my dotfiles.
start new:
tmux
start new with session name:
#!/usr/bin/env python | |
""" | |
Obviously this is only useful if you have to deal with Django's | |
Trac a lot. | |
Mostly stolen from Jacob Kaplan-Moss, but improved by Jannis Leidel | |
and Aymeric Augustin. | |
Reads a config file at ~/.djpatchrc, e.g.: |
# -*- coding: utf-8 -*- | |
from django.contrib.auth.decorators import login_required | |
from django.utils.cache import patch_response_headers | |
from django.utils.decorators import method_decorator | |
from django.views.decorators.cache import cache_page, never_cache | |
from django.views.decorators.csrf import csrf_exempt | |
class NeverCacheMixin(object): | |
@method_decorator(never_cache) |
/** | |
* @see http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/ | |
*/ | |
function betterTypeOf(input) { | |
try { | |
return Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1].toLowerCase(); | |
} catch (e) { | |
return typeof input; | |
} | |
} |
#################################################### | |
# WARNING: This is very hacky! Use at your own risk. | |
# | |
# This assumes you have all keys in a single DB and | |
# want to move them all to DB 0. If you have keys | |
# in more than one DB, the first DB found will be | |
# rewritten to 0, with all others left alone. | |
#################################################### | |
import shutil |
#!/usr/bin/env python | |
import os | |
import re | |
import subprocess | |
import sys | |
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)') | |
CHECKS = [ |
(?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+)){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))|[~;:@&=])*)(?:/(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))|[~;:@&=])*))*)(?:\?(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))|[/;:@&=])*))?)?)|(?:ftp://(?:(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))|[;?&=])*)(?::(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))|[;?&=])*))?@)?(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+)){3}))(?::(?:\d+))?))(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))|[?:@&=])*)(?:/(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))|[?:@&=])*))*)(?:;type=[AIDaid])?)?)|(?:news:(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))|[;/?:&=])+@(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?: |
// ====================== | |
// FlexGrid | |
// ====================== | |
// Usage : | |
// nb of column, column width, column gutter, min-width, max-width, responsive, fluid/fixed | |
// @include flexGrid(12, 60, 20, 640px, 1024px, true) | |
@mixin flexGrid($grid-columns: 12, $grid-column-with:60, $grid-column-margin: 20, |
function maybe(value) { | |
var obj = null; | |
function isEmpty() { return value === undefined || value === null } | |
function nonEmpty() { return !isEmpty() } | |
obj = { | |
map: function (f) { return isEmpty() ? obj : maybe(f(value)) }, | |
getOrElse: function (n) { return isEmpty() ? n : value }, | |
isEmpty: isEmpty, | |
nonEmpty: nonEmpty | |
} |
# "Our Custom Mixins" | |
# http://brack3t.com/our-custom-mixins.html | |
class LoginRequiredMixin(object): | |
""" | |
View mixin which verifies that the user has authenticated. | |
NOTE: | |
This should be the left-most mixin of a view. |
As configured in my dotfiles.
start new:
tmux
start new with session name: