Skip to content

Instantly share code, notes, and snippets.

View pmclanahan's full-sized avatar

Paul McLanahan pmclanahan

View GitHub Profile
@pmclanahan
pmclanahan / gist:5035134
Created February 26, 2013 01:53
postactivate hook for virtualenvwrapper to add a project's `bin` directory to the path while the venv is active.
get_project_dir () {
virtualenvwrapper_verify_workon_home || return 1
virtualenvwrapper_verify_active_environment || return 1
if [ -f "$VIRTUAL_ENV/.project" ]
then
project_dir=$(cat "$VIRTUAL_ENV/.project")
if [ ! -z "$project_dir" ]
then
# will be cleaned up by virtualenvwrapper
export PATH="${project_dir}/bin/:$PATH"
@pmclanahan
pmclanahan / onename.txt
Created November 10, 2015 00:26
onename.com verification
Verifying that +pmac is my blockchain ID. https://onename.com/pmac
@pmclanahan
pmclanahan / views.py
Created October 22, 2015 17:00
A view that redirects based on waffle, keeping query params.
from django.http import HttpResponseRedirect
from django.utils.encoding import force_text
import waffle
from bedrock.base.urlresolvers import reverse
from lib.l10n_utils import render
def choose_view(request):
@pmclanahan
pmclanahan / znc_notify.sh
Created November 14, 2012 00:46
ZNC Notification via Twitter
#!/bin/bash
znc_twitter_notify.py $@
@pmclanahan
pmclanahan / urls.py
Created September 28, 2012 22:17
redirects.urls.py
from django.conf.urls.defaults import *
from util import redirect
urlpatterns = patterns('',
redirect(r'^b2g', 'firefoxos'),
)
{"bugzilla_url":"https://bugzilla.mozilla.org/show_bug.cgi?id=719170%2C257398%2C288329%2C333418%2C352047%2C363711%2C384806%2C401399%2C425764%2C433509%2C433617%2C434182%2C435894%2C452659%2C459291%2C467717%2C467912%2C473886%2C474390%2C475817%2C484672%2C507315%2C514793%2C537305%2C547766%2C559543%2C562256%2C566315%2C585709%2C601858%2C610150%2C611028%2C619904%2C628958%2C634848%2C634999%2C658354%2C658871%2C663678%2C670512%2C673821%2C691766%2C692844%2C692850%2C692853%2C693285%2C697655%2C699545%2C703817%2C724518%2C724835%2C736851%2C737302%2C738026%2C749644%2C755285%2C767325%2C780216%2C780677%2C780740%2C781003%2C782951%2C783884%2C784206%2C785195%2C778504%2C771006%2C777361%2C612926%2C767724%2C750848%2C202522%2C247591%2C700259%2C726982%2C742123%2C749313%2C547448%2C340697%2C344912%2C374463%2C409848%2C454967%2C487089%2C507885%2C672807%2C733799%2C783446%2C676122%2C698427%2C781551%2C785212%2C785214%2C785216%2C785218%2C697714%2C741661%2C426183%2C698069%2C665084%2C679405%2C718522%2C429286%2C343653%2C702702%2C629932%2C7864%2C1
@pmclanahan
pmclanahan / gist:3277709
Created August 6, 2012 19:18
Bug 780545 - Remove special redirects from bug 767985.
Index: includes/prefetch.php
===================================================================
--- includes/prefetch.php (revision 108075)
+++ includes/prefetch.php (working copy)
@@ -198,15 +198,8 @@
if($parsed_path == '/firefox') {
// Redirect mobile devices (Android, Maemo, iPhone)
$is_mobile_redirected = mobile_redirect('/mobile/', 'iphone|ipad');
- // Bug 767985 - Special redirects for Firefox Native Android launch
- if($is_mobile_redirected) {
@pmclanahan
pmclanahan / example_template.html
Created May 16, 2011 22:16
Django tag for ICanHaz.js templates
{# ICanHaz templates #}
{% icanhaz %}
{# inside here all occurrences of "[[" will become "{{" and "]]" will be "}}" #}
<script type="text/html" id="contributor_row">
<select name=role_for_[[ id ]]">
{% for role in roles %}
<option value="{{ role.id }}">{{ role.name }}</option>
The answer to the Ultimate
Question is {{ everything.universe.answer }}.
Among our weapons are:{% for weapon in weapons %}
{{ weapon }}{% endfor %}
# Prevent pip from doing anything unless you're inside an activated virtualenv.
PIP=/usr/local/bin/pip
function pip {
if [ "x$VIRTUAL_ENV" = 'x' ]; then
echo "No virtualenv activated; bailing."
else
$PIP -E `basename $VIRTUAL_ENV` "$@"
fi
}