Skip to content

Instantly share code, notes, and snippets.

View ExcitedSpider's full-sized avatar

qefeng ExcitedSpider

View GitHub Profile
@ExcitedSpider
ExcitedSpider / hello.md
Created November 27, 2018 11:40
my first gist

just see it

@ExcitedSpider
ExcitedSpider / power.md
Last active December 16, 2018 07:36
Why PowerShell?

Try:

(39+79-51)*497/28
$now=Get-Date
$day=[datetime]'12-25'
if($now -lt $day ){
## Flow语法入门
> qyfeng03
在文件中开启flow检查
```js
// @flow
```

Flow语法入门

qyfeng03

在文件中开启flow检查

// @flow
@ExcitedSpider
ExcitedSpider / polling.ts
Last active November 30, 2020 08:36
Util polling method. Use `requestIdleCallback` first. If user agent not support (e.g. safari, ie), use `setInterval` instead
const DEFAULT_POLLING_INTERVAL = 300
interface Polling {
(cb: () => void, timeout?: number): {
/** stop polling */
stopPolling: () => void
}
}
/**
@ExcitedSpider
ExcitedSpider / vue-component-capture.ts
Created December 3, 2020 07:30
capture a vue component with a callback
/**
* 可选的 组件注销时调用的回调函数
*
* 可以用来清理副作用,避免内存泄漏
*/
type HandlerCleanup = VoidFunction
/**
* 组件捕获后执行的回调函数
*/
@ExcitedSpider
ExcitedSpider / rollup-plugin-file-path.js
Created December 21, 2020 08:27
Get the path of local file. Load any type of file.
const { createFilter } = require("@rollup/pluginutils");
const pathTemplate =(path)=> `
var path = ${path};
export default path;
`
module.exports = function filePath(
options = {
include: ["**/*.ejs"],
@ExcitedSpider
ExcitedSpider / debounce.ts
Created February 20, 2021 06:17
simple debounce & throttle
export const debounce: <T extends []>(fn: (...args: T) => void, wait: number) => (...args: T) => void = (fn, wait) => {
let timeout = -1;
return (...args) => {
if (timeout !== -1) clearTimeout(timeout);
timeout = setTimeout(() => {
fn(...args);
}, wait);
};
};
@ExcitedSpider
ExcitedSpider / camelCase.js
Created February 22, 2021 06:11 — forked from johnsmith17th/camelCase.js
To convert string to camel case in javascript.
function toCamelCase(str) {
return str.toLowerCase().replace(/(?:(^.)|(\s+.))/g, function(match) {
return match.charAt(match.length-1).toUpperCase();
});
}
@ExcitedSpider
ExcitedSpider / use-echarts.ts
Created August 2, 2021 06:34
simple hooks to use echarts
export interface UseEchartsOptions {
/**
* render root
*/
renderRootRef: React.RefObject<HTMLDivElement | HTMLCanvasElement>;
/**
* `setOption` 1st param object
*/
echartsOption: EChartOption;
/**