Skip to content

Instantly share code, notes, and snippets.

View stephenlb's full-sized avatar
😀
Coding with Rust

Stephen Blum stephenlb

😀
Coding with Rust
View GitHub Profile
@stephenlb
stephenlb / history.md
Last active October 3, 2016 20:29
PubNub History API V2

PubNub History API V2

/v2/history/sub-key/<sub-key>/channel/<channel>?URL_PARAMETERS
URL Parameters:
start (time token): Beginning of a timeline slice (exclusive)
@stephenlb
stephenlb / main.js
Last active December 21, 2015 22:09 — forked from dristic/main.js
var pubnub = PUBNUB.init({
publish_key : '<PUBLISH_KEY>',
subscribe_key : '<SUBSCRIBE_KEY>'
})
pubnub.subscribe({
channel : "my_channel",
message : function (message) {
console.log("I got the message: " + message)
},
@stephenlb
stephenlb / 1.js
Created October 29, 2013 18:28 — forked from ToeJamson/1.js
<div
channel-name=notifications-channel
segregate-notifications-by-page=false
id=desktop-notifications-config
></div>
<div id=pubnub pub-key=demo sub-key=demo></div>
<script src=http://http://cdn.pubnub.com/pubnub-3.5.4.min.js></script>
<script
src=http://www.pubnub.com/static/html5-desktop-notification-broadcasting.js
></script>
@stephenlb
stephenlb / 1.html
Last active December 31, 2015 18:19 — forked from ToeJamson/1.js
<script src="http://cdn.pubnub.com/pubnub.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<script src="http://pubnub.github.io/angular-js/scripts/pubnub-angular.js"></script>
@stephenlb
stephenlb / 1.html
Last active October 27, 2018 05:10 — forked from ToeJamson/1.js
Enter Chat and press enter
<div><input id=input placeholder=you-chat-here /></div>
Chat Output
<div id=box></div>
<script src=http://cdn.pubnub.com/pubnub.min.js></script>
<script>(function(){
var pubnub = PUBNUB.init({publish_key:'demo',subscribe_key:'demo',ssl:true});
var box = PUBNUB.$('box'), input = PUBNUB.$('input'), channel = 'chat';
@stephenlb
stephenlb / 1.lua
Last active August 29, 2015 13:58 — forked from ToeJamson/1.lua
require "pubnub"
--
-- GET YOUR PUBNUB KEYS HERE:
-- http://www.pubnub.com/account#api-keys
--
multiplayer = pubnub.new({
publish_key = "demo", -- YOUR PUBLISH KEY
subscribe_key = "demo", -- YOUR SUBSCRIBE KEY
secret_key = nil, -- YOUR SECRET KEY
@stephenlb
stephenlb / 1.js
Created May 7, 2014 23:26 — forked from ToeJamson/1.js
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Geo Hash
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function geohash( coord, resolution ) {
var rez = Math.pow( 10, resolution || 0 );
return Math.floor(coord * rez) / rez;
}
@stephenlb
stephenlb / 1.py
Last active October 19, 2017 00:36 — forked from ToeJamson/1.c
topic = "user/path/topic"
@stephenlb
stephenlb / cordova-1.html
Created November 15, 2017 21:05 — forked from domadev812/cordova-1.html
Snippets for blog, "Sending Android Push Notifications via GCM in JavaScript using PhoneGap and PubNub"
<script type="text/javascript" src="js/PushNotification.js"></script>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.17.0.js"></script>
@stephenlb
stephenlb / pubnub-js-publish
Created November 15, 2017 21:05 — forked from domadev812/pubnub-js-publish
pubnub_iot_tech_uc_1
$('#toggle').click(function(e){
pubmsg = { "req" : "toggle" };
var publishConfig = {
channel : 'gpio-raspberry-control',
message : pubmsg
}
pubnub.publish(publishConfig, function(status, response) {
console.log(status, response);