This file contains 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
type Ratio = [number, number] | |
type Size = {width: number, height: number} | |
type Position = {top: number, left: number} | |
type Frame = Position & {bottom: number, right: number} | |
export type Box = Frame & Size | |
export type Letterbox = Box & { bars: Box[], su: number } | |
/** | |
* Compute a letterbox and apply its measurements as CSS properties to document.body. | |
* |
This file contains 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
const deliveries = base.getTable('deliveries') | |
const subscribers = base.getTable('subscribers') | |
/** | |
* @type {deliveriesTable_Record?} | |
*/ | |
let delivery = null | |
while (!delivery) { | |
output.clear() | |
output.markdown( |
This file contains 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 Source_outputs = Symbol('Cell outputs') | |
export const Sink_inputs = Symbol('Cell inputs') | |
export const Source_willOpen = Symbol('Source will attach its first output') | |
export const Source_didClose = Symbol('Source did detach its last output') | |
export const Sink_willOpen = Symbol('Sink did attach its first input') | |
export const Sink_didClose = Symbol('Sink did detach its last input') | |
export const Sink_update = Symbol('Sink update') |
This file contains 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
/** | |
* If your database provides block transactions, (like Sequelize, | |
* here: https://sequelize.org/master/manual/transactions.html) here's how to | |
* use them in Apollo Server: | |
*/ | |
import { ApolloServerPlugin, GraphQLRequestContext } from 'apollo-server-plugin-base' | |
export interface Transactable<Txn> { | |
transact?: Transact<Txn> |
This file contains 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
const homes = [...new Set( | |
[...document.querySelectorAll('a[href]')] | |
.map(x => x.href) | |
.filter(u => u.includes('_zpid')) | |
)] | |
.map(id => { | |
const addr = id.split('/')[4].replace(/-/g, ' ') | |
const short = addr.split(' ').slice(0, -3).join(' ') | |
return { addr, zillow: id, | |
streeteasy: `https://streeteasy.com/search?search=${short}`, |
This file contains 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 BadError extends Error { | |
get type() { 'very bad' } | |
} | |
require('express')() | |
// Express will convert this synchronous throw | |
.get('/', (_req, res) => { | |
throw new BadError('threw an error: failed') | |
}) | |
// Into a pipeline error, handled here: |
This file contains 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
'use strict' | |
const webpack = require('webpack') | |
, babel = require('./babel.config') | |
, {isHot, isProd} = require('./env.config') | |
const config = env => (input, output) => ({ | |
entry: entries(env, input), | |
output, | |
devtool: 'source-map', | |
resolve: { |
This file contains 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
const Beer = () => <div> | |
<input name='$$abv' /> | |
</div> | |
const Wine = () => <div> | |
<input name='$$vintage' /> | |
<input name='$$appellation' /> | |
</div> | |
class Form extends React.Component { |
This file contains 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
/** | |
* Exports an Object like {1: 1, 7: 7, 10: 10, ...}, | |
* containing happy numbers up to 1000. | |
* | |
* This makes it easy for the test to check whether a given | |
* number is happy. | |
*/ | |
module.exports = Object.assign( | |
...[ | |
1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100, 103, 109, 129, 130, 133, 139, 167, 176, 188, 190, 192, 193, 203, 208, 219, 226, 230, 236, 239, 262, 263, 280, 291, 293, 301, 302, 310, 313, 319, 320, 326, 329, 331, 338, 356, 362, 365, 367, 368, 376, 379, 383, 386, 391, 392, 397, 404, 409, 440, 446, 464, 469, 478, 487, 490, 496, 536, 556, 563, 565, 566, 608, 617, 622, 623, 632, 635, 637, 638, 644, 649, 653, 655, 656, 665, 671, 673, 680, 683, 694, 700, 709, 716, 736, 739, 748, 761, 763, 784, 790, 793, 802, 806, 818, 820, 833, 836, 847, 860, 863, 874, 881, 888, 899, 901, 904, 907, 910, 912, 913, 921, 923, 931, 932, 937, 940, 946, 964, 970, 973, 989, 998, 1000 |
This file contains 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
node_modules |
NewerOlder