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 |
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
{ | |
"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
/** | |
* 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
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
customElements.define('my-span', | |
class extends HTMLElement { | |
constructor() { | |
super(); | |
// '<span><slot>default text</slot></span>' | |
const span = document.createElement('span') | |
const slot = document.createElement('slot') | |
slot.appendChild(document.createTextNode('default text')) | |
span.appendChild(slot) |
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
[ | |
{ | |
"id": "211d2ade5b37281c", | |
"type": "function", | |
"z": "0d3a28192a31e0f9", | |
"name": "mod router", | |
"func": "const count = context.get('count') ?? 0;\n\nif (count < 5) {\n context.set('count', count + 1);\n return [msg, undefined];\n} else {\n context.set('count', 0);\n return [undefined, msg];\n}", | |
"outputs": 2, | |
"noerr": 0, | |
"initialize": "// Code added here will be run once\n// whenever the node is started.\ncontext.set('count', 0)", |
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 | |
# Redirect output to stderr. | |
exec 1>&2 | |
# join_by from https://stackoverflow.com/questions/1527049/how-can-i-join-elements-of-an-array-in-bash | |
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; } | |
# pattern is just all of these strings smushed into a big regex pattern | |
booboos=( |
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
class Truck: | |
def __init__(self, num_wheels, max_load_per_wheel): | |
self.num_wheels = num_wheels | |
self.max_load_per_wheel = max_load_per_wheel | |
self.cargo = [] | |
def max_load(self): | |
return self.max_load_per_wheel * self.num_wheels | |
def describe_cargo(self): |
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
0eNqtXNtu20gM/ZWFnq2FOHflsb+xKBZOrA2EtWVBkosGhf99ZQerpImV4SH91Lq2ecgzh5yhzOmv4nF/avqh7abi4Vcxdtu+nI7l89DuLq9/Fg+h2hQvxUM6b4r26diNxcNf8+fa5267v3xieumb4qFop+ZQbIpue7i8emy280eLy1e6XTMbofMm+6Vm3zxNQ/tU/nMauu1T8+7rhvP1n/3QjGM5Ddtu7I/DVD42++mdEcswcmh27elQLq70x/17P9z5+6Zouqmd2uaViOuLl7+70+GxGeY4v7a0KfrjOH955uaV3NL4P/2V33L+y/ni4QeLZrE4Hrb7fbnfHvpbdlzGjkU9ozpj0fE8o5Sx42HPbMZiYHpmMnYi6lnMGEw8x0LGTA0zljFIFc+xKmcH1X9OtcSTfy6JCFU/ZSPlqZ+yzKPqp5w4iKd+ymmVUPWbXDoRT/4ml95Uf9xobtTDJbzZq0sBn8v8eN3h+qbZlYfj7rRvSnvZWm4V3YqB4FQIxEAgFYLJI7zVZhGCZSB4FYJjIBgVgs8j1CqAkAcIKoCYB7AqgJQHqFQA+XxWrbHNZ7NKpTafy6o8s/lMJlWpsPlEJlW1s/k8JlXBtvk0NiqN2nwaG1WW2XwaG1WdsO9232n79G/ZdmMzTPNbX+081RVp1w7z1n/9gLllugZM/5/Knyy7Wz1G9am/O82t2PA8HOc/Xzu8LzBuuL9ZGr+uP13aw8+YtN6SftEmVb+vST/MyzGD/phN55bGGT5/S57w+LMS/t5y8Qv+jqdpjUAHhOMhpTkviieo9BAgPdg76CGKoiTdqgH1YYHiiRAoDzUkBy8qD2/NnUQOHioPUa8GD1QHj6yLFxUHr1KZB2qDxbQgKg12jTCOEkLu4eNnPLeKdwsgygFKngQSVNvuIGZ+LagQLYcKpqqC5BVIIC/SFJrAz3uDhSLJe6NIlOAU3InKTPCArp1e1iGw1ypAspacBIKqQgf+OSBhsqsFsURNBkXJ8SAphB5JEaJotaIBhE6 |
NewerOlder