Skip to content

Instantly share code, notes, and snippets.

Avatar

Sunny Gleason sunnygleason

View GitHub Profile
@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_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_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>
@sunnygleason
sunnygleason / pubnub_neutrino_ui.html
Created Apr 25, 2017
PubNub HTML Sanitizer UI w/ Neutrino
View pubnub_neutrino_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_neutrino_block.js
Last active Apr 25, 2017
PubNub HTML Sanitizer BLOCK JavaScript
View pubnub_neutrino_block.js
export default (request) => {
const xhr = require('xhr');
const query = require('codec/query_string');
const userId = 'YOUR_USER';
const apiKey = 'YOUR_API_KEY';
const outputType = 'plain-text';
let apiUrl = 'https://neutrinoapi.com/html-clean';
@sunnygleason
sunnygleason / pubnub_twitter_block.js
Last active Apr 25, 2017
PubNub Twitter Publisher BLOCK JavaScript
View pubnub_twitter_block.js
const xhr = require('xhr');
const base64Codec = require('codec/base64');
const crypto = require('crypto');
export default (request) => {
// see https://apps.twitter.com
const consumerKey = "YOUR_CONSUMER_KEY";
const consumerSecret = "YOUR_CONSUMER_SECRET";
const accessToken = "YOUR_ACCESS_TOKEN";
const oauthTokenSecret = "YOUR_OAUTH_TOKEN_SECRET";
@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_xhr_block.js
Created Apr 21, 2017
Advanced BLOCKS Techniques - XHR BLOCK
View pubnub_xhr_block.js
export default (request) => {
const xhr = require('xhr');
const query = require('codec/query_string'); // for HTTP URL encoding
const auth = require('codec/auth'); // for HTTP Basic Auth
const base64 = require('codec/base64'); // for other custom schemes
const apiUrl = "https://api.duckduckgo.com/?";
var queryString = query.stringify({
q : request.message.text,
@sunnygleason
sunnygleason / pubnub_xhr_ui.html
Last active Apr 21, 2017
Advanced BLOCKS Techniques - XHR UI
View pubnub_xhr_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.