Skip to content

Instantly share code, notes, and snippets.

import urllib2
from flask import Flask, redirect, request
from tbk.webpay.commerce import Commerce
from tbk.webpay.confirmation import Confirmation
from tbk.webpay.payment import Payment
app = Flask(__name__)
commerce = Commerce(testing=True)
server_ip = urllib2.urlopen('http://ip.42.pl/raw').read()
function get_short_commit {
git log -n 1 --format=oneline --abbrev-commit 2> /dev/null | sed -e 's/\([0-9a-f]*\)\(.*\)/\1/'
}
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1 $(get_short_commit)]$(parse_git_dirty)/"
}
@pedroburon
pedroburon / profile_picture_django_social_auth.py
Created June 26, 2012 21:53 — forked from kouroshshafi/profile_picture_django_social_auth
Extending User class to save profile picture in django-social-auth when registering
# This is models.py for a new user profile that you would like to create.
"""
this gist gets an id from django-social-auth and based on that saves the photo from social networks into your model. This is one of the best ways to extend User model because this way, you don't need to redefine a CustomUser as explained in the doc for django-social-auth. this is a new implementation based on https://gist.github.com/1248728
"""
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.db import models
@pedroburon
pedroburon / gist:1970087
Created March 4, 2012 02:18 — forked from alfredo/gist:1542184
Install node.js and coffee-script inside a python virtualenv
To install node.js and coffee-script inside a virtualenv and keep it self-contained:
1. Activate the virtualenv::
$ workon test
2. Move inside the virtualenv directory::
(test)$ cdvirtualenv