Skip to content

Instantly share code, notes, and snippets.

View kwhinnery's full-sized avatar

Kevin Whinnery kwhinnery

View GitHub Profile
const pool = require('./config');
require('dotenv').config()
const getUsers = (request, response) => {
pool.connect().then(client => {
client.query('SELECT * FROM users ORDER BY id ASC', (error, results) => {
if (error) {
throw error
}
response.status(200).json(results.rows)
const express = require('express')
const app = express()
app.post('/sms', (request, response) => {
let twiml = `
<Response>
<Message>hey there, thanks for checking out my demo!</Message>
</Response>
`;
/* global module, exports, require, process, console */
'use strict'
const Airtable = require('airtable')
// Configure Airtable database
const base = new Airtable({
apiKey: process.env.AIRTABLE_API_KEY}
).base(process.env.AIRTABLE_DATABASE)
require 'sinatra'
require 'twilio-ruby'
sid = ''
tkn = ''
app_sid = ''
capability = Twilio::Util::Capability.new sid, tkn
capability.allow_client_outgoing(app_sid)
html
head
title Socket.io Example
body
h1(class="something") Socket.io Example
input#msg(type="text")
button send message
#messages
@kwhinnery
kwhinnery / readme.md
Last active September 16, 2016 16:10
Proposal for SDK packaging

Proposal for JavaScript SDK packaging

Right now, the Twilio client-side SDKs feel like they are designed and shipped by dozens of people. By making some changes to the Twilio SDK CDN and our module sructure, we could address some of these issues.

Include the latest everything from CDN

For onboarding and getting started, we could include a "kitchen sink" artefact that bundles up the latest version of every Twilio client-side SDK.

<script src="//media.twiliocdn.com/js/twilio.min.js"></script>
// Install the Java helper library from twilio.com/docs/java/install
import org.joda.time.LocalDate;
import com.twilio.rest.Twilio;
import com.twilio.rest.resource.api.v2010.account.call.FeedbackSummary;
public class Example {
// Find your Account Sid and Token at twilio.com/user/account
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
public static final String AUTH_TOKEN = "your_auth_token";
// Install the Java helper library from twilio.com/docs/java/install
import java.net.URI;
import java.net.URISyntaxException;
import com.twilio.rest.Twilio;
import com.twilio.rest.creator.api.v2010.account.CallCreator;
import com.twilio.rest.resource.api.v2010.account.Call;
import com.twilio.rest.type.PhoneNumber;
public class Example {
var t = new twilio.TwimlResponse();
t.dial((dial) => {
dial.number('+16518675309');
});
var accountSid = '{{ YOUR_ACCOUNT_SID }}';
var authToken = '{{ YOUR_AUTH_TOKEN }}';
var LookupsClient = require('twilio').LookupsClient;
var client = new LookupsClient(accountSid, authToken);
var phoneNumber = process.argv[2];
client.phoneNumbers(phoneNumber).get({
type: 'carrier'
}, (error, number) => {
var message = number ? number.national_format + ' is valid' : error;