Skip to content

Instantly share code, notes, and snippets.

View wulucxy's full-sized avatar

qingtong wulucxy

View GitHub Profile
@wulucxy
wulucxy / addListeners
Last active February 9, 2020 02:14
#javascript
/**
* 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) {
@wulucxy
wulucxy / shell 脚本
Created September 26, 2019 08:14
shell
#!/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
@wulucxy
wulucxy / config
Created September 6, 2019 08:11
sublime
package control => setting 配置 翻墙地址:
```
"channels": [
"http://cst.stu.126.net/u/json/cms/channel_v3.json"
],
```
@wulucxy
wulucxy / keypoint
Created August 5, 2019 09:36
keynote
1. 遮罩效果
https://www.youtube.com/watch?v=Zh4OoTPURBM
@wulucxy
wulucxy / 收集
Last active August 5, 2019 08:37
shell
// 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
@wulucxy
wulucxy / npm.md
Created November 6, 2018 08:21
npm

rm -rf node_modules package-lock.json && npm cache clean -f && wnpm i -d

@wulucxy
wulucxy / scu.md
Created October 10, 2018 03:31
shouldComponentUpdate #React
shouldComponentUpdate (nextProps) {
   for (let key in nextProps) {
     if (nextProps[key] !== this.props[key] && typeof nextProps[key] !== 'function') {
       return true
     }
   }
   return false
 }
@wulucxy
wulucxy / npm.md
Last active November 7, 2018 14:43
npm

首先,通过npm_package_前缀,npm 脚本可以拿到package.json里面的字段。比如,下面是一个package.json。

{ "name": "foo", "version": "1.2.5", "scripts": { "view": "node view.js" } }

@wulucxy
wulucxy / refs.md
Created July 9, 2018 01:28
组件引用 #React

组件refs如何获取到dom元素

  • innerRef
export default function LinePath ({innerRef}) {
  return (
    <g>
      <path
 ref={innerRef}
if (componentHasNoState) {
 return itsStatelessComponent()
} else if (componentHasSimplePropsState && propsHasNoNestedObjects) {
 return itsPureComponent()
} else {
 return itsComponent()
}