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
#!/usr/bin/env python | |
""" | |
HTTP Link Header Parsing | |
Simple routines to parse and manipulate Link headers. | |
""" | |
__license__ = """ | |
Copyright (c) 2009 Mark Nottingham |
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
#!/usr/bin/env python | |
""" | |
The **runtests.py** script supports simple test discovery (both `doctest`_ and `unittest`_) | |
and running discovered tests. | |
* ``-s DIRECTORY`` Directory to start discovery ('.' default) | |
* ``-t DIRECTORY`` Top level directory of project (default to start directory) | |
How to use:: |
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
"""GitHub flavoured markdown: because normal markdown has some vicious | |
gotchas. | |
Further reading on the gotchas: | |
http://blog.stackoverflow.com/2009/10/markdown-one-year-later/ | |
This is a Python port of GitHub code, taken from | |
https://gist.github.com/901706 | |
To run the tests, install nose ($ easy_install nose) then: |
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 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( |
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
#!/usr/bin/env python | |
""" | |
Use pip to get a list of local packages to check against one or more package | |
indexes for updated versions. | |
""" | |
import pip | |
import sys, xmlrpclib | |
from cStringIO import StringIO | |
from distutils.version import StrictVersion, LooseVersion |
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
require 'rubygems' | |
require 'json' | |
require 'redis' | |
class RedisComments | |
def initialize(redis,namespace,sort_proc=nil) | |
@r = redis | |
@namespace = namespace | |
@sort_proc = sort_proc | |
end |
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
Drop in replace functions for setTimeout() & setInterval() that | |
make use of requestAnimationFrame() for performance where available | |
http://www.joelambert.co.uk | |
Copyright 2011, Joe Lambert. | |
Free to use under the MIT license. | |
http://www.opensource.org/licenses/mit-license.php |
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 -*- | |
from django.contrib.auth.decorators import login_required | |
from django.utils.cache import patch_response_headers | |
from django.utils.decorators import method_decorator | |
from django.views.decorators.cache import cache_page, never_cache | |
from django.views.decorators.csrf import csrf_exempt | |
class NeverCacheMixin(object): | |
@method_decorator(never_cache) |
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
HTTPUSER = 'mylogin' | |
HTTPPASS = 'mypassword' | |
from wsgiproxy.app import WSGIProxyApp | |
from base64 import encodestring | |
proxyapp = WSGIProxyApp('http://remote.server.domain.com/') | |
# Craft Basic Auth header. Don't forget to strip the trailing \n. | |
HTTPAUTH = 'Basic ' + encodestring(HTTPUSER+':'+HTTPPASS).strip() |
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
<!-- this usually goes in <project-root>/templates/uni_form/field.html --> | |
{% if field.is_hidden %} | |
{{ field }} | |
{% else %} | |
<div class="clearfix {% if field.errors %}error{% endif %}"> | |
<label for="{{ field.auto_id }}" {% if field.field.required %}class="requiredField"{% endif %}> | |
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %} | |
</label> | |
<div class="input"> |
OlderNewer