Skip to content

Instantly share code, notes, and snippets.

View drnugent's full-sized avatar

Dave Nugent drnugent

View GitHub Profile
@drnugent
drnugent / gist:38690f92537b87fcd62e
Created July 16, 2014 19:17
Using Xiki and PubNub
To Launch the PubNub interactive Xiki command:
$ pubnub
To launch the PubNub interactive Xiki command and start publishing messages to a channel:
$ pubnub %channelname
@drnugent
drnugent / pubnub-ambient-rfid.js
Last active August 29, 2015 14:06
Tessel-PubNub Demo Integration
var pubnub = require("pubnub").init({publish_key: "demo", subscribe_key: "demo" });
var tessel = require("tessel")
, ambient = require('ambient-attx4').use(tessel.port['A'])
, rfid = require('rfid-pn532').use(tessel.port['D'])
;
var conn = function() {
console.log("Running connect function");
rfid.on('ready', function (version) {
@drnugent
drnugent / gist:f837b51a975d1fc91a78
Created September 15, 2014 15:15
PubNub-Tessel Blinking LED Integration
var pubnub = require("pubnub").init({
publish_key: "demo",
subscribe_key: "demo",
uuid: "your_name_here" + Math.floor(Math.random()*1000)
});
var tessel = require("tessel");
var led1 = tessel.led[0].output();
var led2 = tessel.led[1].output();
var led3 = tessel.led[2].output();
@drnugent
drnugent / pubnub-tessel-audio.js
Last active August 29, 2015 14:06
PubNub/Tessel Audio Integration
var pubnub = require("pubnub").init({publish_key: "demo", subscribe_key: "demo" });
var tessel = require("tessel")
, ambient = require('ambient-attx4').use(tessel.port['A']);
var conn = function() {
console.log("Running connect function");
ambient.on('ready', function () {
ambient.setSoundTrigger(0.1);
@drnugent
drnugent / pubnub-publish
Created September 27, 2014 03:53
PubNub iOS Publish Example
// (In ViewController.m add to viewDidLoad:)
[PubNub setConfiguration:[PNConfiguration defaultConfiguration]];
[PubNub connect];
PNChannel *channel_1 = [PNChannel channelWithName:@"a" shouldObservePresence:YES];
[PubNub subscribeOnChannel:channel_1];
[PubNub sendMessage:@"Hello from PubNub iOS!" toChannel:channel_1];
@drnugent
drnugent / history.js
Last active August 29, 2015 14:20
PubNub git subscribe example
var displayMessages = function(ms) { ms[0].forEach(displayMessage); };
pubnub.history({
channel: 'pubnub-git',
callback: displayMessages,
count: 100
});
JS, version ES6
HTTPS server:
+ node.js
+ express.js (server framework)
+ node­postgres
+ JWT (token management)
+ react (universal rendering)
+ websockets (later in the project)
+ superagent (server­side HTTP client towards 3rd party services)
@drnugent
drnugent / pubnub-tessel.js
Last active April 26, 2018 06:50
PubNub/Tessel Super-Simple LED Integration
var pubnub = require("pubnub").init({ publish_key: "demo", subscribe_key: "demo" });
var tessel = require("tessel");
pubnub.subscribe({ channel: "tessel-light", message: function(m) {
tessel.led[1].toggle();
}});