Skip to content

Instantly share code, notes, and snippets.

View mheadd's full-sized avatar

Mark Headd mheadd

View GitHub Profile
@mheadd
mheadd / pennapps-demo.js
Created January 14, 2011 16:03
PennApps Mobile Demo Applications
if(currentCall.channel == 'VOICE') {
say('Hello there Penn Apps participants and guests.');
say('Even though I use the ' + currentCall.network + ' network, I can still get jiggy.', {voice: 'simon'});
say('Have fun at Penn Apps mobile.', {voice: 'kate'});
say('Adiós amigos.', {voice: 'carlos'});
}
else if(currentCall.channel == 'TEXT') {
say('You sent "' + currentCall.initialText + '" on the '+ currentCall.network + ' network.');
}
@mheadd
mheadd / simple.php
Created January 17, 2011 22:06
Simple outbound call
<?php
// Include the Tropo WebAPI class.
require('classes/tropo.class.php');
// Create a new Session object and get the value of the number_to_dial parameter.
$session = new Session();
$number_to_dial = $session->getParameters("number_to_dial");
// Create a new Tropo object, dial and say the message.
@mheadd
mheadd / balt-locator-phone.php
Created January 21, 2011 21:53
Baltimore Locator: An IM, SMS and Twitter application that finds locations in the City of Baltimore.
<?php
/**
* Baltimore Locator - an IM, SMS, Twitter and Phone application that finds
* locations in Baltimore.
*
* @copyright 2012 Mark J. Headd (http://civic.io)
* @author Mark Headd
*/
@mheadd
mheadd / app.js
Created January 24, 2011 16:17
Date and Time Grammars for use with Tropo Platform
answer();
var date = ask('Please say a date.', {choices: 'http://path/to/date.xml'});
log("*** " + date.value + " ***");
say('You said ' + date.value);
var time = ask('Now, say a time.', {choices: 'http://path/to/time.xml'});
log("*** " + time.value + " ***");
say('You said ' + time.value);
@mheadd
mheadd / couchdb.php
Created January 28, 2011 16:16
A simple PHP script that runs n Tropo scripting that stores user input on multiple text channels to a CouchDB instance.
<?php
// A function to store a document in CouchDB using cURL.
function saveData($callerID, $channel, $network, $text) {
$doc = json_encode(array("callerID" => $callerID, "channel" => $channel, "network" => $network, "text" => $text));
$url = COUCH_DB_HOST.":".COUCH_DB_PORT."/".COUCH_DB_NAME;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
@mheadd
mheadd / couchdb.php
Created January 31, 2011 21:37
Tropo example scripts
<?php
/*
* A script demonstrating how to store user inut in an external database.
*/
// A function to store a document in CouchDB using cURL.
function saveData($callerID, $channel, $network, $text) {
$doc = json_encode(array("callerID" => $callerID, "channel" => $channel, "network" => $network, "text" => $text));
$url = COUCH_DB_HOST.":".COUCH_DB_PORT."/".COUCH_DB_NAME;
@mheadd
mheadd / chicago-libraries.csv
Created February 9, 2011 15:00
Google refined list of libraries in Chicago originally obtained from http://data.cityofchicago.org/
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 16 columns, instead of 1 in line 5.
NAME,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY,SUNDAY,ADDRESS,CITY,STATE,ZIP,PHONE,WEBSITE,LATITUDE,LONGITUDE
Albany Park, 10AM-6PM, 12PM-8PM, 10AM-6PM, 12PM-8PM,9AM- 5PM,9AM- 5PM, Closed,5150 N. Kimball Avenue,CHICAGO,IL,60625,3127441933,http://www.chipublib.org/branch/details/library/albany-park/,41.97478671549107, -87.71359903393845
Altgeld, 12PM-8PM, 10AM-6PM, 12PM-8PM, 10AM-6PM,9AM- 5PM,9AM- 5PM, Closed,13281 S. Corliss Avenue,CHICAGO,IL,60827,3127473270,http://www.chipublib.org/branch/details/library/altgeld/,41.65473021837776, -87.6022302609835
Archer Heights, 12PM-8PM, 10AM-6PM, 12PM-8PM, 10AM-6PM,9AM- 5PM,9AM- 5PM, Closed,5055 S. Archer Avenue,CHICAGO,IL,60632,3127479241,http://www.chipublib.org/branch/details/library/archer-heights/,41.8012136599335, -87.72649071431441
Austin, 12PM-8PM, 10AM-6PM, 12PM-8PM, 10AM-6PM,9AM- 5PM,9AM- 5PM, Closed,5615 W. Race Avenue,CHICAGO,IL,60644,3127465038,http://www.chipublib.org/branch/details/library/austin/,41.889272153514526, -87.76571186722818
Austin-Irv
@mheadd
mheadd / philly-locater.php
Created February 25, 2011 20:20
A Tropo scripting application that finds library locations in Philadelphia.
<?php
/**
* Find My Library - an IM and SMS application that finds library locations in Philadelphia.
*
* @copyright 2011 Mark J. Headd (http://www.voiceingov.org)
* @author Mark Headd
*
* Deploy this application on http://www.tropo.com
*/
@mheadd
mheadd / boston-example.js
Created March 4, 2011 02:59
An example showing how to use the Node.js library for Open311
var sys = require('sys');
var Open311 = require('open311').Open311;
var options = {
'endpoint': 'mayors24.cityofboston.gov',
'service_path': '/open311/v2/',
'jurisdiction_id': 'cityofboston.gov',
'secure': true,
'port': 6443
};
:~ mheadd$ curl -v http://api.dc.gov/open311/v2_dev/services.json?jurisdiction_id=dc.gov
* About to connect() to api.dc.gov port 80 (#0)
* Trying 164.82.149.100... connected
* Connected to api.dc.gov (164.82.149.100) port 80 (#0)
> GET /open311/v2_dev/services.json?jurisdiction_id=dc.gov HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: api.dc.gov
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error