This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#normal settings.py stuff should go above this comment | |
#if manage.py test was called, use test settings | |
if 'test' in sys.argv: | |
try: | |
from test_settings import * | |
except ImportError: | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NOTE: This is only used on my laptop for development purposes. | |
#HTTP config | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
ServerName website.localhost | |
DocumentRoot /web/website | |
<Directory /> | |
Options FollowSymLinks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function urlEncode(str){ | |
//everything except [a-zA-Z0-9-_~.] must be percent encoded: http://tools.ietf.org/html/rfc5849#section-3.6 | |
} | |
function hmac_sha1(key, text){ | |
//you'll definitely want a library for this. I used Crypto-JS: http://code.google.com/p/crypto-js/ | |
} | |
function base64me(key, text){ | |
//I used Crypto-JS for this too. | |
} | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.fancybox').fancybox({ | |
onClosed: function(){ | |
$('iframe').css('visibility', ''); | |
}, | |
onStart: function(){ | |
$('iframe').css('visibility', 'hidden'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tastypie import http | |
from tastypie.exceptions import ImmediateHttpResponse | |
from tastypie.resources import ModelResource | |
class CustomModelResource(ModelResource): | |
def obj_get(self, request=None, **kwargs): | |
try: | |
return super(CustomModelResource, self).obj_get(request=request, **kwargs) | |
except ObjectDoesNotExist: | |
# only branch if kwargs were supplied, which indicates filtering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tastypie import http | |
from tastypie.exceptions import ImmediateHttpResponse | |
from tastypie.resources import ModelResource | |
class CustomModelResource(ModelResource): | |
def deserialize(self, request, data, format='application/json'): | |
try: | |
return super(CustomModelResource, self).deserialize(request, data, format=format) | |
except Exception as e: | |
# if an exception occurred here it must be due to deserialization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mocked_urlopen_side_effect(url, *args, **kwargs): | |
"Returns string content in a file-like interface for a variety of possible URLs." | |
#StringIO is a file-like object, much like we'd expect urlopen to return | |
#responses is a dict (defined elsewhere) containing various string responses as the values for the keys. | |
if 'http://search.twitter.com/search.json' in url: | |
return StringIO(responses['twitter_success_1']) | |
elif 'http://api.twitter.com/1/geo/search.json' in url: | |
return StringIO(responses['twitter_geo_success_1']) | |
elif 'http://api.flickr.com/services/rest/' in url: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
#Copyright (C) 2013 Seán Hayes | |
import my_project.settings as dj_settings | |
from fabric.api import local, run, sudo, env, prompt, settings, cd, parallel, execute | |
from fabric.contrib.files import exists | |
from fabric.decorators import hosts, roles, runs_once | |
import json | |
import logging | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
from datetime import timedelta | |
import hashlib | |
import hmac | |
import json | |
import mimetypes | |
import re | |
from django.conf import settings | |
from django.utils import timezone |