Skip to content

Instantly share code, notes, and snippets.

@leontrolski
leontrolski / quickstart.ts
Last active September 29, 2021 10:07
TypeScript REST server quickstart
// Get a recent version of node installed with npm
node --version
npm --version
// Make a new directory
mkdir ts-quickstart
cd ts-quickstart
// Get everything set up
npm init
@leontrolski
leontrolski / sqlalchemy-joins.sql
Created July 20, 2021 13:31
SQLAlchemy join types
-- given tables a, b
-- equivalent SQLAlchemy models A, B
-- a has many b, joined on a_id
-- a has l non-id fields, b has m
a_id | x1 | x2 | x... | xl
b_id | a_id | y1 | y2 | y... | ym
-- let's do a joined load:
# let's imagine you didn't care about
# the `output_filename` or the `extensions`
def decorator(f):
def inner(*args, **kwargs):
f(*args, **kwargs)
save(plt)
return inner
def plot_something(foo: int, bar: int) -> None: