Skip to content

Instantly share code, notes, and snippets.

View mdobson's full-sized avatar
😺
Petting a cat

Matthew Dobson mdobson

😺
Petting a cat
View GitHub Profile
//From
{
"topic":"lcd/8142E11C-87AE-4C13-9DD1-E2900EB97BF0",
"timestamp":1402676545565,
"transition":"change",
"input":[{"name":"message", "value":"I heard dat!"}],
"properties": {
"type":"lcd",
"name":"My LCD",
var util = require('util');
var zetta = require('zetta');
var Scout = zetta.Scout;
var HueBulb = require('./hue_bulb_driver');
var HueBulbScout = module.exports = function(){
Scout.call(this);
};
util.inherits(HueBulbScout, Scout);
@mdobson
mdobson / gist:bb3608d1a73b6f2abfbd
Last active August 29, 2015 14:02
Workshop Description

Use Apigee and APIs to secure, and control your home! In our IoT themed developer workshop we'll be building a home security system that will use a combination of JavaScript, Hardware, and APIs. This workshop will give you first hand experience in the world of hardware using Zettajs the Apigee framework for the Internet of Things. You'll model devices, orchestrate interactions, and get an API for free. A strong knowledge of JavaScript, and Node.js is required. You should have node installed on your computer, and a text editor ready to write code.

@mdobson
mdobson / 1.md
Last active August 29, 2015 14:02
API call coding exercise

Hi there!

Today we'll be building a simple app to make Async API calls and parse JSON. Below is a list of requirements for the app.

  1. Open XCode and create a Single View Application
  2. The app must make an asynchronous GET HTTP call to the following URL http://ug-proxy.herokuapp.com/
  3. The app must parse the JSON and log out the name and address properties from the results of the HTTP call
  4. When complete copy and paste Objective-C into the comments box below.

curl -i http://ug-proxy.herokuapp.com/

@mdobson
mdobson / index.js
Created June 19, 2014 20:22
Caching with Argo + Volos
var argo = require('argo');
var cache = require('volos-cache-memory');
var cacheInstance = cache.create('test', {ttl: 10000});
argo()
.use(cacheInstance.argoMiddleware().cache())
.get('/hello', function(handle) {
handle('request', function(env, next) {
env.response.statusCode = 200;
@mdobson
mdobson / 1.json
Created June 6, 2014 16:52
API Example
{
"class":["device"],
"properties": {
"id":"E2A9E247-1F9C-47B8-9A6B-813AD63F3D58",
"name":"Matt's sound sensor",
"type":"sound",
"state":"ready",
"amplitude":10
},
"links":[
@mdobson
mdobson / 1.js
Created June 6, 2014 16:51
Scout example
var util = require('util');
var Scout = require('zetta').Scout;
var SerialPort = require('serialport').SerialPort;
var Microphone = require('./microphone_driver');
var Arduino = module.exports = function(runtime) {
Scout.call(this);
// allow access to runtime to other methods.
this.runtime = runtime;
this.portName = '/dev/tty.usbserial';
@mdobson
mdobson / 1.js
Created June 6, 2014 16:51
Driver example
var Driver = require('zetta').Driver;
var util = require('util');
// Name your driver the device it's modeling
var Microphone = module.exports = function(port){
Driver.call(this);
// not saved and not exposed in api
this._port = port;
// saved and exposed in api
@mdobson
mdobson / 1.js
Last active August 29, 2015 14:02
app example
var zetta = require('zetta');
var Arduino = require('./scouts/arduino');
var app = zetta();
// app.name() is optional
app.expose('*');
app.load(Arduino);
app.link('http://zetta-cloud.herokuapp.com/')
app.observe([{type: 'sound'}, {type:'lcd'}]function(sound, lcd) {
@mdobson
mdobson / 1.sh
Last active August 29, 2015 14:02
proposal for isolated sound sensor
zetta peers add "http://zetta-cloud.herokuapp.com"
node app.js