Skip to content

Instantly share code, notes, and snippets.

View alanhamlett's full-sized avatar

Alan Hamlett alanhamlett

View GitHub Profile
@codeb2cc
codeb2cc / gist:3302754
Created August 9, 2012 09:48
Sqlalchemy get_or_create implement
# -*- coding: utf-8 -*-
from sqlalchemy.exc import IntegrityError
from sqlalchemy.sql.expression import ClauseElement
def _get_or_create(session, model, defaults=None, **kwargs):
try:
query = session.query(model).filter_by(**kwargs)
instance = query.first()
Experiments in revision control: Curry recipe.
My personal recipe for Japanese curry, which has mutated over the years and is
now open-source thanks to github, hot damn. Some of the ingredients are not
very Japanese, but curry came to Japan from England which got it from India to
begin with, so whatever.
1.5 - 2 lbs. of meat, prefer thin-sliced beef (komagire), pork works, too.
Thin-sliced stuff is always best, but in a pinch stewing beef works. Bacon
works surprisingly well. Chicken will work, technically, but if you must,