Skip to content

Instantly share code, notes, and snippets.

View hookex's full-sized avatar
Focusing

hooke hookex

Focusing
View GitHub Profile
@hookex
hookex / note
Created January 29, 2021 03:52
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@hookex
hookex / ip
Last active January 25, 2021 13:22
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
import {now} from "../utils/date";
import assert from "../utils/assert";
export interface TimeRanges {
start: number,
end: number,
}
export interface PlaybackControlProps {
mode?: PlaybackControlMode, // 录播 or 直播
@hookex
hookex / cmd.txt
Last active July 31, 2020 06:05
mac
git open
sudo npm i -g git-open
ncu
sudo npm i -g npm-check-updates
nrm
sudo npm i -g nrm
brew
export function useForceUpdate() {
const [, f] = useState(false)
const forceUpdate = useCallback(() => f(v => !v), [])
return forceUpdate
}
const useForceUpdate = () => useState()[1];
# package.json specifics
> https://www.npmjs.cn/files/package.json/
## files
Entries to be inclued of your package
#### priority
*files* > .npmignore > .gitignore
## main、module、browser

PKG NAME

semantic-release Conventional Commits

Demo

Demo Link

Tech Stack

npx create-react-app application --template typescript --use-npm
# template
https://github.com/microsoft/TypeScript-React-Starter
# tsx
https://www.typescriptlang.org/docs/handbook/react-&-webpack.html
@hookex
hookex / performance.md
Last active April 22, 2020 12:04
性能优化

典型场景下,有一些典型的解决方案,这些凭借经验就能猜个八九不离十。 但是性能优化其实是很灵活的,它几乎无处不在。

三个维度

加载

指标:1000ms

交互

指标:100ms

@hookex
hookex / inherit.ts
Created April 20, 2020 06:45
JS继承的6种写法
{
/**
* 1. 原型链继承
*/
function SuperType() {
this.property = true;
}
SuperType.prototype.getSuperValue = function() {
return this.property;