This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Libs | |
const PubNub = require('pubnub'); | |
const Web3 = require('web3'); | |
const ContractBuild = require('PATH_TO_TRUFFLE/build/contracts/Token.json'); | |
// PubNub | |
pubnub = new PubNub({ | |
publishKey : '__YOUR_PUB_KEY__', | |
subscribeKey : '__YOUR_SUB_KEY__' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default (request, response) => { | |
const vault = require('vault'); | |
let paramsObject = request.params; | |
return vault.get('myToken').then((token) => { | |
if (paramsObject.token === token) { | |
response.status = 200; | |
return response.send(); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Token Validator</title> | |
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<input id="text" type="text"> | |
<input id="submit" type="submit"> | |
<p id="serverResponse"></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Currently Active Demo</title> | |
<style type="text/css"> | |
.currently-active { | |
position: fixed; | |
margin: 10px; | |
padding: 5px; | |
bottom: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chat-engine.min.js"></script> | |
<script> | |
// WARNING! - Get PubNub API keys and run the ChatEngine setup: | |
// https://www.pubnub.com/docs/tutorials/chatengine#step-one-pubnub-keys | |
// Make sure to import ChatEngine first! | |
const ChatEngine = ChatEngineCore.create({ | |
publishKey: '__your_PubNub_Publish_key__', | |
subscribeKey: '__your_PubNub_Subscribe_key__' | |
}, { | |
globalChannel: 'chat-engine-demo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Be sure to replace strings with your own App's Publish & Subscribe keys | |
// Also replace the REST endpoint with your own On Request handler | |
var userPubKey = '__PUBNUB_PUBLISH_KEY__'; | |
var userSubKey = '__PUBNUB_SUBSCRIBE_KEY__'; | |
var pollyFunctionURI = 'https://pubsub.pubnub.com/v1/blocks/sub-key/__SUB_KEY__/__URI__'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Polly Button click event handler from app.js | |
function (e) { | |
var _app = this; | |
if (e.dataset.voiceAudioContent) { | |
_app.play(e.dataset.voiceAudioContent); | |
return; | |
} else { | |
$.ajax({ | |
method: "POST", | |
url: pollyFunctionURI, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PubNub Functions event handler | |
// Deploy globally in minutes at https://admin.pubnub.com/ | |
// Specify one channel or all with '*' in the editor | |
// Use `xhr.fetch(url).then()` to do an HTTP request | |
const xhr = require("xhr"); | |
export default (request) => { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Be sure to replace strings with your own App's Publish & Subscribe keys | |
// Also replace the REST endpoint with your own On Request handler | |
var userPubKey = '__PUBNUB_PUBLISH_KEY__'; | |
var userSubKey = '__PUBNUB_SUBSCRIBE_KEY__'; | |
var comprehendFunctionURI = 'https://pubsub.pubnub.com/v1/blocks/sub-key/__SUB_KEY__/__URI__'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.sentimentAnalysis(plainText, message.timetoken) | |
.then(function(id, sentiment) { | |
var messageInfoSpan = $('span[data-identifier="' + id + '"]'); | |
var messageDiv = $('div[data-identifier="' + id + '"]'); | |
if (sentiment.Sentiment && | |
sentiment.SentimentScore && | |
sentiment.SentimentScore.Negative && | |
sentiment.SentimentScore.Positive | |
) { |