Skip to content

Instantly share code, notes, and snippets.

View scottrippey's full-sized avatar

Scott Rippey scottrippey

View GitHub Profile
/**
* Waits for an array of promises to finish, and returns an array of the results.
*
* If one or more Promises are rejected, throws a RejectionCollection.
*
* This is very similar to `Promise.all`, except it throws ALL errors, instead of just the FIRST error.
*
* @param {Array<Promise<T>>} promises
* @throws {RejectionCollection}
* @return {Promise<Array<T>>}
function calculatePerpendicularIntersect(centerPosition, startPosition, endPosition) {
const { x: cX, y: cY } = centerPosition;
const { x: sX, y: sY } = startPosition;
const { x: eX, y: eY } = endPosition;
const slopeStart = (cX - sX) / (cY - sY);
const slopePerp = 1 / slopeStart;
const intersectX = (slopeStart * sX - slopePerp * eX + eY - sY) / (slopeStart - slopePerp);
async function main() {
// Do the thing:
console.log(`
This script copies settings and sign-in creds from prod to dev.
It should prompt you for your system creds (twice), to access the prod creds.
`);
await copyPassword('credentials', 'InVision Studio', 'InVision Studio (Dev)');
await copyAppDataFolder('InVision Studio', 'InVision Studio (Dev)');