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 django.db import models | |
DJANGO_FIELDS = ( | |
(str(field).upper(), field) | |
for field in dir(models) if field.endswith('Field') | |
) |
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
window.pyfuncs = pyfuncs || {}; | |
pyfuncs.string.ascii_lowercase = function() { | |
return 'abcdefghijklmnopqrstuvwxyz'; | |
}; | |
pyfuncs.string.ascii_uppercase = function() { | |
return pyfuncs.string.ascii_lowercase().toUpperCase(); | |
}; |
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
class Db(): | |
def __init__(self): | |
self.foo = 'FOO' | |
def save(self, msg, *args, **kwargs): | |
print 'Saving... {}'.format(msg) | |
class RemoteTransport(): | |
def __init__(self): |
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 string import ascii_lowercase | |
from random import choice | |
def long_word(max): | |
return ''.join([choice(ascii_lowercase + ' ') for _ in xrange(max)]) |
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
1 1 36 1 0 | |
2 69 36 33 1 | |
3 4761 36 9 0 | |
4 328509 36 9 1 | |
5 22667121 36 9 1 | |
6 1564031349 36 9 3 | |
7 107918163081 36 9 1 | |
8 7446353252589 36 9 5 | |
9 513798374428641 36 9 0 | |
10 35452087835576229 36 9 9 |
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 random import choice | |
from pprint import pprint as ppr | |
def rule(n, choices): | |
pattern = '' | |
for x in range(n): | |
pattern += choice(choices) | |
return pattern |
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
// Shim for Raphael | |
Raphael = (typeof module !== 'undefined' && module.exports) ? require('node-raphael') : Raphael; | |
//...lib stuff |
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
import itertools | |
def is_odd_exp(n): | |
print n, 'exp mod 2 =', n ** n % 2 | |
if n ** n % 2 == 0: | |
return False | |
return True | |
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
function PI() { | |
echo 'Fuck PHP'; | |
echo 'Also, use radians for chrissake'; | |
} |
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
class Database(object): | |
def __init__(self): | |
self.data = {} | |
def insert(self, key, val): | |
print 'Making db insertion....' | |
self.data[key] = val |