jQuery.Deferred implements CommonJS Promises/A
It's a chainable utility object that can register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
import processing.core.*; | |
import processing.xml.*; | |
import java.applet.*; | |
import java.awt.Dimension; | |
import java.awt.Frame; | |
import java.awt.event.MouseEvent; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.FocusEvent; | |
import java.awt.Image; |
## Append to bottom of your httpd.conf (or wherever you want to put it) | |
WSGIScriptAlias / /Users/username/Dev/mdid3/django_virtualenv.wsgi | |
## Server setup | |
alias /static/admin/ /Users/username/mdid3/django/contrib/admin/media/ | |
alias /static/ /Users/username/mdid3/rooibos/static/ |
/* problem: when ZURB's Joyride tour ends, if the user causes it to run again, the | |
'count' seems to be messed up | |
solution: the plugin creates divs with ids in the pattern: 'joyRidePopup' + index | |
and then iterates through them - running the iteration again recreates the divs & | |
re-runs and gets confused. So you use postRideCallback (one of the options, see | |
http://www.zurb.com/playground/jquery-joyride-feature-tour-plugin - step 5 for more info) | |
to remove those divs when the ride ends | |
this GIST shows how to bind joyride to a 'HELP' button that will trigger the tour when clicked. |
__author__ = 'hanleybrand' | |
# thank you http://www.doughellmann.com/PyMOTW/json/ | |
# http://www.voidspace.org.uk/python/articles/cookielib.shtml | |
import os | |
import json | |
import urllib, urllib2, cookielib | |
import tempfile | |
cj = cookielib.LWPCookieJar() | |
COOKIEFILE = 'cookies.lwp' |
{%for u in users%} | |
{{u}} - {{u.last_login}}<br /> | |
{% endfor %} |
class Record(models.Model): | |
created = models.DateTimeField(auto_now_add=True) | |
modified = models.DateTimeField(auto_now=True) | |
name = models.SlugField(max_length=50, unique=True) | |
parent = models.ForeignKey('self', null=True, blank=True) | |
source = models.CharField(max_length=1024, null=True, blank=True) | |
manager = models.CharField(max_length=50, null=True, blank=True) | |
next_update = models.DateTimeField(null=True, blank=True) | |
owner = models.ForeignKey(User, null=True, blank=True) |
from django.contrib.auth.models import User | |
# assumes an already logged in user, | |
# with their username captured in a variable | |
target_user = chooser(raw_input("enter the username that will own the slideshow being created. Press Enter for %s " % username), username) | |
def chooser(anotherUser, me, inception = 0): | |
""" Given raw input and an already authenticated user, returns a valid user name |
#!/usr/bin/python | |
import urllib | |
import urllib2 | |
import time | |
import hashlib | |
import hmac | |
# I was fixing iTunesU.py as per | |
# http://www.maclearning.org/articles/40/fixing-apple-s-i-tunes-u-python-s | |
# and I decided to try to make it a tiny bit more pythonic, as in |
# rooibos/storage/views.py | |
### | |
# a request for /media/thumb/{media.pk}/{record.id}/ | |
# handled by url(r'^thumb/(?P<id>\d+)/(?P<name>[-\w]+)/$', record_thumbnail, name='storage-thumbnail'), | |
# record_thumbnail and its decorator below | |
# it calls get_thumbnail_for_record from rooibos/storage/__init__.py | |
def add_content_length(func): | |
def _add_header(request, *args, **kwargs): | |
response = func(request, *args, **kwargs) |