rm -rf node_modules package-lock.json && npm cache clean -f && wnpm i -d
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
const { performance } = require('perf_hooks'); | |
var mapLoop = function(arr, callback){ | |
return arr.map(callback) | |
} | |
var forLoop = function(arr, callback){ | |
for(let i=0; i < arr.length; i++){ | |
callback(arr[i], i, arr) | |
} |
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
/** | |
* Add event listeners on an `EventEmitter` using a map of <event, listener> | |
* pairs. | |
* | |
* @param {EventEmitter} server The event emitter | |
* @param {Object.<String, Function>} map The listeners to add | |
* @return {Function} A function that will remove the added listeners when called | |
* @private | |
*/ | |
function addListeners(server, map) { |
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
#!/bin/bash | |
list=$1 | |
if [ -z $1 ]; then | |
list=('contract-node' 'contract-node-render' 'decision-fe' 'goblin-web' 'little-boy-node' 'loan-adanos' 'loan-apollo' 'loan-panama' 'mall-node' 'wups-node') | |
fi | |
for project in ${list[@]}; do | |
echo fetch $project |
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
package control => setting 配置 翻墙地址: | |
``` | |
"channels": [ | |
"http://cst.stu.126.net/u/json/cms/channel_v3.json" | |
], | |
``` |
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
1. 遮罩效果 | |
https://www.youtube.com/watch?v=Zh4OoTPURBM |
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
// js to ts | |
find src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \; | |
// code highlight | |
highlight --syntax=js --line-numbers --font-size 24 --font courier --style solarized-dark -O rtf index.js | pbcopy | |
style: solarized-dark | solarized-light | zenburn | seashell | molokai | moria | | |
// .zshrc 地址 | |
cd ~/.zshrc |
shouldComponentUpdate (nextProps) {
for (let key in nextProps) {
if (nextProps[key] !== this.props[key] && typeof nextProps[key] !== 'function') {
return true
}
}
return false
}
首先,通过npm_package_前缀,npm 脚本可以拿到package.json里面的字段。比如,下面是一个package.json。
{ "name": "foo", "version": "1.2.5", "scripts": { "view": "node view.js" } }