- rev
- env
- MacBook Pro (Retina, 15-inch, Mid 2014), 2.8 GHz Intel Core i7, 16 GB 1600 MHz DDR3
- OSX 10.11.6
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 Octokit = require('@octokit/rest') | |
const clientWithAuth = new Octokit({ | |
auth: 'token <blahblahblah>' | |
}); | |
class LabelDef { | |
constructor(name, color, description) { | |
this.name = name; |
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
/** | |
* This provides extensions for ECMA262 2015's iterator. | |
* | |
* This adds `map()`, `forEach()`, `filter()`, `flatMap()`, or others | |
* to `Iterable<T>`. This enables features looks like "lazy evaluation". | |
* The design refers RxJS v5's one. | |
* | |
* See example: | |
* ``` | |
* |
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
import {Option} from 'option-t'; | |
import {Observable} from 'rx'; | |
type FilterMapFn<T, U> = (v: T) => Option<U>; | |
function filterMapForObservable<T, U>(source: Observable<T>, op: FilterMapFn<T, U>): Observable<U> { | |
const filtered = source.flatMap(function(v: T): Observable<U> { | |
const mapped: Option<U> = op(v); | |
const result: Observable<U> = | |
mapped.mapOrElse(function def(): Observable<U> { |
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
/** | |
* This type is based on https://doc.rust-lang.org/std/result/enum.Result.html | |
*/ | |
import {Option, Some, None} from 'option-t'; | |
type mapFn<T, U> = (v: T) => U; | |
type flatmapOkFn<T, U, E> = (v: T) => Result<U, E>; | |
type flatmapErrFn<T, E, F> = (e: E) => Result<T, F>; | |
type recoveryFn<E, T> = (e: E) => T; |
RxJSの実装が長らく気になっていた。動機としては、来月の歌舞伎座.tech#7「Reactive Extensions」の予習の意味合いもあるが、個人的な興味が一番。コードベースはRxJS 2.4.6@089dca5。ロジックとしては結構ややこしいので、この記事も間違いがあるかもしれない点に注意。
本当にただの感想。
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 interface Context { | |
onActivate(mountpoint: Element): void; | |
onDestroy(mountpoint: Element): void; | |
onSuspend(mountpoint: Element): void; | |
onResume(mountpoint: Element): void; | |
} | |
export class ContextStack { | |
private _mountPoint: Element; | |
private _stack: Array<Context>; |
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
module option { | |
// This interface is based on Rust's `core::option::Option<T>`/ | |
class Option<T> { | |
private _val: T; | |
private _is_some: boolean; | |
constructor(val?: T) { | |
this._val = val; | |
this._is_some = (val !== undefined); |
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
var crossroads = require("crossroads"); | |
var Dispatcher = require("flux").Dispatcher; | |
var EventEmitter = require("events").EventEmitter; | |
var hasher = require("hasher"); | |
var RoutingActionCreator = { | |
/** | |
* @param {string} path | |
*/ |
NewerOlder