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
| highlight --line-numbers --font-size 24 --font Inconsolata --style solarized-dark -W -J 80 -j 3 --src-lang python -O rtf highlight.py | pbcopy |
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 pid, d, t, c, sd, st, sc, dtype in zip(data_pid, | |
| data_day, | |
| data_time, | |
| data_class, | |
| data_sourceday, | |
| data_sourcetime, | |
| data_sourceclass, | |
| data_type): | |
| pass |
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.urls import patterns, include, url | |
| from django.views.generic.base import TemplateView, RedirectView | |
| from mezzanine.conf import settings | |
| urlpatterns = patterns("",) | |
| # Common urls | |
| urlpatterns += patterns('', | |
| url(r'^$', TemplateView.as_view(template_name='index.html'), name="home"), | |
| url(r'^favicon\.ico$', RedirectView.as_view(url='/static/img/favicon.ico'), name="favicon"), |
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
| # Chaining filter() | |
| ateacher_list = teacher_list.filter(Q(asubjects__in=[subject])).filter(~Q(subjects__in=[subject]).distinct() | |
| # Using Q() & Q() | |
| ateacher_list = teacher_list.filter( | |
| Q(asubjects__in=[subject]) & ~Q(subjects__in=[subject] | |
| ).distinct() |
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
| # http://stackoverflow.com/questions/431628/how-to-combine-2-or-more-querysets-in-a-django-view | |
| from itertools import chain | |
| from operator import attrgetter | |
| def join_list(*args, sort_key=None): | |
| if sort_key: | |
| return sorted(chain(args), key=attrgetter(sort_key)) | |
| return list(chain(args)) |
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
| try: | |
| import djcelery | |
| djcelery.setup_loader() | |
| INSTALLED_APPS += [ | |
| "djcelery", | |
| "seacucumber", | |
| ] | |
| BROKER_HOST = "localhost" |
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.core.mail import EmailMultiAlternatives | |
| from django.utils.html import strip_tags | |
| from mezzanine.conf import settings | |
| subject, from_email, to, bcc = email_subject, settings.DEFAULT_FROM_EMAIL, user_email, manager_email | |
| text_content = strip_tags(email_template) | |
| html_content = email_template | |
| msg = EmailMultiAlternatives(subject, text_content, from_email, [to], bcc) |
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
| DEBUG = True | |
| TEMPLATE_DEBUG = True | |
| COMPRESS_ENABLED = True | |
| TEMPLATE_USE_CDN = False | |
| DATABASES = { | |
| "default": { | |
| "ENGINE": "django.db.backends.sqlite3", | |
| "NAME": "dev.db" | |
| } |
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.contrib import admin | |
| from mezzanine.conf import settings | |
| from mezzanine.core.admin import TabularDynamicInlineAdmin | |
| if "mezzanine.pages" in settings.INSTALLED_APPS: | |
| from mezzanine.pages.models import RichTextPage, Link | |
| from mezzanine.pages.admin import PageAdmin, LinkAdmin | |
| from models import TransRichTextPage, TransLinkPage | |
| # |
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
| def Wanted(Game_Programmers, Web_Programmers, Mobile_Programmers, Designers): | |
| Game_Programmers = { | |
| "Platform": iOS, | |
| "Language": Objective-C / C++, | |
| "Game Environment": 2D or 3D, | |
| "Extra": { | |
| "Unity": True, | |
| "JSON": True, | |
| "POSITION": Senior | |
| } |