Skip to content

Instantly share code, notes, and snippets.

View benspaulding's full-sized avatar

Ben Spaulding benspaulding

View GitHub Profile
@benspaulding
benspaulding / keybase.md
Created April 9, 2015 14:28
keybase.md

Keybase proof

I hereby claim:

  • I am benspaulding on github.
  • I am benspaulding (https://keybase.io/benspaulding) on keybase.
  • I have a public key whose fingerprint is 20B3 BFB1 AD12 033F 0774 85F5 970F 8167 377B 92A4

To claim this, I am signing this object:

@benspaulding
benspaulding / settings.py
Created March 18, 2015 17:12
Skip migrations during Django tests
INSTALLED_APPS = (
# ...
)
# Skip migrations for tests
MIGRATION_MODULES = {
# Assumes that all values in INSTALLED_APPS are simply a package containing
# an application, not an application configuration class.
app.split('.').pop(): '{0}.migrations_not_used_in_tests'.format(app) for app in INSTALLED_APPS
}
@benspaulding
benspaulding / gist:29a900c7c7b4f89ccf6d
Last active October 21, 2016 21:39
Delete git-flow type branches that were not automatically deleted
git checkout master
git pull
git branch --all --merged master | ack hotfix/ | xargs git branch -d
git checkout dev
git pull
git branch --all --merged dev | ack feature/ | xargs git branch -d
git branch --all --merged origin/master | ack origin/hotfix/ | sed -e 's: remotes\/origin\/::' | xargs git push --delete origingit branch --all --merged origin/master | ack origin/hotfix/ | sed -e 's: remotes\/origin\/::' | xargs git push --delete origin
git branch --all --merged origin/dev | ack origin/feature/ | sed -e 's: remotes\/origin\/::' | xargs git push --delete origin
@benspaulding
benspaulding / analyze-repo
Last active August 29, 2015 14:14
Quick-and-dirty script to get some data about a repo
#!/usr/bin/env python
"""
Usage::
pip install gitpython
cd <repo>
analyze-repo
"""
from __future__ import absolute_import, division, print_function, unicode_literals

Test

This is only a test.

# Set internal IPs if necessary, for use with debug toolbar.
try:
INTERNAL_IPS
except NameError:
INTERNAL_IPS = []
INTERNAL_IPS = list(INTERNAL_IPS) + ['127.0.0.1']
# Install and setup debug toolbar if it is available.
@benspaulding
benspaulding / gist:5234642
Created March 25, 2013 03:04
Error when `django.middleware.locale.LocaleMiddleware` or `donottrack.middleware.DoNotTrackMiddleware` come after `django.middleware.cache.UpdateCacheMiddleware`.
Environment:
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.5
Python Version: 3.3.0
Installed Applications:
('foo',)
@benspaulding
benspaulding / gist:4771655
Last active December 12, 2015 12:19
My vcprompt setup.
# First, install vcprompt.
brew update
brew tap homebrew/headonly
brew install --HEAD vcprompt
@benspaulding
benspaulding / search_indexes.diff
Created July 19, 2012 05:15
Possible fix to get django-faq working with Haystack 1.X-2.0
diff --git a/faq/search_indexes.py b/faq/search_indexes.py
index 1515984..8032937 100644
--- a/faq/search_indexes.py
+++ b/faq/search_indexes.py
@@ -1,29 +1,59 @@
# -*- coding: utf-8 -*-
from haystack import indexes
-from haystack.sites import site
@benspaulding
benspaulding / sample.py
Created February 3, 2012 19:42
itty + wsgiref error?
itty starting up (using wsgiref)...
Listening on http://localhost:8080...
Use Ctrl-C to quit.
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/Users/benspaulding/dev/virtualenv/sample/lib/python2.7/site-packages/itty.py", line 286, in handle_request
return response.send(start_response)
File "/Users/benspaulding/dev/virtualenv/sample/lib/python2.7/site-packages/itty.py", line 253, in send