2018-W18
- ???
- tacos
- tagliatelles, truite fumée et brocoli
2018-W17
| const makeAsyncGenerator = require('./make-async-generator') | |
| const f = makeAsyncGenerator(function * () { | |
| yield 'foo' | |
| const value = yield Promise.resolve('bar') // yield promises to await them | |
| yield value | |
| try { | |
| yield Promise.reject('baz') | |
| } catch (value) { | |
| yield value |
| on_exit_commands='' | |
| on_exit () { | |
| on_exit_commands="$1; $on_exit_commands" | |
| } | |
| trap 'eval "$on_exit_commands"' EXIT | |
| text='foo bar' | |
| on_exit 'echo "$text"' | |
| on_exit 'echo baz' |
| // Composable, lazy task operation constructor | |
| class Async { | |
| constructor(resolver) { | |
| this._resolver = resolver | |
| } | |
| then(onFulfilment, onRejection) { | |
| return new SyncAsyncPromise(this._resolver).then(onFulfilment, onRejection) | |
| } |
| // https://gist.github.com/yelouafi/556e5159e869952335e01f6b473c4ec1 | |
| class Failure { | |
| constructor (pos, expected) { | |
| this.expected = expected | |
| this.pos = pos | |
| } | |
| get value () { | |
| throw new Error( |
| # choice prompt choice... | |
| choice() { | |
| local answer i | |
| echo "$1" | |
| shift | |
| i=1 | |
| for choice | |
| do |
| import classNames from 'classnames' | |
| import isEmpty from 'lodash/isEmpty' | |
| import PropTypes from 'prop-types' | |
| import React from 'react' | |
| import ReactSelect from 'react-select' | |
| import uncontrollableInput from 'uncontrollable-input' | |
| import { | |
| AutoSizer, | |
| CellMeasurer, | |
| CellMeasurerCache, |
| # run_parallel <n> <command> <args> | |
| run_parallel() ( | |
| local fifo i n cmd arg x | |
| # Create queue | |
| fifo=$(mktemp -u) | |
| mkfifo "$fifo" | |
| exec 179<> "$fifo" | |
| rm -f "$fifo" |
| const { basename, resolve } = require('path') | |
| const { createWriteStream, existsSync } = require('fs') | |
| const { get } = require('https') | |
| const { parse } = require('url') | |
| require(resolve(process.argv[2])).forEach(url => { | |
| const base = basename(parse(url).pathname) | |
| if (existsSync(base)) { | |
| return | |
| } | |
| get(url, res => { |
| _ansi_mode() { | |
| printf '\033[%sm' "$1" | |
| } | |
| _style() { | |
| local arg | |
| if [ $# -eq 0 ] | |
| then | |
| set -- reset |