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
""" | |
in settings.py: | |
MIDDLEWARE_CLASSES = ( | |
'yourproject.middleware.HostnameMiddleware', | |
) | |
""" | |
class HostnameMiddleware: | |
def process_request(self, request): | |
site = get_site_vars(request.META['HTTP_HOST']) |
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 memcached_stats import MemcachedStats | |
mem = MemcachedStats('127.0.0.1') | |
>>> mem.keys() | |
['key-1', | |
'key-2', | |
'key-3', | |
... ] |
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
doc = Tag('epp', attrs={'xmlns': 'urn:ietf:paramxml:nepp-1.0'}).append( | |
Tag('response').append( | |
Tag('result', attrs={'code': '1000'}).append( | |
Tag('msg', text='Command completed successfully') | |
), | |
Tag('resData').append( | |
Tag('obj:creData', attrs={ | |
'xmlnobj': 'urn:ietf:paramxml:nobj' | |
}).append( | |
Tag('obj:name', text='example') |
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
<!doctype html> | |
<html> | |
<head> | |
<title>IDKIT javascript example</title> | |
</head> | |
<body> | |
<div id="idkit-root"></div> | |
<script src="https://www.federatedidentity.com/static/js/idkit.js"></script> | |
<script> |
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
<!doctype html> | |
<html> | |
<head> | |
<title>require.js bootstrapping test</title> | |
</head> | |
<body> | |
<script src="require-jquery.js"></script> | |
<script> | |
define('config', function() { |
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
import os | |
from django.conf import settings | |
from jinja2 import nodes | |
from jinja2.exceptions import TemplateSyntaxError | |
from jinja2.ext import Extension | |
class AssetExtension(Extension): | |
'''Jinja2 extension to append modified timestamp for cachebreaking |
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
define([ | |
'jquery', | |
'another_view', | |
'cs!some_view' | |
], function($, AnotherView, SomeView) { | |
var view = new SomeView; | |
}); |
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
{ | |
"subdomain": "somebusinessname" | |
"domain": "publisherdomain.com", | |
"title": "Some Business Name", | |
"theme_id": 65, | |
"site_type": "LocalBusinessYellowmagic", | |
"partner_user_id": 12345, | |
"first_name": "John", | |
"last_name": "Doe", |
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
container_commands: | |
01_syncdb: | |
command: "django-admin.py syncdb --noinput" | |
leader_only: true | |
02_createadmin: | |
command: "bin/createadmin.py" | |
leader_only: true | |
03_migrate_myapp: | |
command: "./manage.py migrate --noinput --merge" | |
leader_only: true |
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
# old django 1.2.3 validator | |
# django/core/validators.py | |
email_re = re.compile( | |
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom | |
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string | |
r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE) # domain | |
# updated validator patch |
OlderNewer