Skip to content

Instantly share code, notes, and snippets.

View futantan's full-sized avatar
👋
Hacking

Tantan Fu futantan

👋
Hacking
View GitHub Profile
console.log('hello world')
//import TestRail from './TestRail';
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var request = require('request');
var qs = require('querystring');
var Promise = require('bluebird');
const compose = (f, g) => (...args) => f(g(...args));
class Task {
constructor(fork) { this.fork = fork; }
static of (fork) { return new Task(fork); }
map(f) { return Task.of((rej, res) => this.fork(rej, compose(res, f))); }
chain(f) { return Task.of((rej, res) => this.fork(rej, x => f(x).fork(rej, res))); }
ap(task) { return Task.of((rej, res) => this.fork(rej, f => task.fork(rej, compose(res, f)))); }
@futantan
futantan / Maybe.ts
Created December 7, 2018 07:55
Maybe
interface IFunctor<T> {
map<U>(f: (x: T) => U): IFunctor<U>;
}
export class Maybe<T> implements IFunctor<T> {
private readonly $value: T;
static of<U>(x: U) {
return new Maybe(x);
}
@futantan
futantan / config.ts
Last active September 4, 2018 07:36
default config
type ImgUrl = string;
type Color = string;
enum PackageService {
EyesightCheck = "EyesightCheck",
GlassFrame = "GlassFrame",
GlassLens = "GlassLens",
}
interface IGlassFrameConfig {
brandName: string;
/*
* Copyright (c) 2015 Razeware LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*