Skip to content

Instantly share code, notes, and snippets.

View don's full-sized avatar

Don Coleman don

View GitHub Profile
@kyleburton
kyleburton / simple-ivr-simulator.sh
Created February 16, 2011 21:04
Simple IVR Simulator for testing out user experience (Works on OSX)
VOICE="Vicki"
BALANCE="100"
function voice_prompt () {
echo " SPEAKING: $1"
say -v "$VOICE" "$1"
}
function get_user_keypress () {
KEY=""
// converts milliseconds to '3:45' or if hours > 0, '2:01:23'
var getTimeFromMillis = function( ms ) {
var seconds = ~~( ( ms / 1000 ) % 60 ),
minutes = ~~( ( ms / ( 1000 * 60 ) ) % 60 ),
hours = ~~( ( ms / ( 1000 * 60 * 60 ) ) ),
twoDigit = function ( n ) {
return n < 10 ? '0' + n : n;
},
seconds = ':' + twoDigit( seconds );