This file contains hidden or 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
for file in `git diff-tree --no-commit-id --name-only -r HEAD | sort | uniq` | |
do | |
if [ ${file: -3} == ".py" ] | |
then | |
flake8 --ignore=E121,E123,E124,E125,E126,E127,E128 $file | |
fi | |
if [ ${file: -3} == ".js" ] | |
then | |
jshint $file | |
fi |
This file contains hidden or 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 django.utils.decorators import method_decorator | |
def class_decorator(decorator): | |
def inner(cls): | |
orig_dispatch = cls.dispatch | |
@method_decorator(decorator) | |
def new_dispatch(self, request, *args, **kwargs): | |
return orig_dispatch(self, request, *args, **kwargs) | |
cls.dispatch = new_dispatch | |
return cls |
This file contains hidden or 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 django.conf import settings | |
from django.http import HttpResponsePermanentRedirect, get_host | |
class ForceSSLMiddleware(object): | |
""" | |
Redirects all (non-DEBUG) requests to go through SSL. | |
Picks up the `HTTP_X_FORWARDED_PROTO` proxy header set by Heroku. | |
Also sets the "Strict-Transport-Security" header for 600 seconds so that |
This file contains hidden or 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
#!/usr/bin/env python | |
# encoding: utf-8 | |
##### | |
##### Readability.py -- by fish. © 2009, Some Rights Reserved But Some May Be | |
##### http://objectsinspaceandtime.com/ | |
##### | |
##### it's a python port of the Readability JavaScript bookmarklet, | |
##### by Arc90 Labs -- | |
##### http://lab.arc90.com/2009/03/readability.php |
This file contains hidden or 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
"Memcached cache backend" | |
from django.core.cache.backends import memcached | |
from django.utils.encoding import smart_unicode, smart_str | |
MIN_COMPRESS_LEN = 150000 | |
class CacheClass(memcached.CacheClass): | |
def add(self, key, value, timeout=None, min_compress_len=MIN_COMPRESS_LEN): | |
if isinstance(value, unicode): |