Skip to content

Instantly share code, notes, and snippets.

View rakeshsukla53's full-sized avatar

Rakesh Sukla rakeshsukla53

View GitHub Profile
from django.http import HttpResponseRedirect
from django.conf import settings
from re import compile
EXEMPT_URLS = [compile(settings.LOGIN_URL.lstrip('/'))]
if hasattr(settings, 'LOGIN_EXEMPT_URLS'):
EXEMPT_URLS += [compile(expr) for expr in settings.LOGIN_EXEMPT_URLS]
class LoginRequiredMiddleware:
"""
@rakeshsukla53
rakeshsukla53 / zsh.md
Created December 29, 2015 14:40 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@rakeshsukla53
rakeshsukla53 / tree.md
Created December 28, 2015 21:07 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@rakeshsukla53
rakeshsukla53 / README.md
Last active August 29, 2015 06:58 — forked from chrislkeller/README.md
A pair of python scripts to create a flat json file from a given csv file that can be used in a handlebars.js template.

Snippets: Build a flat json file for handlebars.js template or jquery-vertical-timelines

UPDATED I've made some updates to the handlebars-json.py script.

  • Script now accepts a "usage" argument for "handlebars" or "timeline" or "array"
  • Script assumes a header row and strips underscores and spaces and converts header fields to lowercase when creating keys.
  • Because the resulting JSON file can also be used to power Vertical Timelines, I've re-named the script to csv-to-json.py.
  • The handlebars-json-csvkit.py script remains unchanged. I will attempt to re-work it to create handlebars or timeline JSON in the coming weeks.

See more in the Usage section below.