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 | |
| import gc | |
| from sys import modules | |
| import inspect | |
| from optparse import make_option | |
| import weakref | |
| from django.core.management.base import BaseCommand | |
| from django.dispatch import Signal, saferef |
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 celery import Celery | |
| from celery import chord | |
| a = Celery() | |
| a.conf.update ( | |
| CELERY_BROKER_URL = 'amqp://', | |
| CELERY_RESULT_BACKEND = 'amqp', | |
| CELERY_TASK_SERIALIZER = 'json', | |
| CELERY_ACCEPT_CONTENT = ['json'], |
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 datetime import timedelta | |
| from celery import Celery | |
| from celery.task import periodic_task | |
| app = Celery('tasks', backend='amqp', | |
| broker='amqp://guest@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
| In [1]: from django import forms | |
| In [2]: class SampleForm(forms.Form): | |
| ...: name = forms.CharField(max_length=10, initial='avil page') | |
| ...: | |
| In [3]: f = SampleForm() | |
| In [4]: f.as_p() | |
| Out[4]: u'<p>Name: <input maxlength="10" name="name" type="text" value="avil page" /></p>' |
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
| sudo aptitude install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libpulse-dev libxt-dev |
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 [118]: alpha | |
| Out[118]: ['a', 'b', 'c', 'd', 'e', 'f'] | |
| In [119]: alpha[20] | |
| --------------------------------------------------------------------------- | |
| IndexError Traceback (most recent call last) | |
| <ipython-input-119-c5b145def39d> in <module>() | |
| ----> 1 alpha[20] | |
| IndexError: list index out of range |
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 [1]: 1 + 2 | |
| Out[1]: 3 | |
| In [2]: 2 + 3 | |
| Out[2]: 5 | |
| In [3]: _ + 1 | |
| Out[3]: 6 | |
| In [4]: _ |
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.db import models | |
| class SimpleModel(models.Model): | |
| name = models.CharField(max_length=100) |
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
| {% block js %} | |
| <script> | |
| (function(){ | |
| $( '.filter' ).parent().append(glyphicon); | |
| $( '#filter-data' ).click(function() { | |
| $( "#sidebar" ).toggle( "blind", {direction: 'left'} ); |
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
| (defcustom python-autopep8-path (executable-find "autopep8") | |
| "autopep8 executable path." | |
| :group 'python | |
| :type 'string) | |
| (defun python-autopep8 () | |
| "Automatically formats Python code to conform to the PEP 8 style guide. | |
| $ autopep8 --in-place --aggressive --aggressive <filename>" | |
| (interactive) | |
| (when (eq major-mode 'python-mode) |