Skip to content

Instantly share code, notes, and snippets.

View banterability's full-sized avatar

Jeff Long banterability

View GitHub Profile

Keybase proof

I hereby claim:

  • I am banterability on github.
  • I am banterability (https://keybase.io/banterability) on keybase.
  • I have a public key whose fingerprint is E5D9 0808 D4C9 EAD6 6749 DADD 1E96 B62F D7C6 52F4

To claim this, I am signing this object:

@banterability
banterability / gist:0ac52fdde9deb9c41282
Last active August 29, 2015 14:13
A terrible js loop to run in console to delete all your tweets
// Run from twitter.com/<yourusername>
// this will (duh) delete all your tweets. don't be dumb.
var deleteLoop;
deleteLoop = setInterval(function(){
var deleteButton = $('.js-actionDelete button');
if(deleteButton.length < 1){
clearInterval(deleteLoop);
alert('No more things to delete');
} else {
deleteButton[0].click();
<select name='day'>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
from fabric.api import *
[...]
def gzip_assets():
"""
GZips every file in the assets directory and places the new file
in the gzip directory with the same filename.
"""
local('python gzip_assets.py')
@banterability
banterability / bookmarklet.js
Created April 27, 2010 22:25
Bookmarklet to switch between production & development environments
javascript:var%20h=location.href,a="www.scpr.org",b="localhost:8000";function%20s(){if(h.search(a)!=-1)z();else%20if(h.search(b)!=-1)y();else%20return%20false}function%20x(c){location.href=c}function%20y(){x(h.replace(b,a))}function%20z(){x(h.replace(a,b))}s();
@banterability
banterability / nginx.sh
Created May 14, 2010 00:19
Init script for Nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@banterability
banterability / derive_username.py
Created May 15, 2010 00:03
Derive next available username
# from simonw's code to djangopeople.net
import re
notalpha_re = re.compile('[^a-zA-Z0-9]')
def derive_username(nickname):
nickname = notalpha_re.sub('', nickname)
if not nickname:
return ''
base_nickname = nickname
to_add = 1
@banterability
banterability / snippet.css
Created May 18, 2010 23:33
custom text selection colors
/*
dribbble custom selection css
from http://dribbble.com/stylesheets/master.css
*/
/* custom selection colors */
::-moz-selection {
color: #fff;
color: rgba(255,255,255,.85);
@banterability
banterability / snippet.html
Created May 21, 2010 21:04
html5 with a fallback for mp3-hating firefox with a fallback to flash with a fallback to a link
<div class="html5audio">
<div id="no-ogg" style="display:none;">
<div id="flash-player">
<a href="foo.mp3">Download Audio</a>
</div>
</div>
<audio controls>
<source src="foo.mp3" type="audio/mpeg" />
<div id="flash-player">
<a href="foo.mp3">Download Audio</a>
@banterability
banterability / moneyfnt.py
Created May 24, 2010 18:52
convert decimal to formatted currency string
# from python docs (http://docs.python.org/library/decimal.html)
def moneyfmt(value, places=2, curr='', sep=',', dp='.',
pos='', neg='-', trailneg=''):
"""Convert Decimal to a money formatted string.
places: required number of places after the decimal point
curr: optional currency symbol before the sign (may be blank)
sep: optional grouping separator (comma, period, space, or blank)
dp: decimal point indicator (comma or period)