Skip to content

Instantly share code, notes, and snippets.

View melinath's full-sized avatar

Stephen Lewis (Burrows) melinath

View GitHub Profile
@melinath
melinath / autocompile.py
Created June 1, 2011 20:37
Class-based reloading
#!/usr/bin/env python
import subprocess
import sys
from reloader.reloaders import FileChangeReloader
def auto_compile(path, filetypes, cmd):
filetypes = filetypes.split(',')
@melinath
melinath / MigrationTest.py
Last active April 6, 2022 04:37
Testing migrations
from django.apps import apps
from django.core.management import call_command
from django.db.models.signals import pre_migrate, post_migrate
from django.test import TransactionTestCase
# See https://www.caktusgroup.com/blog/2016/02/02/writing-unit-tests-django-migrations/
# for the original code.
class MigrationTest(TransactionTestCase):
@property
--[[
Usage:
When running wesnoth, type:
:lua shell()
This will open the shell. Type any lua code you like in the shell. Variables will be stored in a shell-specific environment. The shell defines some additional functions:
clear() :: clears the output area.
close() :: closes the shell.
@melinath
melinath / gist:7933196
Last active December 31, 2015 04:19
Safety Dance Comment Policy
We believe that the highest priority for a dance community must be honoring the needs of its members for safety, respect, and empowerment, both physical and mental. Doing so requires taking into account the influence of race, class, gender, (dis)ability, age, and sexual orientation, as well as social capital, based on position in the community and/or technical skill.
This is a space for having conversations, sharing resources and ideas, and supporting/challenging each other as we do this necessary work in our communities.
Here are a few basic rules for this space:
* Sexist, homophobic, transphobic, racist, ableist, and other hateful language will not be tolerated.
* This is not a space for debating the validity of others’ experiences, especially in cases of harassment or assault.
* It’s not okay to tell someone else how they should feel.
@melinath
melinath / scrape_xkcd.py
Created September 19, 2012 14:38
Scraping xkcd's click & drag bit by bit.
import json
import os
import time
import requests
ROOT_DIR = "/Users/melinath/Pictures/xkcd"
MAX_QUADRANT_SIZE = 100
NOT_FOUND_PATH = os.path.join(ROOT_DIR, 'not_found.json')
if os.path.exists(NOT_FOUND_PATH):
@melinath
melinath / models.py
Created March 12, 2012 18:32
Templating test
from django.db import models
class Bar(models.Model):
name = models.CharField(max_length=30)
class Foo(models.Model):
name = models.CharField(max_length=200)
date = models.DateTimeField()
1
0
0
0
0
0
0
0
2
11
@melinath
melinath / additional_settings.py
Created February 6, 2012 21:24
Deployment changes
...
CELERY_IMPORTS = ('mainsite_project.celeryd_setup',)
...
# Copyright 2009 - Participatory Culture Foundation
#
# This file is part of Miro Community.
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# Miro Community is distributed in the hope that it will be useful,