Skip to content

Instantly share code, notes, and snippets.

View stevegraham's full-sized avatar
🛠️
Building @tellerhq

Stevie Graham stevegraham

🛠️
Building @tellerhq
View GitHub Profile
# Twilio REST API version
API_VERSION = '2010-04-01'
# Twilio AccountSid and AuthToken
ACCOUNT_SID = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
ACCOUNT_TOKEN = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
# Outgoing Caller ID previously validated with Twilio
CALLER_ID = 'NNNNNNNNNN';
call = Twilio::Call.create :to => '+14155551212',
:from => '+14155550000',
:url => 'http://demo.twilio.com/welcome'
Twilio::Config.setup do
account_sid 'AC0000000000000000'
auth_token '000000000000000000'
end
class FooController < ApplicationController
responds_to :html, :voice
def index
...
end
end
res.say "Damn! This is so easy. I'm overwhelmed! I need a moment!"
res.pause :length => 5
res.say "I'm ok now!"
call.complete!
call.url = 'http://example.com/im_in_ur_appz_redirectin_ur_callz'
Gchart.instance_eval { def url; 'https://chart.googleapis.com/chart?' end }
class IVRMenuController
respond_to :voice
def index
case params['Digits']
when '1' then render :template => 'directions'
when '2' then render :template => 'opening_hours'
when '3' then render :template => 'special_offers'
else render :template => 'welcome'
end
end
@stevegraham
stevegraham / gist:984829
Created May 21, 2011 19:37
JavaScript Array#map
Array.prototype.map = function(func) {
var output = []
for(i=0; i < this.length; i++) {
output[i] = func(this[i])
}
return output
}
// Example usage:
// [1,2,3].map(function(i) { return i * i })