Skip to content

Instantly share code, notes, and snippets.

View mitchellrj's full-sized avatar

Richard Mitchell mitchellrj

View GitHub Profile
@mitchellrj
mitchellrj / Dogeoverlay.js
Created December 9, 2013 16:27
Dogeoverlay
$(document).ready(function () {
"use strict";
var items = Array(
'such currency',
'wow',
'amaze',
'much coin',
'awesome',
'so crypto',
@mitchellrj
mitchellrj / django_bash_completion
Last active December 30, 2015 11:19
Bash & Zsh autocompletion for Django with extra options (based on Django 1.6)
# #########################################################################
# This bash script adds tab-completion feature to django-admin.py and
# manage.py.
#
# Testing it out without installing
# =================================
#
# To test out the completion without "installing" this, just run this file
# directly, like so:
#
@mitchellrj
mitchellrj / patches.py
Created December 4, 2013 17:56
Quick and dirty monkey-patch for Django issue #21554. https://code.djangoproject.com/ticket/21554
def patch_21554():
"""See https://code.djangoproject.com/ticket/21554 """
try:
from collections import UserDict
except ImportError:
from UserDict import UserDict
class OneToOneDict(UserDict):
def __init__(self, *args, **kwargs):
@mitchellrj
mitchellrj / ct_aux.js
Last active December 28, 2015 18:29
Beautified CarTrawler Accelerate API wrapper, revision 56251
/*
* Cartrawler AJAX Booking Engine
* http://www.cartrawler.com
*
* Copyright (c) 2006-2013 Cartrawler.com
* Version: 56251
* Date: 13-11-2013 - 12:54
*/
(function ($) {
namespace("CT.ABE.Utils.RentalCondition");
@mitchellrj
mitchellrj / interact.py
Last active December 18, 2015 17:08
Basic remote Python interpreter. Connects to a remote host and presents the Python interpreter.
"""
Basic remote Python interpreter
===============================
Connects to a remote host and presents the Python interpreter to it.
Example usage
-------------
On Machine A (the local host)::
@mitchellrj
mitchellrj / complexity.cfg
Last active December 10, 2015 23:28
Add a complexity analysis script to your buildout.
[buildout]
parts =
....
complexity
[complexity]
recipe = zc.recipe.egg
eggs = radon[tool]
scripts = radon=complexity
@mitchellrj
mitchellrj / configuration.py
Created September 14, 2012 13:20
Implementations of the TRACE and OPTIONS HTTP methods for Pyramid
config.add_route('options', '/*path', request_method='OPTIONS', view='.utility_views.OptionsView')
config.add_route('trace', '/*path', request_method='TRACE', view='.utility_views.TraceView')
@mitchellrj
mitchellrj / strip.py
Created September 4, 2012 15:23
Replace whitespace at the beginning of non-empty lines
import re
def strip_non_empty_lines(text):
return re.sub(r'^\s+(?=\S)', '', text)
@mitchellrj
mitchellrj / turing_test_widget.pt
Created August 31, 2012 15:26
deform widget for a turing test
<input type="hidden" name="__start__" value="${field.name}:mapping"/>
<div id="${field.oid}">
<p>Solve this problem:</p>
<p class="turing-challange">${challenge}</p>
<input type="hidden"
name="${field.oid}-challenge"
value="${challenge}"/>
<input type="text"
name="${field.oid}"/>
</div>
@mitchellrj
mitchellrj / loadtweetsfromjson.php
Created August 28, 2012 13:39 — forked from bryanveloso/loadtweetsfromjson.php
A horrible, simply horrible hack to getting TweetNest to read JSON. Copy this to the /maintenance/ folder of your TweetNest installation.
<?php
// TWEET NEST
// Load tweets (from JSON)
error_reporting(E_ALL ^ E_NOTICE); ini_set("display_errors", true); // For easy debugging, this is not a production page
@set_time_limit(0);
require_once "mpreheader.php";
$p = "";
// The below is not important, so errors surpressed