Skip to content

Instantly share code, notes, and snippets.

View jaboutboul's full-sized avatar

Jack Aboutboul jaboutboul

  • ex-Red Hat, ex-Twilio
  • NYC
View GitHub Profile
@jaboutboul
jaboutboul / example.js
Created May 31, 2012 20:10 — forked from stevegraham/example.js
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";