Skip to content

Instantly share code, notes, and snippets.

View pcx's full-sized avatar
💯
set the controls for the heart of the sun

Phaneendra Chiruvella pcx

💯
set the controls for the heart of the sun
View GitHub Profile
@pcx
pcx / pr.md
Created June 22, 2013 20:39 — forked from piscisaureus/pr.md
Check out pull requests locally.

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@pcx
pcx / gist:3624276
Created September 4, 2012 18:04 — forked from attaboy/gist:1346280
Destroy the localStorage copy of less.js client-side-generated CSS
// Destroys the localStorage copy of CSS that less.js creates
function destroyLessCache(pathToCss) { // e.g. '/css/' or '/stylesheets/'
if (!window.localStorage || !less || less.env !== 'development') {
return;
}
var host = window.location.host;
var protocol = window.location.protocol;
var keyPrefix = protocol + '//' + host + pathToCss;
@pcx
pcx / redis_session_backend.py
Created April 10, 2012 05:41 — forked from mikeyk/redis_session_backend.py
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(