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
@stevegraham
stevegraham / example.js
Created May 30, 2012 20:42
JavaScript TwiML generator
Twilio = Object.create({})
Twilio.TwiML = {
build: function(fn) {
var prolog = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
var Buffer = function(level) {
var buffer = "";
var indent = function(i) { return new Array((i * 2) + 1).join(" ") }
var level = level || 1;
var append = function(str) {
buffer += indent(++level) + str + "\n";
get('/apps/:app_id', function() {
return "hello world";
});
post('/apps', function() {
// do some shit
status(201);
headers({ location: resource_url });
});
@stevegraham
stevegraham / adam.css
Created February 8, 2012 19:13
spotify app stylesheets
/**
* Adam Theme / Dark Theme
* Standard Layout for Spotify Client
* Defines the basic styles for an app
* @copyright 2011 by Spotify
*/
/**
* Declarations for Adam Theme
*
%script{ type: 'text/template', id: 'number_search_result' }
%input{ name: '<%= friendly_name %>', value: '<%= phone_number %>', type: 'radio' }
<Response>
<Gather>
<Input name="credit_card[number]">
<Say>Please enter the long number on the front of your card.</Say>
</Input>
<Input name="credit_card[expiry_date]">
<Say>Now enter your expiry date</Say>
</Input>
</Gather>
</Response>
list = [1..10]
squares = list.map (num) -> num * num
squares = (num * num for num in list)
// Compiles to...
var list, num, squares;
list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
squares = list.map(function(num) {
# using twilio-rb
Twilio::Call.create to: telephone_number_of_participant, from: your_caller_id, url: conference_resource_url
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Thanks for calling</Say>
<Sms>Thanks for calling</Sms>
</Response>
require 'net/https'
https = Net::HTTP.new('api.twilio.com', 443)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.request_get('/')
// why this?
Array.prototype.slice.call(arguments, 1)
// when you can do this?
[].slice.call(arguments, 1)