Skip to content

Instantly share code, notes, and snippets.

View hilleer's full-sized avatar

Daniel Hillmann hilleer

View GitHub Profile
@hilleer
hilleer / addNewSecret.js
Last active May 22, 2021 11:19
Fuck up story; rotating Heroku app serets using their CLI tool
View addNewSecret.js
const childProcess = require('child_process');
const { promisify } = require('util');
const exec = promisify(childProcess.exec);
const DRY_RUN = true; // set to false when you want to execute it
const { NEW_SECRET } = process.env; // do not end up committing the new secret :-)
(async () => {
const { stdout: apps } = await exec('heroku apps -A --json');
@hilleer
hilleer / index.js
Last active October 7, 2020 14:07
Express middleware
View index.js
const express = require('express');
const createHttpError = require('http-errors');
const app = express();
app.get('/foo',
middlewareOne,
middlewareTwo,
fooHandler
);
@hilleer
hilleer / afdeling.js
Created April 23, 2020 10:43
Express example
View afdeling.js
module.exports = () => {
return { afdeling: true };
}
@hilleer
hilleer / index.ts
Last active April 6, 2020 09:13
Typescript dynamic typeof object key with type definitions for key values example
View index.ts
const GAMES = Object.freeze({
CSGO: {
skillLevel: 'good'
},
WOW: {
skillLevel: 'average'
}
});
type GameKey = keyof typeof GAMES;