This file contains 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
atom-settings | |
plugin: sync-settings |
This file contains 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
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. Optionally, if you set this to "random" | |
# it'll load a random theme each time that oh-my-zsh is loaded. | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
ZSH_THEME="ys" |
This file contains 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
ls=dir /ONE $* | |
cd=cd /d $* | |
cnpm=npm $* --registry=https://registry.npm.taobao.org |
This file contains 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 rewire = require('react-app-rewired') | |
module.exports = function rewireEmotion (config, env) { | |
if (env === 'development') { | |
config = rewire.injectBabelPlugin(['emotion', { sourceMap: true, autoLabel: true, "labelFormat": "📦[filename]--[local]" }], config) | |
} else { | |
config = rewire.injectBabelPlugin(['emotion', { hoist: true }], config) | |
} | |
return config |
This file contains 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 express = require('express') | |
const proxy = require('http-proxy-middleware') | |
const Bundler = require('parcel-bundler') | |
const bundlerOptions = { cache: false } | |
const proxyOptions = { target: 'http://localhost:3000' } | |
const app = express() | |
const bundler = new Bundler('src/index.html', bundlerOptions) |
This file contains 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
import * as React from 'react' | |
type Args<F> = F extends (...args: infer A) => any ? A : never | |
type Parser<T> = (data: any, prevData: T) => T | |
interface AsyncState<T> { | |
/** 是否加载中 */ | |
loading: boolean | |
/** 成功数据 */ |
This file contains 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
import * as React from 'react' | |
/** | |
* 通过调用createModal函数,传入一个模态窗口组件,返回对象{ show: [Function], hide: [Function], Component: [React.Component] } | |
* | |
* @example: | |
* class App extends React.Component { | |
* modal = createModal(SomeModalComponent) | |
* | |
* render () { |
This file contains 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
import Vue from 'vue'; | |
const instance = new Vue(); | |
const eventMap = new Map(); | |
function destroyHandlers() { | |
const events = eventMap.get(this._uid) || []; | |
events.forEach((e) => { | |
instance.off(e.type, e.handler); |
This file contains 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
import { ReactElement, useContext, useRef } from 'react'; | |
import { Freeze } from 'react-freeze'; | |
import { UNSAFE_RouteContext as RouteContext } from 'react-router-dom'; | |
export default function KeepAliveOutlet() { | |
const caches = useRef<Record<string, ReactElement>>({}); | |
const matchedElement = useContext(RouteContext).outlet; // v6.3之后useOutlet会多了一层嵌套 | |
const matchedPath = matchedElement?.props?.value?.matches?.at(-1)?.pathname as string; |
This file contains 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
type EntityKey = string | number; | |
type EntityMap<T> = Record<EntityKey, T>; | |
type UpdatePayload<T> = { key: EntityKey; changes: Partial<T> }; | |
type KeySelector<T> = (item: T) => EntityKey; | |
type EntitySorter<T> = (a: T, b: T) => number; |