- Thou shalt make diffs meaningful
- Thou shalt meaningfully order merged commits
- Thou shalt not include superfluous merge commits
- Thou shalt make meaningful, well formatted commit messages
- Thou shalt only branch off of the canonical branch
- Thou shalt run tests before merging or issuing a pull request
- Thou shalt add tests for new code before merging or issuing a pull request
- Thou shalt not hard code settings, URL schemes, or app-domains
- Thou shalt follow a consistent project coding style
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 MyListView(ListView): | |
def get(self, request, *args, **kwargs): | |
self.object_list = self.get_queryset() | |
search_query = request.GET.get('search_query') | |
if search_query: | |
self.object_list = self.object_list.filter(name=search_query) | |
context = self.get_context_data(object_list=self.object_list) | |
return self.render_to_response(context) |
- Vagrantfile - primary configuration
- vagrantconfig.yaml - default configuration
- vagrantconfig_local.yaml - local configuration, this file never gets checked into source control
The primary Vagrantfile is set up to use Ubuntu 12.04 LTS (Precise) and Puppet configuration has been commented out.
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 re | |
import simplejson | |
from django.http import HttpResponse | |
from django.conf import settings | |
class JSONResponse(HttpResponse): | |
def __init__(self, request, data): | |
indent = 2 if settings.DEBUG else None |
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 csv | |
import requests | |
from bs4 import BeautifulSoup | |
def is_generator(tag): | |
return True if tag.attrs.get('name', '') == 'generator' else False | |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
import requests | |
from bs4 import BeautifulSoup | |
url = "http://www.wellfireinteractive.com" |
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 csv | |
from operator import attrgetter | |
def generic_csv(csvfile, objects, fields): | |
writer = csv.writer(csvfile, quoting=csv.QUOTE_ALL) | |
row_headers = fields.keys() | |
writer.writerow(row_headers) | |
for obj in objects: |
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 | |
from django.contrib.contenttypes.models import ContentType | |
class BookmarkManager(models.Manager): | |
def _lookup_kwargs(self, **kwargs): | |
owner = kwargs.pop('owner', None) | |
if owner: | |
owner_type = ContentType.objects.get_for_model(owner) |
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
--- | |
# ^^^ YAML documents must begin with the document separator "---" | |
# | |
#### Example docblock, I like to put a descriptive comment at the top of my | |
#### playbooks. | |
# | |
# Overview: Playbook to bootstrap a new host for configuration management. | |
# Applies to: production | |
# Description: | |
# Ensures that a host is configured for management with Ansible. |
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
for SHAPEFILE in $(find . -name "*.shp") | |
do | |
BASENAME=$(basename $SHAPEFILE .shp) | |
DIRNAME=$(dirname $SHAPEFILE) | |
SQLFILE="${BASENAME}.sql" | |
shp2pgsql -W UTF-8 $SHAPEFILE $BASENAME > "${DIRNAME}/${BASENAME}.sql" | |
psql -d richmond -f "${DIRNAME}/${BASENAME}.sql" | |
done |