This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<style> | |
html, body { height: 100%; } | |
body { font-size: 4em; color: rgba(0,0,0,0.1); } | |
body.noscroll { | |
overflow: hidden; | |
} |
This file contains hidden or 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 Object: | |
attributes = ["myattr", | |
"anotherattr", | |
"attr1", | |
"someattr", | |
"attr5"] | |
code = "def __init__(self" | |
for att in attributes: | |
code = code + ", " + att + " = None" | |
code = code + "):\n" |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from lxml.html import fromstring | |
import os | |
import csv | |
import requests | |
def _get_payload_for_code(code): | |
parameters = { | |
"i_%s_3" % code: "on", | |
"visaAG": "on", |
This file contains hidden or 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 hashlib | |
from random import random | |
from multiprocessing import Process, Array | |
from ctypes import c_char | |
CPU_CORES = 4 | |
def new_candidate(prev_hash, seed): | |
return prev_hash[:32] + seed |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from django.core.management.base import BaseCommand | |
from django.contrib.auth.models import User | |
from emailuser.models import UserProfile | |
from socialdata.models import SocialData | |
class Command(BaseCommand): | |
def _has_relations(self, related_objects, user, whitelist=(User, UserProfile, SocialData)): | |
for related in related_objects: | |
model = related.model |
This file contains hidden or 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 KeyToNumMapper(object): | |
counter = 0 | |
mapper_key_int = {} | |
mapper_int_key = {} | |
def __init__(self, initial): | |
map(self.add_key, initial) | |
def add_key(self, key): | |
if key in self.mapper_key_int: |
This file contains hidden or 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 atexit | |
import subprocess | |
from django.core.management.commands.runserver import BaseRunserverCommand | |
from django.core.servers.basehttp import AdminMediaHandler | |
from django.conf import settings | |
# Patch runserver to run the sass and coffeesscript compilers automatically | |
class Command(BaseRunserverCommand): | |
active_processes = [] |
This file contains hidden or 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
# Example usage... | |
from admin_util import ImprovedModelForm | |
class DialogAdmin(ImprovedModelForm): | |
raw_id_fields = ("forum", "user", ...) # "forum" and "user" are ForeignKeys | |
... |
NewerOlder