Skip to content

Instantly share code, notes, and snippets.

View leihuang23's full-sized avatar
🥳

Lei Huang leihuang23

🥳
  • 11:25 (UTC +01:00)
View GitHub Profile
@leihuang23
leihuang23 / go.js
Created April 4, 2019 03:47 — forked from Gozala/go.js
Go routines for JS
// Utility function for detecting generators.
let isGenerator = x => {
return Function.isGenerator &&
Function.isGenerator.call(x)
}
// Data type represents channel into which values
// can be `put`, or `received` from. Channel is
// very much like queue where reads and writes are
// synchronized via continuation passing.
@leihuang23
leihuang23 / easing.js
Created January 15, 2019 02:48 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@leihuang23
leihuang23 / fp-either-monad.js
Created August 22, 2018 01:45 — forked from mrosata/fp-either-monad.js
Functional JavaScript Monad Classes - (Maybe Just Nothing) - (Either Left Right) (IOMonad) and my type checking utils
import is from './is-util';
/**
* Either Monad class (from Functional Programming in JavaScript)
*/
class Either {
constructor(value) {
this._value = value;
}
get value () {
@leihuang23
leihuang23 / reader_future.js
Created August 20, 2018 10:54 — forked from dypsilon/reader_future.js
Reader + Future Monads Usage
/**
* This short program will encrypt the user password
* and insert a new record into a mock database.
*/
const Reader = require('fantasy-readers');
const Future = require('fluture');
const R = require('ramda');
const crypto = require('crypto');
// our mock database
@leihuang23
leihuang23 / zshgit.md
Created June 26, 2018 06:53 — forked from AdamMarsden/zshgit.md
Oh My Zsh - Git Cheat Sheet

#Oh My Zsh - Git Cheat Sheet

ggit

gstgit status

glgit pull

gupgit pull --rebase

@leihuang23
leihuang23 / setting-up-babel-nodemon.md
Created April 23, 2018 02:10 — forked from sam-artuso/setting-up-babel-nodemon.md
Setting up Babel and nodemon

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y