Skip to content

Instantly share code, notes, and snippets.

try:
import cPickle as pickle
except ImportError:
import pickle
from couchdb import client
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase
class SessionStore(SessionBase):
# Just a reminder to myself of how to write a decorator class for Django urls.
from functools import update_wrapper
from django.http import Http404
class IsGet(object):
def __call__(self, fn):
def decorate(request, *args, **kwargs):
return self.view_wrapper(request, fn, *args, **kwargs)
update_wrapper(self, fn)
// URL scheme: http://gist.github.com/*
// API endpoint: http://gist.github.com/services/oembed/
// Example call: http://gist.github.com/services/oembed/?url=http%3A//gist.github.com/54099
{
"version": "1.0",
"type": "rich",
"width": 400,
"height": 300,
"title": "oembed gist",
<div id="postbody">
<div style="float:left;padding-right:5px;">
<a href="{% url profiles.views.profile post.sender.username %}"><b>{{ post.sender }}</b></a>:
</div>
<div style="vertical-align:text-top;">
{{ post.text|oembed|urlize|fmt_post|safe }}
</div>
{% if post.image %}
<img src="{% thumbnail post.image 400x400 %}"/><br>
{% endif %}
# install virtualenv virtualenvwrapper into the global python path
easy_install virtualenv
easy_install virtualenvwrapper
# add these 2 lines to you bash_rc file
export WORKON_HOME=$HOME/.virtualenvs
source $HOME/bin/virtualenvwrapper_bashrc
mkdir $HOME/.virtualenvs
# create the pinax virtualenv
+(UIImage *)makeRoundCornerImage : (UIImage*) img : (int) cornerWidth : (int) cornerHeight
{
UIImage * newImage = nil;
if( nil != img)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int w = img.size.width;
int h = img.size.height;
from boto.s3 import Connection, Key
import sys
conn = Connection()
bucket = conn.get_bucket("skabber-public-images")
acl = bucket.get_acl()
k = Key(bucket)
k.key = sys.argv[1]
k.set_contents_from_filename(sys.argv[1])
k.set_acl(acl)
UIImage *im = [UIImage imageNamed:@"my-image-name.jpg"];
UIImageView *uiimv = [[UIImageView alloc] initWithImage:im];
[uiimv.layer setMasksToBounds:YES];
uiimv.layer.cornerRadius = 8;
[self.view addSubview:uiimv];
#!/Users/jgraves/environments/python/bin/python
import time
import sys
import Growl
try:
minutes = float(sys.argv[1])
except IndexError:
print "How many minutes?"
@skabber
skabber / gist:1166660
Created August 23, 2011 21:42 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job:
CTO of a Mobile development company
Favorite Python project:
Django
Favorite Conference:
WWDC
Python Experience Level: