This file contains hidden or 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
export const availableEndpoint = | |
(handler) => async (req) => { | |
let currentUser | |
try { | |
currentUser = await authorizeUser(req) | |
} catch (e) { | |
if (e instanceof UnauthorizedError) { | |
// pass! | |
} else { | |
throw e |
This file contains hidden or 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
/** | |
* applyMiddleware takes an array of middleware functions and returns a decorator that will apply | |
* the middleware functions in reverse order around the target function. | |
* | |
* Example | |
* | |
* const handleGet = async(req) => ({ ... }) | |
* const mw1 = (next) => async (req) => await next(req) + " mw1" | |
* const mw2 = (next) => async (req) => await next(req) + " mw2" | |
* const mw3 = (next) => async (req) => await next(req) + " mw3" |
This file contains hidden or 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": "2.0", | |
"routeKey": "ANY /{proxy+}", | |
"rawPath": "/foo/bar/baz", | |
"rawQueryString": "", | |
"cookies": [ | |
"_idx=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4R0NNIn0..YNN--0oPCWn6ChdD.AXLDL_cMMBOSRppGv2xjlppy1PkdESx3bb99IlEvKrhnJaI7I6VPniFArldGWRNldz_YNo_ilEHhchOwKk3et1C5Xnqjo4WplXv7ItyK6STOisdYfnMmEgGVFP0AUqTZNMDdpvC-c8mvsQvD0VUGeKd1ATNGZFbyDA._M1PRjCs26cccaRM0omyMw" | |
], | |
"headers": { | |
"host": "localhost:3333", |
This file contains hidden or 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
#!/bin/zsh | |
# Fetch 24-hour AWS STS session token and set appropriate environment variables. | |
# See http://docs.aws.amazon.com/cli/latest/reference/sts/get-session-token.html . | |
# You must have jq installed and in your PATH https://stedolan.github.io/jq/ . | |
# Add this function to your .bashrc or save it to a file and source that file from .bashrc . | |
# Online: https://gist.github.com/hovissimo/c9119820a5a4f5a6081d93f87f1688b4 | |
# Adapted from https://gist.github.com/ddgenome/f13f15dd01fb88538dd6fac8c7e73f8c | |
# | |
# usage: aws-creds AWS_PROFILE MFA_TOKEN [OTHER_AWS_STS_GET-SESSION-TOKEN_OPTIONS...] | |
# example: aws-creds staging 123456 |
This file contains hidden or 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
## | |
# Hello hello! | |
# | |
# This is meant to be a quick (and fun?) sense-check of your Ruby! | |
# | |
# Notes: | |
# 0. How are you today? 👋 | |
# 1. Feel free to download the CSV locally, paste lines of this file into irb, or run this with `ruby requests.rb`! | |
# 2. We're loosely available to field questions on the email thread (or via [email protected]) | |
# 3. Don't overanalyze your implementation/formatting/variable names/etc. do what comes naturally to you |
OlderNewer