This file contains hidden or 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
function handleSomeThing(ctx) { | |
return compose( | |
stepA(optionsA), | |
stepB(optionsB), | |
stepC(optionsC), | |
)(pctx => pctx.resultFoo)({ ctx }); | |
} | |
// Or somewhat more mysterious looking... | |
const handleSomeThing = compose( |
This file contains hidden or 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 PLACEHOLDER_ERROR = Symbol('placeholderError'); | |
function deferred() { | |
const d = { | |
settled: false, resolved: false, rejected: false, | |
reason: null, resolution: null, | |
}; | |
d.promise = new Promise((res, rej) => { | |
d.resolve = (r) => { | |
d.settled = true; |
This file contains hidden or 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
function repeatUntil({ interval, repeat, until }) { | |
// let callTime; | |
let isCanceled = false; | |
function cancel() { | |
isCanceled = true; | |
} | |
function conditionallyCancel() { | |
if (until()) { |
This file contains hidden or 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
function fizzbuzz(max) { | |
for (let i = 1; i <= max; ++i) | |
console.log(i, `${!(i % 3) ? 'fizz' : ''}${!(i % 5) ? 'buzz' : ''}` || '.'); | |
} | |
function fizzbuzz(max) { | |
for (let i = 1; i <= max; ++i) | |
console.log(i, ((!(i % 3) ? 'fizz' : '') + (!(i % 5) ? 'buzz' : '')) || '.'); | |
} |
This file contains hidden or 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 default function(WrappedComponent) { | |
const mixinProps = (WrappedComponent.mixins || []) | |
.filter((mixin) => mixin.props) | |
.map((mixin) => mixin.props); | |
const allProps = mixinProps.concat(WrappedComponent.props); | |
const mergedProps = allProps.reduce((merged, props) => Object.assign(merged, props), {}); | |
return { | |
props: mergedProps, | |
render(createElement) { |
This file contains hidden or 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
@function enum($keys) { | |
$index-map: (); | |
$running-index: 1; | |
@each $k in $keys { | |
@if type-of($k) == list { | |
// NOTE: We do _not_ check if this value is greater than prior values. | |
// This is intentional. | |
$running-index: nth($k, 2); | |
$k: nth($k, 1); | |
} |
This file contains hidden or 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
interface BoxA<T> { | |
a: T; | |
} | |
interface BoxB<T> { | |
b: T; | |
} | |
type BoxerA<T> = (a: T) => BoxA<T>; |
OlderNewer