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 querystring = require('querystring'); | |
var https = require('https'); | |
// Set up Mashape stuff | |
var options = { | |
host: 'ismaelc-bitly.p.mashape.com', | |
port: 443, | |
path: '/v3/shorten/', | |
method: 'POST', // Using POST instead of GET, to please post_data below | |
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
public void sendMessage(View view) { | |
EditText editText = (EditText) findViewById(R.id.edit_message); | |
String message = editText.getText().toString(); | |
new CallMashapeAsync().execute(message); | |
} | |
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
$(document).ready(function () { | |
var file = null; | |
$('#photo').photobooth().on("image", function (event, dataUrl) { | |
file = dataURLtoBlob(dataUrl); | |
var size = file.size; | |
alert("Picture size: " + size); | |
uploadImage(file); | |
$("#gallery").append('<img src="' + dataUrl + '" >'); | |
}); | |
}); |
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
{ | |
“status”: “success”, | |
“images”: [ | |
“http://lambdal.com/tiger.jpg” | |
], | |
“photos”: [ | |
{ | |
“url”: “http://lambdal.com/tiger.jpg”, | |
“width”: 600, | |
“tags”: [ |
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
{ | |
"status": "processed", | |
"topics": [ | |
{ | |
"complete": false, | |
"ts": 60.04, | |
"topics": [ | |
"phones best", | |
"best top phones", | |
"droid" |
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
"transcript": [ | |
{ | |
"w": "thanked", | |
"p": 0.087, | |
"ts": 0.02 | |
}, | |
{ | |
"w": "never", | |
"p": 1, | |
"ts": 0.67 |
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
# coding=UTF-8 | |
from __future__ import division | |
import re, urllib2 | |
from flask import Flask, request, jsonify | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello from Flask!' |
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
HttpResponse<string> jsonResponse = Unirest.get("https://yoda.p.mashape.com/yoda?sentence=You%20will%20learn%20how%20to%20speak%20like%20me%20someday.%20%20Oh%20wait."); | |
.header("X-Mashape-Authorization", "<Get your own Mashape key and paste it here>") | |
.asJson<string>(); | |
textBlock1.Text = jsonResponse.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
exports.receiveSMS = function (req, res) { | |
//TODO: Check if call is coming from Twilio | |
var message = req.body.Body; | |
var from = req.body.From; | |
var to = req.body.To; | |
... | |
} |
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
// Builds the call request so Twilio can call the user's phone with the local voice of the translation, using a text to speech API | |
exports.makeCall = function (req, res) { | |
// TODO: Check if function is called from same app | |
var translatedText = req.query.t; | |
var to = req.query.to; | |
var lang = req.query.lang; | |
// The parameters needed by Twilio to make the call. The Url parameter returns a Twiml that dictates what happens when | |
// the call is picked up. | |
var postdata = qs.stringify({ |
OlderNewer