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 echoPostRequest = { | |
url: 'https://<my url>.auth0.com/oauth/token', | |
method: 'POST', | |
header: 'Content-Type:application/json', | |
body: { | |
mode: 'application/json', | |
raw: JSON.stringify( | |
{ | |
client_id:'<your client ID>', | |
client_secret:'<your client secret>', |
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
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/ | |
/** | |
* Fetch and log a request | |
* @param {Request} request | |
*/ |
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
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event)) | |
}) | |
/** | |
* Entry point of the worker | |
*/ | |
async function handleRequest(event) { | |
try { | |
// Get the JWT |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "chrome", | |
"request": "launch", | |
"name": "client: chrome", | |
"url": "http://localhost:3000", | |
"webRoot": "${workspaceFolder}", | |
"sourceMapPathOverrides": { |
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
// Make sure to use firebase-admin and to initialize the app | |
const admin = require('firebase-admin') | |
admin.initializeApp(functions.config().firebase) | |
// Example of how I'm GETTING all the records in a collection AND using | |
// the ID from the path of the document that triggered this function | |
exports.getLessonsAsync = functions.firestore | |
.document('organizations/{organizationId}/lessons/{lessonId}') | |
.onWrite(async function(change, context) { | |
const result = await admin |
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> | |
<system.webServer> | |
<staticContent> | |
<mimeMap fileExtension="woff" mimeType="application/font-woff" /> | |
<mimeMap fileExtension="woff2" mimeType="application/font-woff" /> | |
</staticContent> | |
<rewrite> | |
<rules> | |
<rule name="Handle History Mode and custom 404/500" stopProcessing="true"> |
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
{ | |
"IsEncrypted": false, | |
"Values": { | |
"AzureWebJobsStorage": "UseDevelopmentStorage=true", | |
"AzureWebJobsDashboard": "UseDevelopmentStorage=true", | |
"FUNCTIONS_WORKER_RUNTIME": "dotnet" | |
}, | |
"ConnectionStrings": { | |
"MyDb": "<my connection string>" | |
}, |
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
$csprojPath = $args[0] # path to the file i.e. 'C:\Users\ben\Code\csproj powershell\MySmallLibrary.csproj' | |
$newVersion = $args[1] # the build version, from VSTS build i.e. "1.1.20170323.1" | |
Write-Host "Starting process of generating new version number for the csproj" | |
$splitNumber = $newVersion.Split(".") | |
if( $splitNumber.Count -eq 4 ) | |
{ | |
$majorNumber = $splitNumber[0] | |
$minorNumber = $splitNumber[1] |
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
// NOTE: all auth code has been removed for the sake of brevity. Please see part 2 of blog series | |
// for more info: https://liftcodeplay.com/2018/10/16/pushing-my-api-to-the-edge-part-2-authentication-and-authorization/ | |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event)) | |
}) | |
const genderFemale = 'Female' | |
const genderMale = 'Male' | |
/** |
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
addEventListener('fetch', event => { | |
event.passThroughOnException() | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
const maxBizId = await MIGRATION_SETTINGS.get('maxbizid') | |
const currentBusinessId = getBusinessIdFromCookie(request) | |
if (!maxBizId || maxBizId == 0 || !currentBusinessId) { |
NewerOlder