Skip to content

Instantly share code, notes, and snippets.

View btilly's full-sized avatar

Ben Tilly btilly

View GitHub Profile
#! /usr/bin/env python
import heapq
def gcd (m, n):
while 0 < n:
(m, n) = (n, m % n)
return m
def pythagorean_triples ():
@btilly
btilly / enum-to-foreign-key-bug.pl
Created August 18, 2011 21:35
If you load the dest schema into mysql, the upgrade SQL presented does not work. If task_role does not exist first, the problem goes away. Tested on MySQL Ver 5.0.51a-24+lenny5
#! /usr/bin/perl
use strict;
use warnings;
use SQL::Translator;
use SQL::Translator::Diff;
use Data::Dumper;
$Data::Dumper::Indent = 1;
my $dest_schema = get_schema(q{
#! /usr/bin/perl
use strict;
use warnings;
use SQL::Translator;
use SQL::Translator::Diff;
use Data::Dumper;
$Data::Dumper::Indent = 1;
my $dest_schema = get_schema(q{