Skip to content

Instantly share code, notes, and snippets.

View wjx0820's full-sized avatar
🎯
Focusing

wjx0820 wjx0820

🎯
Focusing
  • Guangzhou, China
View GitHub Profile
{
"extends": ["eslint:recommended", "prettier", "prettier/react"],
"plugins": [],
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
@wjx0820
wjx0820 / .gitignore
Created June 18, 2019 12:16
gitignore
node_modules/
.DS_Store
.cache/
dist/
coverage/
.vscode/
.env
@wjx0820
wjx0820 / mkdir.js
Last active August 4, 2019 00:41
mkdir命令行工具
const argv = require('minimist')(process.argv.slice(2));
const fse = require('fs-extra');
const { p, s } = argv;
if (!p|| !s) {
console.info('-p: problem number');
console.info('-s: solution name');
console.error('Please enter problem number and solution name.');
process.exit(-1);
@wjx0820
wjx0820 / deepClone.js
Last active January 3, 2022 20:34
深拷贝 deepClone
// 通过 typeof 来查看每种数据类型的描述
// [undefined, null, true, '', 0, Symbol(), {}].map(it => typeof it)
// ["undefined", "object", "boolean", "string", "number", "symbol", "object"]
function clone(obj) {
// 添加一个 WeakMap 来记录已经拷贝过的对象,如果当前对象已经被拷贝过,那么直接从 WeakMap 中取出,否则重新创建一个对象并加入 WeakMap 中
// ES6 推出的 WeakMap 对象,该对象是一组键/值对的集合,其中的键是弱引用的。其键必须是对象,而值可以是任意的
let map = new WeakMap();
function deep(data) {
@wjx0820
wjx0820 / App.tsx
Last active August 3, 2020 11:56
使用React.PropsWithChildren或者 React.FC给带 children props 的组件 定义类型
// App.tsx
import { Button } from "./components/Button"
function App() {
return (
<div className="App">
<Button
onClick={(e) => {
e.preventDefault()
@wjx0820
wjx0820 / 📊 Weekly development breakdown
Last active April 6, 2022 01:48
📊 Weekly development breakdown
TypeScript 1 hr 2 mins ████████▉░░░░░░░░░░░░ 42.5%
Other 27 mins ████░░░░░░░░░░░░░░░░░ 19.1%
HTML 15 mins ██▏░░░░░░░░░░░░░░░░░░ 10.3%
Bash 14 mins ██░░░░░░░░░░░░░░░░░░░ 9.7%
Git Config 12 mins █▋░░░░░░░░░░░░░░░░░░░ 8.2%