start new:
tmux
start new with session name:
tmux new -s myname
export default class WebStorage { | |
constructor(key, storageArea = window.localStorage) { | |
this.key = key; | |
this.storageArea = storageArea; | |
} | |
load(defaultValue) { | |
const serialized = this.storageArea.getItem(this.key); | |
return serialized === null ? defaultValue : this.deserialize(serialized); | |
} |
///<reference path="iterator.ts"/> | |
///<reference path="checks.ts"/> | |
import AbstractIterator = Iterators.AbstractIterator; | |
import Iterator = Iterators.Iterator; | |
import checkNotNull = Preconditions.checkNotNull; | |
abstract class Optional<T> { | |
static absent<T>():Optional<T> { |
# import config. | |
# You can change the default config with `make cnf="config_special.env" build` | |
cnf ?= config.env | |
include $(cnf) | |
export $(shell sed 's/=.*//' $(cnf)) | |
# import deploy config | |
# You can change the default deploy config with `make cnf="deploy_special.env" release` | |
dpl ?= deploy.env | |
include $(dpl) |
exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.
Disk Utility is unable to repair this at first, but the fix is this:
diskutil list
to find the right drive id.disk1s1
sudo fsck_exfat -d <id from above>
. eg sudo fsck_exfat -d disk1s3
-d
is debug so you'll see all your files output as they're processed.YES
if it gives you the prompt Main boot region needs to be updated. Yes/No?
namespace TypeBranding { | |
// This incurs no runtime cost. It is a purely compile-time construct. | |
type Meters = number & { __metersBrand: any }; | |
type Miles = number & { __milesBrand: any }; | |
function Meters(i: number): Meters { return i as Meters; } | |
function Miles(i: number): Miles { return i as Miles; } | |
let a: Meters; |
import * as React from 'react' | |
type DragScrollProvisions = { | |
onMouseDown: React.MouseEventHandler<HTMLElement>, | |
ref: React.Ref<HTMLElement>, | |
} | |
export type Props = { | |
children: (provisions: DragScrollProvisions) => React.ReactNode, | |
} |
This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.
Then, you can use Structlog loggers or standard logging
loggers, and they both will be processed by the Structlog pipeline (see the hello()
endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!
Requests are assigned a correlation ID with the asgi-correlation-id
middleware (either captured from incoming request or generated on the fly).
All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented.
This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog.
You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom