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
// Returns the Twiml that instructs Twilio to play an audio file from a text to voice API | |
exports.getTwimlToCall = function (req, res) { | |
var translatedText = req.query.t; | |
var lang = req.query.lang; | |
// Call the text to voice API that can handle local voices | |
request({ | |
url: 'https://yambal-text-to-voice.p.mashape.com/url?lang=' + lang + '&text=' + translatedText, | |
method: 'GET', | |
headers: { |
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
unirest.post('http://httpbin.org/post') | |
.headers({ 'Accept': 'application/json' }) | |
.send({ "parameter": 23, "foo": "bar" }) | |
.end(function (response) { | |
console.log(response.body); | |
}); |
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
var unirest = require('unirest'), | |
Firebase= require('firebase'), | |
config = require('./config'); | |
var myRootRef = new Firebase(config.firebase.hostname); | |
// Method below is POSTed to by Sendgrid's Inbound Parse API (Webhooks) - http://bit.ly/11h7K2P | |
// 1. Accepts 'subject' and 'text' | |
// 2. Calls a Mashape text-to-speech API on 'subject' | |
// 3. Pushes resulting mp3 to Firebase to initiate hook to play mp3 from index.html |
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
var myDataRef = new Firebase('https://<your Firebase name>.firebaseio.com/'); | |
myDataRef.on('child_added', function(snapshot) { | |
audio.src = "data:audio/mp3;base64," + $.base64.encode(snapshot.val().voice); | |
audio.play(); | |
$("#subject").text(snapshot.val().subj); | |
$("#text").text(snapshot.val().text); | |
}); |
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> | |
<head> | |
<title>My Parse App</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.2.12.min.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> |
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
// Cloud Code 'yodaSpeakFunction' | |
// Import Cloud Module from /cloud folder | |
// Initialize Cloud Code with your Mashape key (http://mashape.com/keys) | |
var yodaClient = require('cloud/yoda-1.0.0.js'); | |
yodaClient.initialize('<Enter your Mashape key here>'); | |
Parse.Cloud.define("yodaSpeakFunction", function(request, response) { | |
// Call 'yodaSpeak' Cloud Module passing in 'sentence' parameter |
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
// Cloud Module yoda-1.0.0.js | |
// Set url of Mashape API to call | |
var url = 'https://yoda.p.mashape.com/yoda'; | |
var key = ''; | |
module.exports = { | |
// Method to initialize module | |
initialize: function(mashapeKey) { |
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
var result = await Unirest.get("https://mashape.p.mashape.com/apis") | |
.header("X-Mashape-Authorization", "MyApiKey") | |
.asJsonAsync<ApisResult>(); |
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
var Request = unirest.get("https://bbyopen-bbyopen.p.mashape.com/products?apiKey=<insert Best Buy API key here>") | |
.headers({ | |
"X-Mashape-Authorization": "<insert Mashape key here>" | |
}) | |
.end(function (response) { | |
console.log(response); | |
}); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<quotes> | |
<quote> | |
<symbol>AAPL</symbol> | |
<trade_date>2013-10-17T15:45:06-04:00</trade_date> | |
<bid_date>2013-10-17T15:45:05-04:00</bid_date> | |
<ask_date>2013-10-17T15:45:05-04:00</ask_date> | |
<open>499.98</open> | |
<high>504.78</high> | |
<low>499.68</low> |