Skip to content

Instantly share code, notes, and snippets.

View freshlogic's full-sized avatar

Shawn Miller freshlogic

View GitHub Profile
var request = require('request');
var sendgrid = require('sendgrid')('YOUR sendgrid.com USERNAME', 'password');
var areaCode = 972;
var headers = { Cookie: 'YOUR www.google.com COOKIE HERE' };
var url = 'https://www.google.com/voice/setup/searchnew/?ac=' + areaCode + '&start=0&country=US';
request.get({ url: url, headers: headers }, function(error, response, body) {
var json = JSON.parse(body);
var message = 'Google Voice: There are ' + json.JSON.num_matches + ' numbers in area code ' + areaCode + ' available at this time.';
@freshlogic
freshlogic / app.js
Last active July 8, 2019 18:53
Check an area code for available Google Voice numbers and post the results to Campfire
var Campfire = require('campfire').Campfire;
var request = require('request');
var areaCode = 972;
var campfire = new Campfire({ ssl: true, token: 'YOUR CAMPFIRE API TOKEN HERE', account: 'YOUR CAMPFIRE SUBDOMAIN NAME HERE' });
var headers = { Cookie: 'YOUR www.google.com COOKIE HERE' };
var url = 'https://www.google.com/voice/setup/searchnew/?ac=' + areaCode + '&start=0&country=US';
request.get({ url: url, headers: headers }, function(error, response, body) {
var json = JSON.parse(body);
@freshlogic
freshlogic / app.js
Last active March 5, 2024 17:11
HACK: Azure doesn't support X-Forwarded-Proto so we add it manually
var express = require('express');
var app = express();
app.enable('trust proxy');
// HACK: Azure doesn't support X-Forwarded-Proto so we add it manually
app.use(function(req, res, next) {
if(req.headers['x-arr-ssl'] && !req.headers['x-forwarded-proto']) {
req.headers['x-forwarded-proto'] = 'https';
}