Skip to content

Instantly share code, notes, and snippets.

View paulsancer's full-sized avatar
🙃

Paul Devson paulsancer

🙃
View GitHub Profile
@paulsancer
paulsancer / PostmanGraphApiAutomateAccessToken.js
Last active August 20, 2020 14:11
Use this JS script to automatically set the Graph Api access token instead of manually getting a new one every time it gets expired. Just put the `{{graphApiAccessToken}}` variable into the Auth tab by selecting type `Bearer Token`.
const client_id = pm.environment.get('client_id');
const client_secret = pm.environment.get('client_secret');
const tenant_id = pm.environment.get('tenant_id');
const graphApiAccessTokenTenantId = pm.globals.get(
'graphApiAccessTokenTenantId'
);
// If tenant_id from env is different from the already existing token, drop the vars
if (tenant_id !== graphApiAccessTokenTenantId) {
/**
* Save humans, destroy zombies!
* https://www.codingame.com/ide/puzzle/code-vs-zombies
**/
const spartanSpeed = 1000;
const zombieSpeed = 400;
const killingDistance = 2000;
const speedDifferenceMultiplier = spartanSpeed / zombieSpeed;