Skip to content

Instantly share code, notes, and snippets.

View mheadd's full-sized avatar

Mark Headd mheadd

View GitHub Profile
<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
version="1.0" xml:lang="en-US" mode="voice" root="main">
<rule id="main">
<one-of>
<item>
<item>30th</item>
<item repeat="0-">street</item>
@mheadd
mheadd / phlfindpolls-sample.js
Created November 5, 2012 03:43
Node.js modules for City of Philadelphia geolocation and polling location APIs
require('./phlgeolocate');
require('./phlfindpolls');
var address = process.argv[2] || '1234 Market Street';
var geo = new PHLgeolocate();
geo.getCoordinates(address, function(coords) {
var options = {};
options.outFields = ['WARD_1,DIVISION_1,POLLING_PL,ADDRESS,PARKING_AC,BUILDING_A'];
@mheadd
mheadd / philly-vote.php
Created November 3, 2012 19:32
A simple SMS script for finding polling locations in Philadelphia.
<?php
// Declare constants for Google API Key and Civic Information API endpoint.
define("GOOGLE_API_KEY", "");
define("GOOGLE_API_URL", "https://www.googleapis.com/civicinfo/us_v1/voterinfo/4000/lookup?fields=pollingLocations&officialOnly=%official%&key=%key%");
// An extra (optional) message to tell users.
define(EXTRA_VOTER_INFORMATION, "You may be asked for an ID at polling location, but it is not required to vote.");
// A phone number to give voice callers for finding out their polling place.
define(VOTER_INFO_PHONE_NUMBER, "215-686-3460 or 215-686-3461");
@mheadd
mheadd / gist:3946457
Created October 24, 2012 14:41 — forked from boutell/gist:3941578
Display a Google map with markers linking to pages
// Display a map with markers that link to other pages. Each marker must
// have latitude, longitude and slug properties. There must also be a
// a 'url' option which is used to build the links. The following
// wildcards are replaced in the url: ID (with the id), SLUG (with the
// slug property), PUBLISHED (with /year/month/day taken from published_at),
// and START (with /year/month/day taken from start_date). In other words,
// you can pass most array-hydrated Doctrine objects, including Apostrophe
// blog posts and events, and easily generate links back to them.
// The hover text title of the marker is taken from title if present,
@mheadd
mheadd / upload.html
Created October 13, 2012 14:22
iOS 6 upload test
<html>
<head><title>iOS 6 File Upload Test</title>
<body style="padding: 10px;">
<form enctype="multipart/form-data" action="#" method="POST">
Select a file to upload: <br />
<input name="my-file" type="file" /><br />
<input type="submit" value="Upload" />
</form>
</body>
</html>
@mheadd
mheadd / inherit.js
Created October 4, 2012 14:28
Quick and dirty summary of prototypical inheritance in JS
// Create a Car object with doors.
function Car() {
this.doors = 4;
};
// Method to return model year.
Car.prototype.getYear = function(n) {
var num = typeof(n) == 'undefined' ? 1 : n;
return 2001 + num;
};
@mheadd
mheadd / list-services.js
Created May 30, 2012 14:10
A simple example using the Node.js module for Open311 in Baltimore.
var util = require('util');
var Open311 = require('open311').Open311;
var options = {
'endpoint': '311test.baltimorecity.gov',
'service_path': '/open311/v2/',
'jurisdiction_id': 'baltimorecity.gov'
};
var report = new Open311(options);
@mheadd
mheadd / cfpb-source-code-policy.txt
Created April 9, 2012 15:44 — forked from CFPBadmin/cfpb-source-code-policy.txt
Consumer Financial Protection Bureau Source Code Policy
1. USE OF EXTERNAL OPEN SOURCE SOFTWARE
a) "Open Source Software" (OSS) is software that allows its recipients to modify and redistribute the source code; as such, "open source" is a copyright and distribution framework and makes no implications regarding technical support or indemnification. In almost all cases, OSS meets the definition of "commercial computer software" and shall be given appropriate statutory preference in accordance with 41 USC 264B (reference (b)) (see also FAR 2.101(b), 12_1.html 12.000, 12.101 (reference (c))).
b) Executive agencies, including CFPB, are required to conduct market research when preparing for the procurement of products or services by 41 USC Sec. 253a (reference (e)) (see also FAR 10.001. Market research for software should include OSS.
a. There are several positive aspects of OSS that should compel CFPB to seek out OSS when conducting market research on software for Bureau-wide use:
i. Publicly available source code enables continuous and broad peer review that
@mheadd
mheadd / config.js
Created February 23, 2012 14:39
Basic Node.js code sample for querying the Regulations.gov API
exports.credentials = {
api_key : 'YOUR_API_KEY_GOES_HERE'
};
<?php
if($currentCall->initialText) {
_log("*** User sent: " . $currentCall->initialText . " ***");
$result = ask("", array("choices" => "[ANY]"));
}
else {
call($numberToCall, array("timeout" => 60, "channel" => "TEXT", "network" => "SMS"));
$result = ask("Respond with a digit, any digit.", array("choices" => "[1 DIGIT]"));
}