This is a summary of and reference for a few of the various things I've worked on at Constellation.
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 fs = require("fs"); | |
const axios = require("axios"); | |
const { parse } = require("csv-parse"); | |
const Renderer = require("squirrelly"); | |
class Template { | |
constructor(template) { | |
this.template = template; | |
} |
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
#!/usr/bin/env python | |
import boto3 | |
import datetime | |
import time | |
ENABLED_REGIONS = [ | |
"us-east-1", | |
"us-west-2", | |
"eu-west-1", | |
"eu-central-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
import json | |
import itertools | |
import StringIO | |
iterencode = json.JSONEncoder().iterencode | |
class SerializableList(list): | |
""" |
We can test webhook callbacks with a little http server and a localtunnel.
Run server.js
to spin up a local http server on port 8080
. It just exposes a top-level route and will print the received header and payload of any request. Then create a localtunnel to have a non-local url that proxies all requests to localhost:8080
.
First, install dependencies with npm install
.
Then start the express server with npm start
.
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
// # Mocha Guide to Testing | |
// Objective is to explain describe(), it(), and before()/etc hooks | |
// 1. `describe()` is merely for grouping, which you can nest as deep | |
// 2. `it()` is a test case | |
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run | |
// before/after first/each it() or describe(). | |
// | |
// Which means, `before()` is run before first it()/describe() |
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
import test from 'tape'; | |
const before = test; | |
const after = test; | |
// beforeEach/afterEach rely on shared state. | |
// That's a big anti-pattern for testing. | |
// It's also silly to run something before and after | |
// ever test -- many of your tests won't need it. |
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
#!/usr/bin/python | |
''' | |
A little script for generating HMACs. | |
> ./make_hmac.py SECRET BODY | |
HMAC | |
For example ... | |
> ./make_hmac.py secret foo |
NewerOlder