Skip to content

Instantly share code, notes, and snippets.

View mooyoul's full-sized avatar
👨‍💻
working from somewhere

MooYeol Prescott Lee mooyoul

👨‍💻
working from somewhere
View GitHub Profile
@mooyoul
mooyoul / nexmo-connect-demo.js
Created February 23, 2017 16:42
Nexmo connect demo
'use strict';
const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const NCCO_CONNECT = [{
"action": "stream",
"streamUrl": [`${process.env.BASE_URL}/greet.mp3`]
@mooyoul
mooyoul / ncco.json
Created February 22, 2017 19:13
Nexmo IVR Application NCCO
[
{
"action": "talk",
"text": "Welcome to a Voice API I V R. ",
"voiceName": "Amy",
"bargeIn": false
},
{
"action": "talk",
"text": "Press 1 for maybe and 2 for not sure followed by the hash key",
@mooyoul
mooyoul / nexmo-ivr-demo.js
Created February 22, 2017 18:57
nexmo-ivr-demo.js
'use strict';
const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const NCCO_INITIAL_PROMPT = [{
"action": "stream",
"streamUrl": [`${process.env.BASE_URL}/prompt.mp3`],
@mooyoul
mooyoul / store-fixed.js
Created February 19, 2017 21:12
store-fixed.js
'use strict';
const Stream = require('stream');
const request = require('request');
const AWS = require('aws-sdk');
const s3 = new AWS.S3({apiVersion: '2006-03-01', region: 'ap-northeast-2'});
// fetch binary from `url` and upload to s3 using `key` as object key
const store = (url, key) => {
@mooyoul
mooyoul / store-with-log.js
Created February 19, 2017 20:49
store-with-log.js
'use strict';
const debug = require('debug');
const request = require('request');
const AWS = require('aws-sdk');
const log = debug('store');
const s3 = new AWS.S3({apiVersion: '2006-03-01', region: 'ap-northeast-2'});
// fetch binary from `url` and upload to s3 using `key` as object key
@mooyoul
mooyoul / store-local-file-delayed-http.js
Created February 19, 2017 18:49
store-local-file-delayed-http.js
'use strict';
const http = require('http');
const fs = require('fs');
// fetch binary from `url` and upload to local file using `dest` as destination
const store = (url, dest) => {
return new Promise((resolve, reject) => {
http.get(url).on('error', (e) => {
// something went wrong during fetch avatar.
@mooyoul
mooyoul / store-local-file-delayed.js
Created February 19, 2017 18:00
store-local-file-delayed.js
'use strict';
const request = require('request');
const fs = require('fs');
// fetch binary from `url` and upload to local file using `dest` as destination
const store = (url, dest) => {
return new Promise((resolve, reject) => {
request({
method: 'GET',
@mooyoul
mooyoul / store-local-file.js
Created February 19, 2017 16:46
store-local-file.js
'use strict';
const request = require('request');
const fs = require('fs');
// fetch binary from `url` and upload to local file using `dest` as destination
const store = (url, dest) => {
return new Promise((resolve, reject) => {
request({
method: 'GET',
@mooyoul
mooyoul / store-http-request.js
Created February 17, 2017 22:25
store-http-request.js
'use strict';
const http = require('http');
const AWS = require('aws-sdk');
const s3 = new AWS.S3({apiVersion: '2006-03-01', region: 'ap-northeast-2'});
// fetch binary from `url` and upload to s3 using `key` as object key
const store = (url, key) => {
return new Promise((resolve, reject) => {
@mooyoul
mooyoul / store-file-stream.js
Created February 17, 2017 22:06
store-file-stream.js
'use strict';
const fs = require('fs');
const request = require('request');
const AWS = require('aws-sdk');
const s3 = new AWS.S3({apiVersion: '2006-03-01', region: 'ap-northeast-2'});
// fetch binary from `url` and upload to s3 using `key` as object key
const store = (path, key) => {