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 queue (operations, finished = []) { | |
| let [curr, ...rest] = operations; | |
| return !curr ? Promise.resolve(finished) : new Promise(resolve => { | |
| curr() | |
| .then(result => { | |
| resolve(queue(rest, finished.concat(result))); | |
| }) | |
| .catch(() => { | |
| resolve(queue(rest, finished)); |
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
| "use strict"; | |
| function recur (f) { | |
| return f(f); | |
| } | |
| function wrap (h) { | |
| return recur(function (f) { | |
| return h(function (n) { | |
| return f(f)(n); |
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
| $gridPadding: 7px; | |
| @define-mixin padding-double $p { | |
| &._padding-h { | |
| &:nth-child(odd) { padding: 0 $p 0 0 } | |
| &:nth-child(even) { padding: 0 0 0 $p } | |
| } | |
| &._padding-v { | |
| padding: $p 0 $p 0; |
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
| -- bar a b c = c + b - 2 * a | |
| -- foo ... = bar ... | |
| -- foo ... = ... bar ... | |
| fib :: Integer -> Integer | |
| fib n = fn n (0, 1) | |
| where | |
| fn 0 (a, b) = a | |
| fn n (a, b) = fn (n - 1) (a + b, a) |
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
| class Reduced { | |
| static isReduced(inst) { | |
| return (inst instanceof Reduced); | |
| } | |
| constructor(wrapped) { | |
| this._wrapped = wrapped; | |
| } | |
| unwrap() { |
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 Y = h => (f => f(f))(f => h(n => f(f)(n))); | |
| /* by steps */ | |
| // helpers | |
| const recur = (f) => f(f); | |
| const wrap = h => recur(f => h(n => f(f)(n))); | |
| const fact0 = (n) => n < 2 | |
| ? 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
| const invertColor = (hex: string) => [ | |
| (x: string) => parseInt(x.substring(1), 16), | |
| (x: number) => 0xFFFFFF ^ x, | |
| (x: number) => `000000${x.toString(16)}`.slice(-6), | |
| (x: string) => `#${x}`, | |
| ].reduce((acc, f: (...args: any[]) => any) => f(acc), hex); |
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
| import * as Redux from "redux"; | |
| import { MiddlewareAction } from "./redux-middleware"; | |
| export interface StateType { | |
| foo: string; | |
| bar: number; | |
| } | |
| export type ActionType | |
| = { |
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 factory() { | |
| var count = 0; | |
| return function() { | |
| function fx() { | |
| count += 1; | |
| return fx; | |
| } | |
| fx.valueOf = function() { |
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
| .root { | |
| position: relative; | |
| } | |
| .isActive { | |
| background: green; | |
| } | |
| .gender_male { | |
| border: 1px solid #00f; |