Skip to content

Instantly share code, notes, and snippets.

Adam Bavosa ajb413

Block or report user

Report or block ajb413

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ajb413
ajb413 / index.html
Created Jun 28, 2019
EON Flight Map Example
View index.html
<!DOCTYPE html>
<head>
<title>EON Flight Map</title>
<script type="text/javascript" src="https://pubnub.github.io/eon/v/eon/1.0.0/eon.js"></script>
<link type="text/css" rel="stylesheet" href="https://pubnub.github.io/eon/v/eon/1.0.0/eon.css" />
</head>
<body>
<div class="col-md-12">
<div id='map' class="map" style="height:500px;"></div>
View new.js
confirmCall(name).then((yesDoCall) => {
if (yesDoCall) {
// Get new TURN server credentials from Xirsys
// Not Required but it is more reliable than peer-to-peer
request(turnApiUrl, 'PUT', {
'headers': { 'tok': turnToken }
}).then((response) => {
rtcConfig.iceServers = [response];
webRtcPhone.callUser(userToCall, {
myStream: myAudioVideoStream
@ajb413
ajb413 / before-publish.js
Last active May 14, 2019
IBM Watson Language Translator
View before-publish.js
// Example languages to translate to, English, Spanish, French
// ['en', 'es', 'fr']
// require xhr module. We'll be using 3rd party http endpoint for
// translation. We need to make a get request to the endpoint with
// parameters and we will get back the translated text in response. xhr
// module will help in sending out http requests.
const xhr = require('xhr');
const query = require('codec/query_string');
View pubnub.js
const pubnub = new PubNub({
publishKey : 'pub-c-0b42108c-8179-4742-9914-0ef70a1fded7',
subscribeKey : 'sub-c-0a75a202-345d-11e9-a629-42eced6f83cd'
});
pubnub.addListener({
status: function(statusEvent) {
if (statusEvent.category === "PNConnectedCategory") {
publishSampleMessage();
}
@ajb413
ajb413 / storage-playback.js
Created Mar 4, 2019
PubNub v4 JS Storage & Playback sample code
View storage-playback.js
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Count of Channel Messages (up to 100)
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
const getPreviousCountMessages = (count) => {
pubnub.history({
channel: 'time-publish-example-channel',
count
}, function (status, response) {
// `count` Array of previous messages is in:
// response.messages;
@ajb413
ajb413 / swift.md
Created Jan 29, 2019
PubNub Pub/Sub Swift Quickstart
View swift.md

Swift

Open Xcode and Create a new Xcode project with Single View App called pubnubdemo.

Quit Xcode and navigate to the project directory in the terminal using this command.

cd pubnubdemo

Install CocoaPods, then use the pod command to create a Podfile.

View nodejs.md

Node.js

Make a new folder for your demo code

mkdir pubnub-demo && cd pubnub-demo

Get the SDK on the command line with NPM install NPM and Node.js here:

npm init -y
View javascript.md

JavaScript

Make a new HTML file. Save this code as index.html in your folder.

<!DOCTYPE html>
<html>
<head>
    <title>Publish Subscribe Tutorial</title>
</head>
View pn_client_2.py
from pubnub.callbacks import SubscribeCallback
from pubnub.enums import PNStatusCategory
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub
import time
import os
pnconfig = PNConfiguration()
pnconfig.publish_key = 'enter your pubnub publish key here'
View pn_client_1.py
from pubnub.callbacks import SubscribeCallback
from pubnub.enums import PNStatusCategory
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub
import time
import os
pnconfig = PNConfiguration()
pnconfig.publish_key = 'enter your pubnub publish key here'
You can’t perform that action at this time.