Skip to content

Instantly share code, notes, and snippets.

@sbp
sbp / degree-precisions.txt
Created August 15, 2011 12:54
Degree, minute, and second precisions
degrees
1 - 111.132km
0.1 - 11.1132km
0.01 - 1.11132km
0.001 - 111.132m
0.0001 - 11.1132m
0.00001 - 1.11132m
0.000001 - 11.1132cm
0.0000001 - 1.11132cm
@sbp
sbp / divide.js
Created August 14, 2011 22:52
jQuery to break a list into two table columns
$(function() {
$('ul.break').each(function() {
var ul = $(this);
var table = $('<table><tr></tr></table>');
table.addClass('spread');
var a = $('<td><ul></ul></td>');
var b = $('<td><ul></ul></td>');
$('tr', table).append(a);
$('tr', table).append(b);
@sbp
sbp / gaussian.py
Created August 1, 2011 20:10
Calculate and chart Gaussian integer divisor cardinality
#!/usr/bin/env python
import math
def complex_eps(c):
return complex(round(c.real, 6), round(c.imag, 6))
def floor(c):
real = math.floor(round(c.real, 6))
imag = math.floor(round(c.imag, 6))
@sbp
sbp / OpenSans.css
Created August 1, 2011 13:11
CSS for Open Sans
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 400;
src: local('Open Sans Italic'), local('Open-Sans-Italic'),
url('OpenSans-Italic.woff') format('woff'),
url('OpenSans-Italic.ttf') format('truetype');
}
@font-face {
@sbp
sbp / colloquial-summaries.txt
Created July 27, 2011 12:49 — forked from anonymous/colloquial-summaries.txt
Colloquial Web CG summaries
Submission:
The Colloquial Web group evaluates existing practices amongst core web
technologies such as HTML, CSS, and JavaScript. It aims to provide users and
vendors with clear guidelines for deployment and innovation for web
applications. Example problem domains include continued use of deprecated
constructs, the rise in external services for hosting solutions such as Google
Web Fonts or MathJax, and comparing attitudes to RDFa and microdata.
The group will not produce languages, but may for example create profiles of
@sbp
sbp / data.js
Created July 26, 2011 15:30
jQuery to add "Download" links to PRE and XMP elements
// Download Preformatted Sections
function makeDownloadable() {
// Iconza by Turbolink, Creative Commons BY 3.0 Unported
// http://www.softicons.com/free-icons/designers/turbomilk
var png = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABxVBMVEUAAACFhYaBgYGHh4iHiImLjI2Gh4eGhodbW1xqa2toaGlpampVVVdhYWJTU1RmZmf///+JiYmkpKR8fHysrKyYmJiHh4e2trZmZmaRkZGIiIiTk5OKiopQUVKDhIZ+fn7ExMTGxsbMzMxhYWFkZGSCgoSGhoaurq5oaGhsbGxubm7JycmAgIJPT1CFhojq6uq+vr6cnJzh4eG1tbWUlJS8vLzn5+eenp69vb1nZ2dlZWXT09Ozs7PAwMCoqKrR0dHPz8/Ozs7i4uLCwsLBwcHZ2dnU1NS3t7eqqqp+f4CmpqaoqKjt7e3Hx8eVlZV7fH58fX6ampqZmZmdnZ3o6Ojl5eXk5OTf39/e3t50dXfd3d2Pj4+NjY2Li4uhoqOOjo6HiIrb29va2tp6enp3d3dub3BwcXOioqKBgYGFhYXv7+/IyMj5+fliYmLKystgYGBwcHBpaWpra21zc3NycnJcXFyQkJBhYmNlZWZtbW3Ly8xcXV6jo6Nra2u/v793eHpjY2N2dnaCg4OLjI7g4OBmZmeCgoLLy8u5ubmEhIRfX2Dc3NzW1tbKysqxsbFPT1Gvr69NTk9NTU9NTk5NTU7m5ua7u7tu8VCdAAAAEHRSTlMAnxe99/evvfC1qKf4+PGpMlfdYgAAAPdJREFUGBlFwYNuRAEQAMCt3e6zz7ZZ27Zt27b9vW2aSzoDySkX/9LSATKKfV9d3eW+y57e/ofH4SQYHRuvjpeUlplp+4JWt
@sbp
sbp / colloquial.txt
Created July 24, 2011 15:06
Colloquial Web CG summary
The Colloquial Web group evaluates existing practices amongst core web
technologies such as HTML, CSS, and JavaScript. It aims to provide users and
vendors with clear guidelines for deployment and innovation for web
applications. Example problem domains include continued use of deprecated
constructs, the rise in external services for hosting solutions such as Google
Web Fonts or MathJax, and comparing attitudes to RDFa and microdata.
The group will not produce languages, but may for example create profiles of
weighted technique matrices. In other words, more broadly speaking the group
has a bias towards empirical and descriptivist methods, but is not constrained
@sbp
sbp / fiddle.css
Created July 23, 2011 14:47
Show and hide comments, using jQuery
button.showComments { margin-right: .5em }
.comment { font: inherit; white-space: pre-wrap; color: #ccc }
@sbp
sbp / supercombiner.sh
Created July 23, 2011 12:31
Supercombiner pasteboard script for OS X
#!/bin/bash
python -c '
import sys, unicodedata
s = "u"
for i in xrange(1, 3000):
if unicodedata.category(unichr(i)) == "Mn":
s += unichr(i)
if len(s) > 100: break
sys.stdout.write(s.encode("utf-8"))
@sbp
sbp / swhack.cgi
Created July 21, 2011 22:42
Swhack search script
#!/usr/bin/python
import sys, os, time, urllib
print 'Content-Type: text/plain; charset=utf-8'
print
query = os.environ['QUERY_STRING']
query = urllib.unquote(query)
query = query.lower()