This file contains hidden or 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
import requests | |
def get_sentiment(body): | |
endpoint = "http://gateway-a.watsonplatform.net/calls/text/TextGetTextSentiment" | |
parameters = { | |
'apikey': API_KEY, | |
'outputMode': 'json', | |
'text': body | |
} | |
This file contains hidden or 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> | |
<meta charset="UTF-8"> | |
<title>Hello World!</title> | |
</head> | |
<body> | |
<h1>Hello World!</h1> | |
We are using node <script>document.write(process.versions.node)</script>, | |
Chrome <script>document.write(process.versions.chrome)</script>, |
This file contains hidden or 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
'use strict'; | |
const electron = require('electron'); | |
const app = electron.app; // Module to control application life. | |
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window. | |
// Keep a global reference of the window object, if you don't, the window will | |
// be closed automatically when the JavaScript object is garbage collected. | |
var mainWindow = null; |
This file contains hidden or 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
{ | |
"name" : "your-app", | |
"version" : "0.1.0", | |
"main" : "main.js" | |
} |
This file contains hidden or 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
// From https://github.com/howdyai/botkit#hear-middleware | |
// This will replace the matching function used in hears() as well as inside convo.ask() | |
controller.changeEars(function(patterns, message) { | |
// ... do something | |
// return true or false | |
}); |
This file contains hidden or 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
// From https://github.com/howdyai/botkit#hear-middleware | |
// this example does a simple string match instead of using regular expressions | |
function custom_hear_middleware(patterns, message) { | |
for (var p = 0; p < patterns.length; p++) { | |
if (patterns[p] == message.text) { | |
return true; | |
} | |
} | |
return false; |
This file contains hidden or 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
<!-- index.html --> | |
<html> | |
<body> | |
<script> | |
require('electron').ipcRenderer.on('ping', function(event, message) { | |
console.log(message); // Prints "whoooooooh!" | |
}); | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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
// From https://github.com/howdyai/botkit#send-middleware | |
controller.middleware.send.use(function(bot, message, next) { | |
// do something useful... | |
if (message.intent == 'hi') { | |
message.text = 'Hello!!!'; | |
} | |
next(); | |
}); |
This file contains hidden or 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
// From https://github.com/howdyai/botkit#receive-middleware | |
controller.middleware.receive.use(function(bot, message, next) { | |
// do something... | |
// message.extrainfo = 'foo'; | |
next(); | |
}); |
This file contains hidden or 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
// From https://github.com/howdyai/botkit#botsay | |
bot.say( | |
{ | |
text: 'my message_text', | |
channel: '+1(###)###-####' // a valid facebook user id or phone number | |
} | |
); |