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
| """ | |
| Bundles the iterable `l` into an iterable of tuples of length `x`, filling the last one with `f` if necessary. | |
| Examples: | |
| In [13]: list(bundle([1,2,3,4,5,6], 3, None)) | |
| Out[13]: [(1, 2, 3), (4, 5, 6)] | |
| In [14]: list(bundle([1,2,3,4,5,6], 2, None)) | |
| Out[14]: [(1, 2), (3, 4), (5, 6)] |
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
| # -*- coding: utf-8 -*- | |
| # SOURCE: http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm | |
| from django.utils.translation import ugettext_lazy as _ | |
| COUNTRIES = [ | |
| (_(u"Afghanistan"), u"AF"), | |
| (_(u"Åland Islands"), u"AX"), | |
| (_(u"Albania"), u"AL"), | |
| (_(u"Algeria"), u"DZ"), | |
| (_(u"American Samoa"), u"AS"), |
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
| (pypyenv)jonas@jonas-Serval-Professional:~/workspace/gitstats.ep.io$ time pypy run.py /home/jonas/workspace/django-cms | |
| real 0m2.493s | |
| user 0m2.376s | |
| sys 0m0.100s |
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
| URL = 'http://httpbin.org/status/200' | |
| def check(status_code, headers, content): | |
| assert status_code == 200 | |
| assert headers['Content-Length'] == '0' | |
| assert headers['Content-Type'] == 'text/html; charset=utf-8' | |
| assert headers['Connection'] == 'close' | |
| print 'OK' |
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
| """ | |
| Dummy code for my thoughts described in https://groups.google.com/forum/#!topic/django-cms-developers/bFbhE1a-rTs | |
| Note that this pseudo-implementation has problems where between `cache.get(...)` | |
| in `get_cached` and `cache.set(...)` the value *could* have changed in the cache, | |
| so some kind of better way to prevent overwriting changes done by others should | |
| be implemented. | |
| """ | |
| # the local python in-memory cache | |
| LOCAL_CACHE = {} |
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
| ========================= | |
| How the menu system works | |
| ========================= | |
| Basic concepts | |
| ============== | |
| Registration | |
| ------------ |
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
| # -*- coding: utf-8 -*- | |
| # IS IN FOLDER ./src/ (github doesn't allow slashes in filenames on gists) | |
| import os | |
| import re | |
| DEBUG = False | |
| TEMPLATE_DEBUG = DEBUG | |
| DEBUG_PROPAGATE_EXCEPTIONS = False | |
| IS_DEV_SERVER = False | |
| PREPEND_WWW = False |
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
| # -*- coding: utf-8 -*- | |
| from django.db import models | |
| from django.db.models.query import QuerySet | |
| class ChainableManager(models.Manager): | |
| """ | |
| A manager that allows chaining of all methods defined on it. | |
| 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
| $.fn.doubleOptIn = function(){ | |
| return this.each(function(){ | |
| var ele = $(this); | |
| ele.bind('click', function(event){ | |
| event.preventDefault(); | |
| if (ele.attr('type') == 'submit'){ | |
| ele.val(ele.attr('x-opt-in-text')); | |
| } else { | |
| ele.text(ele.attr('x-opt-in-text')); | |
| } |
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
| #blueBarHolder { | |
| position: fixed; | |
| top: 0; | |
| } | |
| #globalContainer { | |
| padding-top: 38px; | |
| } | |
| #leftCol { |