Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / emphasis.md
Last active October 7, 2015 15:30
Markdown Emphasis

Yes, they DO!

Except snake_case. snake_case is ignored.

@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;
}
%}
@kaleb
kaleb / Constructor.js
Created July 1, 2013 13:40
JavaScript Notes for a friend
function Constructor() {
// Private member only accessible w/in constructor
var privateVariable;
// Can access private members
this.privilegedMethod = function() {
//...
};
}
@kaleb
kaleb / dabblet.css
Created September 17, 2013 20:21 — forked from colynb/dabblet.css
Radio Button Hack - CSS Only
input[type=radio] {
position: absolute;
top: -9999px;
left: -9999px;
}
label {
cursor: pointer;
text-align: center;
font-family: sans-serif;
@kaleb
kaleb / dabblet.css
Created September 17, 2013 20:25
Untitled
[type=radio] {
display:none;
}
span {
cursor: pointer;
text-align: center;
padding:15px;
background-color: #eee;
border-radius: 100px;
@kaleb
kaleb / dabblet.css
Created September 17, 2013 20:21
Untitled
[type=radio] {
display:none;
}
span {
cursor: pointer;
text-align: center;
font-family: sans-serif;
font-size: 14px;
font-weight: bold;
.menu {
background-color:white;
border:1px solid red;
}