Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
| from django.utils.html import escape | |
| from django.contrib.comments.models import Comment | |
| from django.utils.encoding import smart_str | |
| post = u'' | |
| for i in Comment.objects.order_by('submit_date'): | |
| if not i.content_object: | |
| continue | |
| post += u""" |
| #!/usr/bin/env python | |
| # Python script to make Skype co-operate with GNOME3 notifications. | |
| # | |
| # | |
| # Copyright (c) 2011, John Stowers | |
| # | |
| # Adapted from skype-notify.py | |
| # Copyright (c) 2009, Lightbreeze | |
| # | |
| # |
Some exercises from the Falsy Values workshops.
The good parts:
| from django.core.exceptions import ImproperlyConfigured | |
| from django.core.management.base import BaseCommand, CommandError | |
| from django.core import serializers | |
| from django.utils.datastructures import SortedDict | |
| from optparse import make_option | |
| class Command(BaseCommand): | |
| option_list = BaseCommand.option_list + ( | |
| make_option('--format', default='json', dest='format', |
| >>> import pstats | |
| >>> p = pstats.Stats('p.1258156459.52174278XcQE.prof') | |
| >>> p.strip_dirs().sort_stats(-1).print_stats(5) | |
| Fri Nov 13 15:54:20 2009 p.1258156459.52174278XcQE.prof | |
| 124278 function calls (122386 primitive calls) in 0.589 CPU seconds | |
| Ordered by: standard name | |
| List reduced from 1014 to 5 due to restriction <5> |