Skip to content

Instantly share code, notes, and snippets.

View theskumar's full-sized avatar

Saurabh Kumar theskumar

View GitHub Profile
@theskumar
theskumar / compat.py
Created June 14, 2014 05:35
Django Compatibility
import django
from django.conf import settings
from django.utils import six
# Django 1.5 add support for custom auth user model
if django.VERSION >= (1, 5):
AUTH_USER_MODEL = settings.AUTH_USER_MODEL
else:
AUTH_USER_MODEL = "auth.User"
#
#Copyright (c) 2008 Fred Palmer fred.palmer_at_gmail.com
#
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without
#restriction, including without limitation the rights to use,
#copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the
#Software is furnished to do so, subject to the following

Keybase proof

I hereby claim:

  • I am theskumar on github.
  • I am theskumar (https://keybase.io/theskumar) on keybase.
  • I have a public key whose fingerprint is 01C6 FD56 20FD 3FB4 C76E 0F8E 5AF3 6615 5E77 1692

To claim this, I am signing this object:

@theskumar
theskumar / exceptions.py
Last active January 16, 2020 01:24
User Management in django 1.5 and tastypie
import json
from tastypie.exceptions import TastypieError
from tastypie.http import HttpBadRequest
class CustomBadRequest(TastypieError):
"""
This exception is used to interrupt the flow of processing to immediately
return a custom HttpResponse.
@theskumar
theskumar / Default(OSX).sublime-keymap.json
Last active December 25, 2015 01:49
Sublime Text User Keybindings
[
{ "keys": ["super+ctrl+s"], "command": "save_project_as" },
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
// Toggle word wrap
{
"keys": ["alt+w"],
"command": "toggle_setting",
"args":
@theskumar
theskumar / setup.sh
Last active October 18, 2018 03:11 — forked from ritesh-fueled/installDependenciesToCompileObjectiveCInUbuntu
Install and compile Objective-C in linux
function _print(){
echo `date`":" $1 "..."
}
_print "Installing gcc compiler for objective C"
sudo apt-get install gnustep gnustep-devel gobjc tree
_print "Creating a sample test project structure"
@theskumar
theskumar / index.html
Created August 11, 2013 13:03
A CodePen by Saurabh Kumar. Spinning the Wheel
<section class="spin_widget">
<div class="wheel_holder">
<img src="https://dl.dropboxusercontent.com/s/p1grg6kuspaklqe/spinner-wheel_board__highlight.png?token_hash=AAFEC_xUVm6Na2aYdb0jcdC1-1q-0f3svu5uOQPwYIEu1A&dl=1" alt="" class="highlights" />
<img class="wheel" src="https://dl.dropboxusercontent.com/s/6ngd3cir5xsh0ud/spinner-wheel_board__content.png?token_hash=AAH7POtGmIwkgg0DPAXYMuEAgs_6597rp3uX7bNnd3qi-w&dl=1" alt="" />
<div class="needle"></div>
<img src="https://dl.dropboxusercontent.com/s/zacc6u68fa242no/spinner-pin.png?token_hash=AAEuCX0H3IuKOgJPT6blTpfsRgTQhjNOQY8-w5L_xOh9HA&dl=1" alt="" class="pin" />
</div>
<div class="content">
<div class="action_text">
@theskumar
theskumar / index.html
Created August 11, 2013 13:02
A CodePen by Saurabh Kumar. Spinning the Wheel
<section class="spin_widget">
<div class="wheel_holder">
<img src="https://dl.dropboxusercontent.com/s/p1grg6kuspaklqe/spinner-wheel_board__highlight.png?token_hash=AAFEC_xUVm6Na2aYdb0jcdC1-1q-0f3svu5uOQPwYIEu1A&dl=1" alt="" class="highlights" />
<img class="wheel" src="https://dl.dropboxusercontent.com/s/6ngd3cir5xsh0ud/spinner-wheel_board__content.png?token_hash=AAH7POtGmIwkgg0DPAXYMuEAgs_6597rp3uX7bNnd3qi-w&dl=1" alt="" />
<div class="needle"></div>
<img src="https://dl.dropboxusercontent.com/s/zacc6u68fa242no/spinner-pin.png?token_hash=AAEuCX0H3IuKOgJPT6blTpfsRgTQhjNOQY8-w5L_xOh9HA&dl=1" alt="" class="pin" />
</div>
<div class="content">
<div class="action_text">
{
"metadata": {
"name": "exercise"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
# This Python file uses the following encoding: utf-8
import os, sys
import datetime
from tempfile import mkstemp
from django.conf import settings
from django.db import models, connection
from django.db.models import signals
from django.db.models.fields import AutoField, DateTimeField, DateField, TimeField
from django.db.models.fields.related import ForeignKey, OneToOneField