Skip to content

Instantly share code, notes, and snippets.

View pblca's full-sized avatar
🔫
projecting

pblc pblca

🔫
projecting
  • garbage.gg
  • San Francisco
View GitHub Profile
var pubnub = PUBNUB.init({
publish_key : 'pub-c-df94b72e-7d48-4df1-8876-2cccc1afe0f8',
subscribe_key : 'sub-c-c5b3ec0c-d248-11e4-95a3-0619f8945a4f',
ssl : (('https:' == document.location.protocol) ? true : false)
});
function rand(len){
var text = "";
var charset = "abcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < len; i++ ) {
@pblca
pblca / instantiate.js
Last active August 29, 2015 14:14
A Test of multi-language gist changer
require('antigravity');
<!-- Include the PubNub Library -->
<script src="https://cdn.pubnub.com/pubnub-ds-b2.js"></script>
<!-- Instantiate PubNub -->
<script type="text/javascript">
var PUBNUB_demo = PUBNUB.init({
publish_key: 'Your Publish Key Here',
subscribe_key: 'Your Subscribe key Here'
});
<!-- Include the PubNub Library -->
<script src="https://cdn.pubnub.com/pubnub.min.js"></script>
<!-- Instantiate PubNub -->
<script type="text/javascript">
var PUBNUB_demo = PUBNUB.init({
publish_key: 'Your Publish Key Here',
subscribe_key: 'Your Subscribe key Here',
secret_key: 'Your Secret key Here'
@pblca
pblca / ready.js
Last active August 29, 2015 14:11
Quick Start tutorials for Data Sync
home.on.ready(function(){
syncDoor();
syncLight();
syncMusic();
});
home.on.change(function(ref){
syncDoor();
syncLight();
syncMusic();
pubnub.audit({
channel: 'Your_Channel_Name',
callback: function(m){
console.log(m);
}
});
<!-- Include the PubNub Library -->
<script src="https://cdn.pubnub.com/pubnub.min.js"></script>
<!-- Instantiate PubNub -->
<script type="text/javascript">
var PUBNUB_demo = PUBNUB.init({
publish_key: 'Your Publish Key Here',
subscribe_key: 'Your Subscribe key Here'
});
PUBNUB_demo.history({
channel : 'demo_tutorial',
count : 100,
callback : function(m){console.log(m)}
});
pubnub.subscribe({
channel: channel,
// Add presence
presence: function(m){
document.getElementById('occupancy').textContent = m.occupancy;
}
});
PUBNUB.publish({
channel : 'mouseMoves',
message : {
x: 400,
y: 200
}
});