###sfsfsf
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
# first: | |
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
# go to /usr/local/lib and delete any node and node_modules | |
cd /usr/local/lib | |
sudo rm -rf node* |
###sfsfsf
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 isThenable(obj){ | |
if(obj && typeof obj.then === 'function'){ | |
return true; | |
} | |
return false; | |
} | |
function ChainedPromise(promise, rv, rj){ | |
this.success = [rv]; | |
this.fail = [rj]; | |
this.promise = promise; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>progressCanvas</title> | |
<meta charset="utf-8" /> | |
<link rel="stylesheet" href="./bootstrap.min.css" /> | |
<link rel="stylesheet" href="./bower_components/dragula.js/dist/dragula.css" /> | |
<style> | |
.compList{height:360px;border: 1px solid green;} | |
.compType{border:1px solid black;margin:10px;list-style: none;} |
理解 redux 的middleware 中间件 机制: https://redux.js.org/advanced/middleware
假如对 store.dispatch 函数,做一些调整,比如 log、errorCatch 的事情,通常我们会想到 monkey-patch:
function addLog(store){
var next = store.dispatch;
store.dispatch = function(action){
console.log('action before');
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="expires" content="0" />
<meta name="renderer" content="webkit"/>
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
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
// https://pawelgrzybek.com/page-scroll-in-vanilla-javascript/ | |
function scrollIt(destination, duration = 200, easing = 'linear', callback) { | |
const easings = { | |
linear(t) { | |
return t; | |
}, | |
easeInQuad(t) { | |
return t * t; |
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
npm publish 发布 npm 包 | |
1. 默认情况下,不存在 .npmignore,npm 会依据 .gitignore 来选择过滤上传的文件; | |
2. 如果存在 .npmignore (即便是空白的),则 不再使用 .gitignore; | |
3. package.json 里面的 files 字段,拥有较高权重,控制打包的文件。 | |
默认被排除在外的文件: | |
.*.swp | |
._* | |
.DS_Store | |
.git |
Depth-First Traversal
function clone(src){
var dest = src;
if(!src) {
return dest;
} else {
if(typeof src === 'object') {
if(Array.isArray(src)) {
dest = []
OlderNewer