hello
\```
world
\```
yolo
| // Utilities for express. | |
| /** | |
| * Wraps request handler and calls next() on error. | |
| * @param {Function} reqHandler express request handler. It doesn't have to return Promise. | |
| */ | |
| function asyncWrap(reqHandler) { | |
| async function handlerWrap(req, res, next) { | |
| try { | |
| // reqHandler might not return Promise. So, can't do reqHandler().catch(); |
| FROM mhart/alpine-node:12.2 as builder | |
| # Do crazy stuff | |
| FROM mhart/alpine-node:12.2 as app | |
| WORKDIR /app | |
| RUN apk add --no-cache tini | |
| # Can I use a single COPY? | |
| COPY --from=builder /app/node_modules ./node_modules | |
| COPY --from=builder /app/package*.json ./ |
| #!/bin/bash | |
| REPOS=(foo bar) | |
| git_up() { | |
| if (( $# > 0 )) | |
| then | |
| repos=$@ | |
| else | |
| repos=${REPOS[@]} |
| async (next) => { | |
| const x = await f1(); | |
| if (x) { | |
| return next(); | |
| } | |
| f2(() => { | |
| f3(); | |
| next(); | |
| }); | |
| // fails eslint consistent-return |
| ARG UID | |
| RUN usermod -u $UID www-data |
| """ | |
| # / is field access. | |
| # .get() is unwrapping value. | |
| # Invalid field access is ignored and returns None. | |
| >>> (Wrap(1) / 'a' / 0 / 'b').get() | |
| # You may specify default value in case invalid field was accessed. | |
| >>> (Wrap(1) / 'a' / 0 / 'b').get(True) | |
| True |
hello
\```
world
\```
yolo
| from typing import Optional | |
| a: Optional[str] = None | |
| def init(): | |
| global a | |
| a = 'abc' | |
| def g() -> str: # supposed to be called after calling init() | |
| return a | |
| # $ mypy a.py | |
| # a.py:8: error: Incompatible return value type (got "Optional[str]", expected "str") |
| create table task( | |
| id int primary key, | |
| status varchar(10) | |
| ); | |
| create table subtask( | |
| id int primary key, | |
| task_id int references task(id), | |
| status varchar(10) | |
| ); |
| foo: | |
| @false | |
| @echo 1 # I want this to execute |