Skip to content

Instantly share code, notes, and snippets.

@licaomeng
licaomeng / eslint-changed.sh
Created May 27, 2019 03:06 — forked from kentcdodds/eslint-changed.sh
Shell script to lint only changed files to be used as a githook (specific to my project)
#!/usr/bin/env bash
set -e
# allow being run from somewhere other than the git rootdir
gitroot=$(git rev-parse --show-cdup)
# default gitroot to . if we're already at the rootdir
gitroot=${gitroot:-.};
nm_bin=$gitroot/node_modules/.bin
@licaomeng
licaomeng / ngrok-installation.md
Created March 5, 2019 16:02 — forked from wosephjeber/ngrok-installation.md
Installing ngrok on Mac

#Installing ngrok on OSX

  1. Download ngrok
  2. Unzip it to your Applications directory
  3. Create a symlink (instructions below)

Creating a symlink to ngrok

Run the following two commands in Terminal to create the symlink.

# cd into your local bin directory
@licaomeng
licaomeng / JavaScript-Promise-Lite.js
Created May 16, 2018 13:53
JavaScript-Promise-Lite
function MyPromise(fn) {
this.resolve;
this.reject;
_this = this;
setTimeout(function () {
fn(_this.resolveFunc.bind(_this), _this.rejectFunc.bind(_this));
}, 0)
}
MyPromise.prototype = {
@licaomeng
licaomeng / JavaScript-Map.js
Created September 14, 2017 15:24
Map Utility for JavaScript
/**
* Created by lica on 6/12/2016.
*/
function Map() {
this.container = new Object();
}
Map.prototype.put = function (key, value) {
this.container[key] = value;
}