title: "First day with APItools (at BattleHack)" description: "This weekend I attended BattleHack hackathon in San Francisco and I thought I could give APItools a try. Here are some thoughts and feedback about using APItools in hackathon conditions." layout: blog author: Nicolas gh-author: picsoung date: 2014-04-02 categories: blog tags: hackathons CORS
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
Afghanistan | |
Afrique du Sud | |
Albanie | |
Algérie | |
Allemagne | |
Andorre | |
Angola | |
Anguilla | |
Antarctique | |
Antigua-et-Barbuda |
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
{ | |
"form_id": "3a1130ad-b534-4893-87e9-e9695765ec29", | |
"organization_id": "3c4c165b-0727-4615-960f-8b1f593915ca", | |
"title": "Logic VA", | |
"requires_contact_info": false, | |
"requires_contact_email": false, | |
"requires_contact_name": false, | |
"requires_contact_phone_number": false, | |
"requires_consent": false, | |
"show_contact_name": false, |
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
//Replace with yours | |
let TYPEFORM_URL = "https://picsoung.typeform.com/to/QXS2h1?utm_source=cf_workers" | |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
let response = await fetch(TYPEFORM_URL) |
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
{ | |
"choices": [ | |
{ | |
"label": "San Francisco", | |
"slug": "san-francisco", | |
"image":"https://d13k13wj6adfdf.cloudfront.net/urban_areas/san-francisco-bay-area-7f6d130d20.jpg" | |
}, | |
{ | |
"label": "Barcelona", | |
"slug": "barcelona", |
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
cont fs = require('fs'); | |
let wav = new WaveFile(fs.readFileSync(`hello_${username}.wav`)); | |
let wav64 = wav.toBase64() | |
axios({ | |
method: 'POST', | |
url: `http://${ROBOT_IP}/api/audio`, | |
data:{ | |
FileName: `hello_${username}.wav`, | |
Data: wav64, |
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
const { form_response } = req.body | |
const {answers} = form_response | |
let arm_field = answers.find((a) => a.field.ref === 'arm_choice') | |
let selected_arm = arm_field.choice.label | |
let username_field = answers.find((a) => a.field.ref === 'username') | |
let username = username_field.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
const { form_response } = req.body | |
const {answers} = form_response | |
let arm_field = answers.find((a) => a.field.ref === 'arm_choice') | |
let selected_arm = arm_field.choice.label | |
let username_field = answers.find((a) => a.field.ref === 'username') | |
let username = username_field.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
const express = require('express') | |
const app = express() | |
const port = 3000 | |
const axios = require('axios') | |
const bodyParser = require('body-parser') | |
// parse application/x-www-form-urlencoded | |
app.use(bodyParser.urlencoded({ extended: false })) |
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
const express = require('express') | |
const app = express() | |
const axios = require('axios') | |
const bodyParser = require('body-parser') | |
const say = require('say') | |
const FormData = require('form-data') | |
var fs = require('fs'); | |
const WaveFile = require('wavefile'); |