Skip to content

Instantly share code, notes, and snippets.

@kaleb
kaleb / redirect.html
Created February 28, 2011 00:49
Template for Redirect Page
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Refresh" content="0; url={{ content }}">
<title>Redirect to {{ content }}</title>
</head>
<body>
<a href="{{ content }}">{{ content }}</a>
</body>
</html>
@kaleb
kaleb / StrictModeTest.js
Created March 4, 2011 03:28
Tests JavaScript Strict Mode Support
var isStrictModeSupported = (function(){"use strict";return !this}());
@kaleb
kaleb / table.html
Created April 5, 2011 20:02
HTML 5 Table Example
<!DOCTYPE html>
<title>HTML 5 Table Example</title>
<table>
<caption>This is a table</caption>
<thead>
<tr>
<th>number
<th>value
<tfoot>
<tr>
@kaleb
kaleb / dom-checkbox-label-test.js
Created April 17, 2011 15:15
Detect and fix leaky labels for disabled inputs
var lbl = document.createElement('label'),
chk = document.createElement('input'),
proto, lblOnClick;
chk.type = 'checkbox';
chk.disabled = true;
lbl.appendElement(chk);
lbl.click();
if (chk.checked) {
// Labels need to be fixed
proto = Object.getPrototypeOf(lbl);
@kaleb
kaleb / pe001.js
Created June 28, 2011 01:54
Project Euler #1
var i = 1000, sum = 0;
while (--i) {
if (!(i % 3 && i % 5)) {
sum += i;
}
}
console.log(sum);
@kaleb
kaleb / aliases
Created October 15, 2011 15:51
Gmail on Mutt
#~/.mutt/aliases
alias nick Nicholas Levandoski <nick.levandoski@auglug.org>
alias tim Timothy Pitt <timothy.pitt@auglug.org>
alias steven Steven Jackson <sjackson@auglug.org>
alias kaleb Kaleb Hornsby <kaleb.hornsby@auglug.org>
alias alug-admin nick, tim, steven
@kaleb
kaleb / shp-xml-attr.sh
Created June 21, 2012 15:02
Extract attributes from census.gov TIGER/Line .shp.xml shape metadata files
#!/bin/sh
# REQUIRES: xmlstarlet <http://xmlstar.sourceforge.net/>
xmlstarlet sel -t -v //attr $1
# Where $1 is a *.shp.xml file as downloaded from <http://www.census.gov/cgi-bin/geo/shapefiles2011/main>
@kaleb
kaleb / shp-xml-attr.sh
Created June 21, 2012 15:03
Extract attributes from census.gov TIGER/Line .shp.xml shape metadata files
#!/bin/sh
# REQUIRES: xmlstarlet <http://xmlstar.sourceforge.net/>
xmlstarlet sel -t -v //attr $1
# Where $1 is a *.shp.xml file as downloaded from <http://www.census.gov/cgi-bin/geo/shapefiles2011/main>
@kaleb
kaleb / XDG.vim
Last active January 17, 2022 23:16
VIM XDG Configuration
" XDG Environment For VIM
" =======================
"
" References
" ----------
"
" - http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
" - http://tlvince.com/vim-respect-xdg
"
if empty($XDG_CACHE_HOME)
@kaleb
kaleb / fixed-length-regex.jison
Last active December 10, 2015 14:18
The plan is to use this in a html5 form pattern attribute masker http://zaach.github.com/jison/try/ http://jsfiddle.net/kaleb/aWpec/
%{
/*
* code
*/
function xerox(que, quanto) {
var ary = [];
while(quanto--) ary.push(que);
return ary;
}
%}