Skip to content

Instantly share code, notes, and snippets.

View melinath's full-sized avatar

Stephen Lewis (Burrows) melinath

View GitHub Profile
@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
mysql.host: 'localhost'
mysql.port: 3306
mysql.user: 'mysql'
mysql.pass: ''
mysql.db: 'mysql'
mysql.unix_socket: '/opt/mysql/mysql.sock'
mysql.charset: 'utf8'
@melinath
melinath / dashboard_spec.md
Last active August 29, 2015 14:13
View spec example

These are example view specs for brambling's UserDashboardView and InviteAcceptView.

User dashboard

template: brambling/dashboard.html

Context

  • upcoming_events: A list of public Events that haven't started yet, ordered by how soon they start
  • upcoming_events_interest: A list of public Events in the user's interest groups that haven't started yet, ordered by how soon they start
  • admin_events: A list of Events that the user can edit, ordered by how recently they were edited
  • registered_events: A list of upcoming Events that the user has bought (or started buying) a ticket for, ordered by when the event will start
@melinath
melinath / armstrong-requirements.git
Created July 31, 2014 18:09
Armstrong dev requirements
-e git+git://github.com/armstrong/armstrong.cli.git#egg=armstrong.cli
-e git+git://github.com/armstrong/armstrong.core.arm_access.git#egg=armstrong.core.arm_access
-e git+git://github.com/armstrong/armstrong.core.arm_content.git#egg=armstrong.core.arm_content
-e git+git://github.com/armstrong/armstrong.core.arm_layout.git#egg=armstrong.core.arm_layout
-e git+git://github.com/armstrong/armstrong.core.arm_sections.git#egg=armstrong.core.arm_sections
-e git+git://github.com/armstrong/armstrong.core.arm_wells.git#egg=armstrong.core.arm_wells
-e git+git://github.com/armstrong/armstrong.apps.articles.git#egg=armstrong.apps.articles
-e git+git://github.com/armstrong/armstrong.apps.content.git#egg=armstrong.apps.content
-e git+git://github.com/armstrong/armstrong.apps.images.git#egg=armstrong.apps.images
-e git+git://github.com/armstrong/armstrong.apps.related_content.git#egg=armstrong.apps.related_content
@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',)
...