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 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'; | |
} |
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 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); |
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 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.'; |
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 redis = require('redis'); | |
function Cache(port, host, options) { | |
this.client = redis.createClient(port, host, options); | |
}; | |
// Returns data from cache if available; | |
// otherwise executes the specified function and places the results in cache before returning the data. | |
Cache.prototype.fetch = function(key, func, options, callback) { | |
// Options are optional |
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
function(game, team1, team2) { | |
var percentages = { | |
round5: { 1: 100, 2: 94, 3: 85, 4: 78, 5: 68, 6: 66, 7: 60, 8: 48, 9: 52, 10: 40, 11: 34, 12: 35, 13: 22, 14: 15, 15: 6, 16: 0 }, | |
round4: { 1: 87, 2: 69, 3: 61, 4: 56, 5: 52, 6: 51, 7: 27, 8: 18, 9: 8, 10: 46, 11: 38, 12: 49, 13: 24, 14: 12, 15: 14, 16: 0 }, | |
round3: { 1: 79, 2: 72, 3: 50, 4: 35, 5: 21, 6: 33, 7: 37, 8: 70, 9: 40, 10: 33, 11: 33, 12: 5, 13: 0, 14: 0, 15: 0, 16: 0 }, | |
round2: { 1: 59, 2: 46, 3: 47, 4: 72, 5: 75, 6: 23, 7: 0, 8: 57, 9: 50, 10: 0, 11: 60, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0 }, | |
round1: { 1: 57, 2: 48, 3: 64, 4: 23, 5: 50, 6: 67, 7: 0, 8: 50, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0 }, | |
round0: { 1: 67, 2: 33, 3: 44, 4: 33, 5: 0, 6: 50, 7: 0, 8: 50, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0 } | |
}; |
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
@echo on | |
cd /d "%~dp0" | |
if "%EMULATED%"=="true" if DEFINED APPCMD goto emulator_setup | |
if "%EMULATED%"== "true" exit /b 0 | |
echo Granting permissions for Network Service to the web root directory... | |
icacls ..\ /grant "Network Service":(OI)(CI)W | |
if %ERRORLEVEL% neq 0 goto error |
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<appSettings> | |
</appSettings> | |
<system.web> | |
<customErrors mode="off" /> | |
<httpRuntime maxQueryStringLength="2097151" maxUrlLength="2097151" /> | |
</system.web> | |
<system.webServer> | |
<modules runAllManagedModulesForAllRequests="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
exports.xForwardedFor = function(req, res, next) { | |
if (!req.headers['x-forwarded-for']) { | |
if (req.headers['x-iis-node-remote_addr']) { | |
req.headers['x-forwarded-for'] = req.headers['x-iis-node-remote_addr']; | |
} | |
} | |
next(); | |
}; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ServiceConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" serviceName="serviceName" osFamily="4" osVersion="*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"> | |
<Role name="WebRole"> | |
<ConfigurationSettings /> | |
<Instances count="2" /> | |
</Role> | |
<NetworkConfiguration> | |
<VirtualNetworkSite name="VirtualNetwork" /> | |
<AddressAssignments> | |
<InstanceAddress roleName="WebRole"> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ServiceDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="example-com" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"> | |
<WebRole name="WebRole" vmsize="Small"> | |
<Certificates> | |
<Certificate name="example-com" storeLocation="LocalMachine" storeName="CA" /> | |
</Certificates> | |
<Imports /> | |
<Startup> | |
<Task commandLine="setup_web.cmd > log.txt" executionContext="elevated"> | |
<Environment> |
OlderNewer