Skip to content

Instantly share code, notes, and snippets.

View viclm's full-sized avatar
🎮
On Red Dead Redemption 2

刘明 viclm

🎮
On Red Dead Redemption 2
View GitHub Profile
import React, { useReducer } from 'react'
import hoistNonReactStatics from 'hoist-non-react-statics'
interface Reducer {
(state, action): any
hook
host
}
function reducerx(isProvide: boolean, ...reducers: Reducer[]) {
@viclm
viclm / .vimrc
Last active December 28, 2023 02:44
" vim-plug
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" :PlugInstall :PlugUpdate :PlugClean :PlugUpgrade
let &pythonthreedll = '/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib'
call plug#begin()
Plug 'joshdick/onedark.vim'
Plug 'scrooloose/nerdtree'
Plug 'ap/vim-buftabline'
const rdot = /\.(\d*)$/
const rleadzero = /^0+/
function toIntStr(number) {
let string = number.toString()
let exponent = 0
string = string
.replace(rdot, (str, p) => {
exponent = p.length
/*
MDC on encodeURIComponent():
literal characters (regex representation): [-a-zA-Z0-9._*~'()!]
Java 1.5.0 documentation on URLEncoder:
literal characters (regex representation): [-a-zA-Z0-9._*]
the space character " " is converted into a plus sign "+".
*/
font-face(filename)
@font-face
font-family basename(filename)
src url(filename + '.woff') format('woff')
font-weight normal
font-style normal
[data-icon]::before
/* use !important to prevent issues with browser extensions that change fonts */
font-family basename(filename) !important
function proxy(context, target, assert) {
let queue = []
function send(methodName, ...methodArguments) {
const object = context[target]
if (object && eval(assert)) {
object[methodName](...methodArguments)
}
else {
queue.push({methodName, methodArguments})
(function () {
var scale = 1 / window.devicePixelRatio;
document.querySelector('meta[name=viewport]').setAttribute('content', 'width=device-width,initial-scale='+scale+',maximum-scale='+scale+',minimum-scale='+scale+',user-scalable=no');
var rangingRem = document.createElement('div');
rangingRem.style.cssText = 'width:1rem;';
document.head.appendChild(rangingRem);
var defaultFontSize = parseFloat(getComputedStyle(rangingRem).getPropertyValue('width'), 10);
document.head.removeChild(rangingRem);
var uiWidth = parseInt(document.querySelector('meta[itemprop=uw]').getAttribute('content'), 10);
document.documentElement.style.fontSize = document.documentElement.clientWidth * 100 / uiWidth / defaultFontSize * 100 + '%';
function loadScripts(assets, nostore) {
if (!('async' in document.createElement('script'))) {
assets.forEach(function (asset) {
document.write('<script src="' + asset.url + '"><\/script>');
});
return;
}
if (!nostore) {
var valid = assets.every(function (asset) {