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 / calculate-payload-size.js
Last active January 2, 2016 04:19
Calculating a PubNub Message Payload Size. This is necessary to prevent yourself from getting a "Message Too Large" gateway response.
(function(){
// Calculating a PubNub Message Payload Size.
function calculate_payload_size( channel, message ) {
return encodeURIComponent( channel + JSON.stringify(message) ).length + 97;
}
})();
@jeremyvdw
jeremyvdw / apubnub.rb
Created March 5, 2012 18:27
apublish & asubscribe PubNub methods (wrapped in Fibers)
require 'eventmachine'
require 'em-http-request'
require 'yajl'
module PubSub
class Pubnub
#**
#* Pubnub
#*
#* Init the Pubnub Client API
@stephenlb
stephenlb / macvim-install.sh
Created February 18, 2012 07:27
MacVim Terminal Installation
## MacVim Good Terminal Only Installation Guide
## http://www.pubnub.com/
## http://twitter.com/pubnub
## USAGE - Copy+Paste this One-liner:
##
## bash <(curl https://raw.github.com/gist/1858026/macvim-install.sh)
##
## OR - Download this file and execute
@krhoyt
krhoyt / pubnub.ino
Created December 2, 2014 21:31
Spark Core to PubNub
// Libraries
#include <math.h>
// Literals
#define THERMISTOR A0
// Constants
// Thermistor computation
const float ANALOG_STEPS = 4095.0;
const float B_THERM = 3977.0;