Skip to content

Instantly share code, notes, and snippets.

Avatar

Sunny Gleason sunnygleason

View GitHub Profile
@sunnygleason
sunnygleason / pubnub_wason_sentiment.js
Created Oct 26, 2016
PubNub Sentiment Analysis with IBM Watson BLOCK
View pubnub_wason_sentiment.js
const xhr = require('xhr');
const qs = require('codec/query_string');
export default (request) => {
const apiUrl = 'https://gateway-a.watsonplatform.net/calls/text/TextGetTextSentiment';
const apiKey = '0000000000000000000000000000000000000000';
const querystring = qs.stringify({
outputMode: 'json',
showSourceText: false,
@sunnygleason
sunnygleason / pubnub_watson_tts.js
Last active Jan 15, 2020
PubNub Text-to-Speech BLOCK with IBM Watson
View pubnub_watson_tts.js
const console = require('console');
const xhr = require('xhr');
const store = require('kvstore');
const query = require('codec/query_string');
const auth = require('codec/auth');
export default (request) => {
// watson api token
const username = '00000000-0000-0000-0000-000000000000';
const password = '000000000000';
@sunnygleason
sunnygleason / pubnub_google_maps.html
Created Jan 31, 2017
PubNub Mapping w/ Google Maps
View pubnub_google_maps.html
<!doctype html>
<html>
<head>
<title>Google Maps Example</title>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.4.1.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" />
</head>
<body>
<div class="container">
@sunnygleason
sunnygleason / pubnub_mapbox.js
Created Nov 2, 2016
PubNub Geocoding and Mapping w/ MapBox BLOCK
View pubnub_mapbox.js
let xhr = require('xhr');
let query = require('codec/query_string');
export default request => {
let mapbox_clientToken = '000000000000000000000000000000000000000000000000000000000000000000000000';
let mapbox_geo_apiUrl = 'https://api.mapbox.com/geocoding/v5/mapbox.places/';
let mapbox_maps_apiUrl = 'https://api.mapbox.com/styles/v1/mapbox/streets-v8/static';
let searchParam = request.message.query;
@sunnygleason
sunnygleason / pubnub_twitter_ui.html
Last active Sep 6, 2017
PubNub Twitter Publisher BLOCK UI
View pubnub_twitter_ui.html
<!DOCTYPE html>
<html>
<head>
<title>Angular 2</title>
<script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.7.2/dist/zone.js"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.9/Reflect.js"></script>
<script src="https://unpkg.com/rxjs@5.0.1/bundles/Rx.js"></script>
<script src="https://unpkg.com/@angular/core/bundles/core.umd.js"></script>
@sunnygleason
sunnygleason / pubnub_angular2_expanded.html
Created Jan 29, 2017
PubNub Expanded Chat UI w/ Angular2
View pubnub_angular2_expanded.html
<!DOCTYPE html>
<html>
<head>
<title>Angular 2</title>
<script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.7.2/dist/zone.js"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.9/Reflect.js"></script>
<script src="https://unpkg.com/rxjs@5.0.1/bundles/Rx.js"></script>
<script src="https://unpkg.com/@angular/core/bundles/core.umd.js"></script>
@sunnygleason
sunnygleason / pubnub_infobip_ui.html
Last active Aug 29, 2017
PubNub SMS sender w/ Infobip API
View pubnub_infobip_ui.html
<!DOCTYPE html>
<html>
<head>
<title>Angular 2</title>
<script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.7.2/dist/zone.js"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.9/Reflect.js"></script>
<script src="https://unpkg.com/rxjs@5.0.1/bundles/Rx.js"></script>
<script src="https://unpkg.com/@angular/core/bundles/core.umd.js"></script>
@sunnygleason
sunnygleason / pubnub_infobip_function.js
Last active Aug 29, 2017
PubNub SMS sender FUNCTION JavaScript
View pubnub_infobip_function.js
const INFOBIP_API_KEY = 'YOUR_API_KEY';
const INFOBIP_API_URL = 'https://api.infobip.com/sms/1/text/single';
const SUCCESSFUL_SMS_STATUS_GROUPS = [1, 3];
const pubNub = require('pubnub');
const xhr = require('xhr');
function composeOptions(apiKey, body) {
return {
method: 'POST',
@sunnygleason
sunnygleason / pubnub_mnubo_function.js
Created Aug 4, 2017
PubNub IoT Events FUNCTION w/ Mnubo
View pubnub_mnubo_function.js
const XHR = require('xhr');
const db = require('kvstore');
const basicAuth = require('codec/auth');
function fetchAccessToken(authUri, clientId, clientSecret) {
const auth = basicAuth.basic(clientId, clientSecret);
const httpOptions = {
method: 'POST',
body: 'grant_type=client_credentials&scope=ALL',
headers: {
@sunnygleason
sunnygleason / pubnub_mnubo_ui.html
Created Aug 4, 2017
PubNub IoT Events UI w/ Mnubo
View pubnub_mnubo_ui.html
<!DOCTYPE html>
<html>
<head>
<title>Angular 2</title>
<script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.7.2/dist/zone.js"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.9/Reflect.js"></script>
<script src="https://unpkg.com/rxjs@5.0.1/bundles/Rx.js"></script>
<script src="https://unpkg.com/@angular/core/bundles/core.umd.js"></script>
You can’t perform that action at this time.