Skip to content

Instantly share code, notes, and snippets.

View kwhinnery's full-sized avatar

Kevin Whinnery kwhinnery

View GitHub Profile
var Twilio = require('./index').Twilio;
var c = new Twilio();
c.api.messages.create({
to: '+16512080532',
from: process.env.TWILIO_NUMBER,
body: 'hey there'
}).then(function(data) {
console.log(data);
Property.findOne({
_id: propertyId
}).then(function (property) {
var reservation = new Reservation({
message: req.body.message,
property: propertyId,
guest: user.id
});
return reservation.save();
var mongoose = require('mongoose');
var propertySchema = new mongoose.Schema({
description: { type: String, required: true },
imageUrl: { type: String, required: true },
date: { type: Date, default: Date.now },
owner: {
type: mongoose.Schema.Types.ObjectId,
ref: 'user'
}
@import url(https://fonts.googleapis.com/css?family=Share+Tech+Mono);
body,
p {
padding: 0;
margin: 0
}
body {
background: #272726
}
var accountSid = 'ACCOUNT_SID';
var authToken = 'AUTH_TOKEN';
var IpMessagingClient = require('twilio').IpMessagingClient
var client = new IpMessagingClient(accountSid, authToken);
var service = client.services('SERVICE_SID');
service.channels.list().then(function(response) {
console.log(response);
}).fail(function(error) {
@kwhinnery
kwhinnery / App.java
Created November 24, 2015 19:52
How to test SSL cert changes on api.twilio.com:8443
// You may want to be more specific in your imports
import java.util.*;
import com.twilio.sdk.*;
import com.twilio.sdk.resource.factory.*;
import com.twilio.sdk.resource.instance.*;
import com.twilio.sdk.resource.list.*;
public class App {
// Find your Account Sid and Token at twilio.com/user/account
public static final String ACCOUNT_SID = "AC5ef872f6da5a21de157d80997a64bd33";
var sa = require('superagent');
sa.post('https://ip-messaging.twilio.com/v1/Services')
.auth(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN)
.type('form')
.send({
FriendlyName: 'Super Awesome App'
})
.end(function(err, res) {
console.log(res.body.sid);
var util = require('util');
var twilio = require('twilio');
// Fetch a signing key from the Twilio REST API, which we'll use to mint our
// access tokens below in exports.generateToken
var SIGNING_KEY_SID, SIGNING_KEY_SECRET;
exports.initialize = function(callback) {
// Initialize Twilio REST API client with our account SID and auth token
var client = new twilio.RestClient(
var fs = require('fs');
fs.readdir('./challenges/',function(err,files){
if(err) throw err;
for(i=0;i<files.length;i++) {(
function(index) {
fs.readFile('./challenges/' + files[index], "utf-8", function (err, data) {
if (err) throw err;
challenges.push({ 'id':j, 'markup': marked(data) });
@kwhinnery
kwhinnery / video.html
Last active August 29, 2015 14:20
This is a fictional API I would have designed for Video.
<html>
<head>
<title>Fantasy Video API</title>
</head>
<body>
<video id="me"></video>
<video id="you"></video>
<button id="invite">Invite you@twilio.com</button>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>