Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Whinnery kwhinnery

  • Twilio
  • Saint Paul / Minneapolis
View GitHub Profile
View app.js
// Node module dependencies
var app = require('gopher'),
twilio = require('twilio');
// Pull in Twilio config from the BlueMix environment
// The VCAP_SERVICES environment variable contains a JSON string with all your
// BlueMix environment data
var config = JSON.parse(process.env.VCAP_SERVICES);
// Loop through user-provided config info and pull out our Twilio credentials
View hello.js
// Import the "http" module from the node.js standard library
var http = require('http');
// Create a simple HTTP server, which will execute a function
// when it receives an incoming request
var server = http.createServer(function (request, response) {
// Set the Content-Type HTTP header on your response to indicate
// You are going to return plain text to the client
response.writeHead(200, {'Content-Type': 'text/plain'});
View cold.md

How Winter Feels to Native Minnesotans

When I travel to San Francisco or similar warm climates, non-midwesterners have a hard time visualizing what a cold winter day in Minnesota feels like, or how we perceive and react to one. It turns out that there is a good metaphor for summing up how a Minnesotan feels about a given temperature: how we behave when we're inside and forget something in the car. Here's how we handle that situation in various temperatures. Units below are degrees Fahrenheit.

21 and warmer

Run out to the car and calmly grab the thing in whatever we happen to be wearing.

10 - 20

Run out to the car and grab the thing in whatever we happen to be wearing, but move quickly because it's kind of cold.

View embeddedtitanium.md

Embedded Titanium

Hi Jeff and Tony! Here's the getting started guide for the fantasy Titanium component I want you to build for me :)

About Embedded Titanium

Embedded Titanium allows native iOS developers to rapidly build part or all of their mobile application using simple JavaScript APIs. Use a TitaniumViewController just like you would a UIViewController in your iOS app to mix and match pure native views and JavaScript-driven Titanium views. It's less filling AND it tastes great!

Installation

Embedded Titanium is distributed through Cocoapods. To install, add the following to your Podfile:

View demo.js
var twilio = require('twilio');
var client = twilio('your account sid', 'your auth token');
// Call everyone that texted a number you just bought - remember, for this to work,
// this needs to be a number you just bought, that only this room full of people have
// texted
client.listMessages({
to:'your twilio number'
}, function(err, data) {
@kwhinnery
kwhinnery / app.js
Created Mar 21, 2014
1.) create a directory, go into it. 2.) npm install twilio gopher 2.5) mkdir views && touch views/index.ejs 2.75) copy in code below 3.) run app with node app.js 4.) open localhost:3000/test in a browser 5.) execute node call.js in the terminal
View app.js
var app = require('gopher'),
twilio = require('twilio');
app.get('/test', function(request, response) {
var capability = new twilio.Capability();
capability.allowClientIncoming('default_client');
response.render('index', {
token: capability.generate()
});
@kwhinnery
kwhinnery / nodelock.js
Last active Aug 29, 2015 — forked from jonmarkgo/nodelock.js
Assumes process.env.TWILIO_AUTH_TOKEN
View nodelock.js
var twilio = require('twilio'),
SerialPort = require("serialport").SerialPort,
express = require('express');
var app = express();
function sendMessage(res, message) {
var resp = new twilio.TwimlResponse();
resp.message(message);
res.type('text/xml');
View app.js
var client = require('twilio')();
// Callback
client.listMessages({
to:'+16516668899'
}, function(err, data, next) {
if (err) {
console.error(err);
} else if (data.nextPageUri) {
next();
View states.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="U.S. States Kevin Has Visited">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>U.S. States Kevin Has Visited</title>
<style>
body {
text-align: center;
View SomeFile.m
[PFCloud callFunctionInBackground:@"capability"
withParameters:nil
block:^(NSString *token, NSError *error) {
TCDevice *device = [TCDevice initWithTokenOrWhateverIForget:token];
}];