Skip to content

Instantly share code, notes, and snippets.

@sunnygleason
sunnygleason / pubnub_newrelic_ui.html
Created January 28, 2017 20:40
PubNub Monitoring UI w/ New Relic
<!DOCTYPE html>
<html>
<head>
<title>Angular 2</title>
<script src="https://unpkg.com/[email protected]/client/shim.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/zone.js"></script>
<script src="https://unpkg.com/[email protected]/Reflect.js"></script>
<script src="https://unpkg.com/[email protected]/bundles/Rx.js"></script>
<script src="https://unpkg.com/@angular/core/bundles/core.umd.js"></script>
@sunnygleason
sunnygleason / pubnub_gifchat_ui.html
Created January 28, 2017 17:42
PubNub GifChat UI w/ Giphy
<!DOCTYPE html>
<html>
<head>
<title>Angular 2</title>
<script src="https://unpkg.com/[email protected]/client/shim.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/zone.js"></script>
<script src="https://unpkg.com/[email protected]/Reflect.js"></script>
<script src="https://unpkg.com/[email protected]/bundles/Rx.js"></script>
<script src="https://unpkg.com/@angular/core/bundles/core.umd.js"></script>
@sunnygleason
sunnygleason / pubnub_gifchat_block.js
Created January 28, 2017 17:41
PubNub GifChat BLOCK w/ Giphy
export default (request) => {
const xhr = require('xhr');
const query = require('codec/query_string');
const apiKey = 'YOUR_API_KEY';
const apiUrl = 'http://api.giphy.com/v1/gifs/search';
const regex = /\/gif\s\(([^.?]*)\)|\/gif\s\w+/g;
let textToAnalyze = request.message.text;
@sunnygleason
sunnygleason / pubnub_mapbox_directions_block.js
Created January 27, 2017 17:16
PubNub Directions BLOCK w/ Mapbox
export default request => {
let xhr = require('xhr');
let query = require('codec/query_string');
let clientToken = 'YOUR_CLIENT_TOKEN';
let apiUrl = 'https://api.mapbox.com/directions/v5';
let profile = request.message.profile;
let lat1 = request.message.lat1;
let lng1 = request.message.lng1;
@sunnygleason
sunnygleason / pubnub_mapbox_directions_ui.html
Last active January 27, 2017 17:34
PubNub Directions UI w/ Mapbox
<!DOCTYPE html>
<html>
<head>
<title>Angular 2</title>
<script src="https://unpkg.com/[email protected]/client/shim.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/zone.js"></script>
<script src="https://unpkg.com/[email protected]/Reflect.js"></script>
<script src="https://unpkg.com/[email protected]/bundles/Rx.js"></script>
<script src="https://unpkg.com/@angular/core/bundles/core.umd.js"></script>
@sunnygleason
sunnygleason / pubnub_mapbox_static.js
Created January 25, 2017 22:42
PubNub Mapping w/ Mapbox BLOCK
export default request => {
let xhr = require('xhr');
let query = require('codec/query_string');
let clientToken = 'YOUR_CLIENT_TOKEN';
let apiUrl = 'https://api.mapbox.com/styles/v1/mapbox/streets-v8/static';
let zoom = request.message.zoom;
let resolution = '300x200';
let lat = request.message.lat;
@sunnygleason
sunnygleason / pubnub_mapbox_static_ui.html
Last active January 26, 2017 19:26
PubNub Mapping UI w/ Mapbox
<!DOCTYPE html>
<html>
<head>
<title>Angular 2</title>
<script src="https://unpkg.com/[email protected]/client/shim.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/zone.js"></script>
<script src="https://unpkg.com/[email protected]/Reflect.js"></script>
<script src="https://unpkg.com/[email protected]/bundles/Rx.js"></script>
<script src="https://unpkg.com/@angular/core/bundles/core.umd.js"></script>
@sunnygleason
sunnygleason / pubnub_stamplay_ui.html
Last active January 23, 2017 14:17
PubNub Workflow w/ Stamplay UI
<!DOCTYPE html>
<html>
<head>
<title>Angular 2</title>
<script src="https://unpkg.com/[email protected]/client/shim.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/zone.js"></script>
<script src="https://unpkg.com/[email protected]/Reflect.js"></script>
<script src="https://unpkg.com/[email protected]/bundles/Rx.js"></script>
<script src="https://unpkg.com/@angular/core/bundles/core.umd.js"></script>
@sunnygleason
sunnygleason / pubnub_stamplay_block.js
Created January 23, 2017 14:04
PubNub Workflow w/ Stamplay BLOCK
export default (request) => {
const xhr = require('xhr');
const STAMPLAY_HOOK = 'YOUR_STAMPLAY_WEBHOOK_URL';
const reqBody = Object.assign({}, { type: 'block_event' }, request.message);
const options = {
method: 'POST',
headers: {
'Accepts': 'application/json',
'Content-Type': 'application/json'
@sunnygleason
sunnygleason / pubnub_diffbot_block.js
Last active December 30, 2016 16:24
PubNub Content Analysis BLOCK w/ Diffbot
export default request => {
let xhr = require('xhr');
let query = require('codec/query_string');
let clientToken = 'YOUR_CLIENT_TOKEN';
let apiUrl = 'https://api.diffbot.com/v3/analyze';
let queryParams = {
token: clientToken,
url: request.message.url