This file contains 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 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) |
This file contains 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
+(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; | |
This file contains 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
# 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 |
This file contains 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
<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 %} |
This file contains 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
// 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", |
This file contains 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
# 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) |
This file contains 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
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): |
NewerOlder