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
| let twilioPromise = client.availablePhoneNumbers('US').local.list({ | |
| Contains: getRandomInt(10,99), | |
| areaCode: '650' | |
| }); |
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
| function getRandomInt(min, max) { | |
| // max and min numst be integers | |
| return Math.floor(Math.random() * (max - min)) + min; | |
| } |
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
| phonePromise.then(data => { | |
| let verifiedPrimes = []; | |
| data.forEach(twilioObject => { | |
| twilioObject.available_phone_numbers.forEach(e => { | |
| if (primality(e.phone_number.slice(2)) && !verifiedPrimes.includes(e.phone_number.slice(2))) { | |
| verifiedPrimes.push(e.phone_number.slice(2)); | |
| } | |
| }); | |
| }); |
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
| // An array to hold all the promises we get from Twilio API requests | |
| let promises = []; | |
| for (let i = 0; i < 20; i++) { | |
| // Make a call to the available phone numbers API for the US | |
| let twilioPromise = client.availablePhoneNumbers('US').local.list({ | |
| areaCode: '650' | |
| }); | |
| promises.push(twilioPromise); |
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
| twilioPromise.then(twilioObject => { | |
| let verifiedPrimes = []; | |
| twilioObject.available_phone_numbers.forEach(e => { | |
| if (primality(e.phone_number.slice(2)) && !verifiedPrimes.includes(e.phone_number.slice(2))) { | |
| verifiedPrimes.push(e.phone_number.slice(2)); | |
| } | |
| }); | |
| console.log(verifiedPrimes); |
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
| { available_phone_numbers: | |
| [ { friendly_name: '(650) 399-9040', | |
| phone_number: '+16503999040', | |
| lata: '722', | |
| rate_center: 'REDWOOD CY', | |
| latitude: '37.485200', | |
| longitude: '-122.236400', | |
| region: 'CA', | |
| postal_code: '94062', | |
| iso_country: 'US', |
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
| var twilio = require('twilio'); | |
| const accountSid = process.env.TWILIO_AC_SID; | |
| const authToken = process.env.TWILIO_AUTH_TOKEN; | |
| var client = require('twilio')(accountSid, authToken); | |
| // Make a call to the available phone numbers API for the US | |
| var twilioPromise = client.availablePhoneNumbers('US').local.list({ | |
| areaCode: '650' | |
| }); |
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
| <body style=""> | |
| <div id="header"> | |
| <div id="navbar" style=" | |
| position: relative; | |
| background-color: #f8f8f8; | |
| "> | |
| <img id="menu" src="icons/ic_menu_black_48dp_1x.png"> | |
| <img id="settings" src="icons/ic_settings_black_48dp_1x.png"> | |
| <div style=" |
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
| steps for AWS setup: | |
| #!/bin/bash | |
| # Simple setup.sh for configuring Ubuntu 12.04 LTS EC2 instance | |
| # for headless setup. | |
| # Install nvm: node-version manager | |
| # https://github.com/creationix/nvm | |
| sudo apt-get install -y git | |
| # sudo apt-get install -y curl #Not needed? |
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
| #!/bin/bash | |
| # Get your AWS EC2 instance set up quicky! | |
| # Simple setup.sh for configuring Ubuntu 14.04 LTS EC2 instance. | |
| # Set up locale | |
| sudo apt-get install --reinstall language-pack-en | |
| # Install git | |
| sudo apt-get install -y git |