This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| """ file mytest.py """ | |
| # you require to return a HttpResponse instance in your view | |
| from django.http import HttpResponse | |
| # handler* are required for the urlresolver | |
| from django.conf.urls.defaults import patterns, handler404, handler500 | |
| # minimal settings | |
| DEBUG = True | |
| # tell django to use this file to find urlpatterns. see below | |
| ROOT_URLCONF = "mytest" |
| """ | |
| Fabric tunneling utilities | |
| by shn@glucose.jp | |
| class ForwardServer and relates things are refere Robey Pointer's paramiko example. | |
| (http://bazaar.launchpad.net/~robey/paramiko/trunk/annotate/head%3A/demos/forward.py) | |
| usage:: | |
| with make_tunnel('[email protected]:10022') as t: |
| (function($) { | |
| window.FlashMessages = { | |
| init: function() { | |
| this.container = $("#flash-messages") | |
| .find("a.message-close") | |
| .fadeIn("slow") | |
| .live("click", function() { | |
| $(this).parent() | |
| .fadeOut("slow", function() { | |
| $(this).remove(); |
| # | |
| # Advanced Django 1.3.x+ Logging | |
| # | |
| # Author: | |
| # Jason Giedymin < jasong _[_a-t_]_ apache d-o-t org > | |
| # | |
| # Description: | |
| # A Django 1.3.x+ settings.py snippet with Advanced logging formatters using RFC 2822, | |
| # TimedRotatingFileHandler, and a WatchedFileHandler. | |
| # |
| (function($){ | |
| ListFilterCollapsePrototype = { | |
| bindToggle: function(){ | |
| var that = this; | |
| this.$filterTitle.click(function(){ | |
| that.$filterContent.slideToggle(); | |
| that.$list.toggleClass('filtered'); | |
| }); | |
| }, | |
| init: function(filterEl) { |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| from multiprocessing import Process | |
| from django.core import serializers | |
| from django.core.management import call_command | |
| from StringIO import StringIO | |
| def dump_database(): | |
| sio = StringIO() | |
| call_command('dumpdata', stdout=sio, natural=True) | |
| return sio.getvalue() |
| from gi.repository import Notify | |
| Notify.Notification.new('Incoming call', 'From %s' % number, 'phone-google-nexus-one').show() |
| LOGGING = { | |
| "version": 1, | |
| "disable_existing_loggers": True, | |
| "handlers": { | |
| "mail_admins": { | |
| "level": "ERROR", | |
| "class": "django.utils.log.AdminEmailHandler" | |
| }, | |
| }, | |
| "loggers": { |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| # -*- Mode: python; c-basic-offset: 4 -*- | |
| # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: | |
| '''Interactive Python Gir (Gtk3) Console | |
| @author: Jiahua Huang <[email protected]> | |
| @license: LGPLv3+ | |
| ''' |