Skip to content

Instantly share code, notes, and snippets.

View popo1221's full-sized avatar

Gabel(Peng Linwei) popo1221

  • @lu.com
  • Shanghai China
View GitHub Profile
@popo1221
popo1221 / create-data-hook.ts
Last active November 4, 2020 07:34
一个简易的React数据共享方式
import { useCallback, useEffect, useState } from 'react'
type ServiceType<T> = () => Promise<T>
interface ReturnType<T> {
useData: () => T
clearData: () => void
setData: (data: T) => void
}
@popo1221
popo1221 / FontIcon.ejs
Last active October 30, 2020 08:02
从iconfont网站下载字体文件,并生成组件文件
import { createFromIconfontCN } from '@ant-design/icons'
import { IconBaseProps } from '@ant-design/icons/lib/components/Icon'
// eslint-disable-next-line
type FontIconType = <%- fontIconTypes %>
interface FontIconProps extends Omit<IconBaseProps, 'type'> {
type: FontIconType
}
@popo1221
popo1221 / SimpleResponsiveGrid.tsx
Created September 7, 2020 01:46
SimpleResponsiveGrid
import React, { CSSProperties } from 'react'
import classNames from 'classnames'
import { group } from '@/utils/utils'
import { ScreenMap } from '@/utils/responsiveObserve'
import { isNumber, isNull, isString } from '@/utils/types'
import useBreakpoint from '@/components/hooks/useBreakpoint'
type PropertyType = number | string
interface Size {
@popo1221
popo1221 / index.tsx
Created September 7, 2020 01:45
ResposiveGrid
import React, { useState, CSSProperties } from 'react'
import ReactResizeDetector from 'react-resize-detector'
import classNames from 'classnames'
import { group } from '@/utils/utils'
import { ScreenMap } from '@/utils/responsiveObserve'
import { isNumber, isNull } from '@/utils/types'
import useBreakpoint from '@/components/hooks/useBreakpoint'
type PropertyType = number
@popo1221
popo1221 / PreProcessor.tsx
Created September 7, 2020 01:43
PreProcessor
import React, { ReactElement } from 'react'
import { isFunction } from '@/utils/utils'
import PageLoading from '../PageLoading'
import DefaultError from '../DefaultError'
type RenderFunction = () => React.ReactElement
type BooleanFunction = () => boolean
interface PreProcessorProps {
error?: boolean | BooleanFunction
#include <GUIConstants.au3>
Func macro_fullscreen()
; Make the active window fullscreen.
Const $GWL_STYLE = -16
Const $GWL_EXSTYLE = -16
Const $SWP_NOMOVE = 0x0002
Const $SWP_NOSIZE = 0x0001
Const $SWP_NOZORDER = 0x0004
Const $SWP_FRAMECHANGED = 0x0020
$hwnd = WinGetHandle("", "")
import java.util.ArrayList;
import java.util.List;
/**
* 坐标转换工具类
* WGS84坐标系:即地球坐标系,国际上通用的坐标系。Earth
* GCJ02坐标系:即火星坐标系,WGS84坐标系经加密后的坐标系。Mars
* BD09坐标系:即百度坐标系,GCJ02坐标系经加密后的坐标系。 Bd09
*
* **********************************
var w = $("#code").width();
var h = $("#code").height();
//要将 canvas 的宽高设置成容器宽高的 2 倍
var canvas = document.createElement("canvas");
canvas.width = w * 2;
canvas.height = h * 2;
canvas.style.width = w + "px";
canvas.style.height = h + "px";
var context = canvas.getContext("2d");
strict-ssl false
registry https://registry.npm.taobao.org
@popo1221
popo1221 / .gitconfig
Last active June 21, 2017 14:25
This is a .gitconfig I've been using for some years now and it has proven quite okay.
[user]
name = gabel
email = popo1221@outlook.com
[color]
branch = auto
diff = auto
interactive = auto
pager = true
status = auto
ui = true