Skip to content

Instantly share code, notes, and snippets.

View calvinmetcalf's full-sized avatar

Calvin Metcalf calvinmetcalf

View GitHub Profile
@calvinmetcalf
calvinmetcalf / footprint.py
Created December 7, 2012 21:04
grab all the new footprint shapefiles
import urllib,os,zipfile,glob
base = "http://wsgw.mass.gov/data/gispub/shape/structures/structures_poly_"
def download():
for i in range(1,352):
i=str(i)
n = i+".zip"
b=base+n
urllib.urlretrieve(b,n)
@calvinmetcalf
calvinmetcalf / types.json
Created December 8, 2012 21:10
voter records street abreviations
{"rows":[
{"key":"Aly","value":53},
{"key":"Anx","value":42},
{"key":"Ave","value":443940},
{"key":"Bch","value":60},
{"key":"Blf","value":73},
{"key":"Blfs","value":1},
{"key":"Blvd","value":13851},
{"key":"Bnd","value":176},
{"key":"Br","value":59},
@calvinmetcalf
calvinmetcalf / readme.md
Last active March 3, 2016 19:02
town pronounciations

Massachusetts Pronunciation Guide

From the Massachusetts Travel Survey, pulled out of the appendix and cleaned up.

The following list of Massachusetts cities and towns have somewhat unusual pronunciations. In addition to the text below, audio samples will be used to help interviewers to understand the local dialect. Please note that each interviewer will need to pass a pronunciation test demonstrating a general knowledge of the local dialect before being allowed to dial.

Note: Many, but not all, Massachusetts residents “drop their Rs” – meaning the vowel before the R is all that is heard. It often comes across as an “h” sound at the end of words. In most cases, it is not critical that you pronounce it this way, but the guide below is provided to help you understand the respondent. There are a few towns and cities to which you should pay particular attention, and they are marked with an asterisk (*):

Abington

@calvinmetcalf
calvinmetcalf / pouch.js
Created January 3, 2013 15:30
connect to a CouchDB that syncs locally to indexDB if available, if not tries webSQL, finally just follow the CouchDB directly.
function pouchSync(dbURL,cb){
var dbName = dbURL.split("/").pop();
Pouch(dbName,function(err1,db1){
Pouch(dbUrl,function(err2,db2){
if (db1 && db2){
db1.replicate.from(db2,{continuous:true});
db1.replicate.to(db2,{continuous:true});
cb(null, db1);
}else if (db2){
cb(null, db2);
@calvinmetcalf
calvinmetcalf / pouch.basic.js
Last active December 10, 2015 17:38
pouchdb in javascript
var db,
cb = function(err,database){
if(err){
console.error("Bad Stuff happend");
}else{
console.log("good news!")
db=database;
}
};
Pouch("http://url.to.couchdb/dbname",cb);
var db,
callback = function(err,database){
if(err){
console.error("Bad Stuff happend");
}else{
console.log("good news!")
db=database;
}
};
var makePouch = function(url,cb){
//GOOD NEWS, YOU CAN NOW OPEN POUCH SYNCRONOUSLY (god damn lack of spell checking in code pages)
/*var db,
cb = function(err,database){
if(err){
console.error("Bad Stuff happend");
}else{
console.log("good news!")
db=database;
}
@calvinmetcalf
calvinmetcalf / sync.js
Created January 11, 2013 03:39
sync example
var returnValue = function(a, b){return doStuff(a,b);}
//the program waits here until this finishes and then
//continues.
var asyncExample = function(a,b,callback){
var returnValue,returnError;//define stuff
try { //do the stuff
returnValue = doStuff(a,b);
} catch(err) { //if there is an err catch it
returnError = err;
} finally { //send it back
callback(returnError, returnValue);
}
}//program will not have to wait
//if this is your callback
var callback = function(error,response){
if(error){
//code here would only run if error is truthy
}else{
//this only runs if !error ==- true
}
}
//you can also write that as