Skip to content

Instantly share code, notes, and snippets.

@rnorth
rnorth / gist:2031652
Created March 13, 2012 21:14
Cookie-based authentication with nginx
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@abyx
abyx / list_filter_collapse.js
Created June 9, 2011 20:09
java script trick to hide the "filter" in a django admin view
(function($){
ListFilterCollapsePrototype = {
bindToggle: function(){
var that = this;
this.$filterTitle.click(function(){
that.$filterContent.slideToggle();
that.$list.toggleClass('filtered');
});
},
init: function(filterEl) {
@peterbraden
peterbraden / Local ISO String for Date
Created December 23, 2010 00:40
toISOString with timezone support
Date.prototype.toLocalISOString = function(){
// ISO 8601
var d = this
, pad = function (n){return n<10 ? '0'+n : n}
, tz = d.getTimezoneOffset() //mins
, tzs = (tz>0?"-":"+") + pad(parseInt(tz/60))
if (tz%60 != 0)
tzs += pad(tz%60)
@rajeshg
rajeshg / mkcd.bash
Created November 23, 2010 19:01
mkcd command - how to create a directory using mkdir and cd in one step
#
# mkcd command
# This is an improvised version of the mkcd command at http://superuser.com/questions/152794/is-there-a-shortcut-to-mkdir-foo-and-immediately-cd-into-it
# This function has to be added to the ~/.bashrc file
# After that you can run command like: mkdir abc, mkdir -p one/two/three
#
function mkcd {
last=$(eval "echo \$$#")
if [ ! -n "$last" ]; then
echo "Enter a directory name"