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
function interceptFuncCall(object: any, fnName: any, fnReplace: (originalObj: any, ...originalArgs: any[]) => any) { | |
const obj = new Proxy(object, { | |
get: function(target, propKey, receiver) { | |
if (propKey === fnName) { | |
return function() { | |
return fnReplace(target, ...arguments) | |
} | |
} | |
const val = Reflect.get(target, propKey, receiver) | |
return val |
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
.flex { | |
display: -webkit-box; | |
display: -moz-box; | |
display: -ms-flexbox; | |
display: -webkit-flex; | |
display: flex; | |
} | |
.flex.flex--reverse { | |
-webkit-box-orient: horizontal; |
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
async function importCompat(nodeBookModuleUrl: string) { | |
try { | |
// const { default: notebook } = await import(/*webpackIgnore: true*/ nodeBookModuleUrl) | |
// 用 eval 绕过打包逻辑 | |
return await eval(`import('${nodeBookModuleUrl}')`) | |
} catch (e) { | |
// https://github.com/guybedford/es-module-shims#shim-mode-option | |
window.esmsInitOptions = { | |
shimMode: true // default false | |
} as any |
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
;fac | |
(defn fac [n] | |
(if (zero? n) 1 | |
(* n (fac (dec n))))) | |
(defn fac-t [n acc] ; n 1 | |
(if (zero? n) acc | |
(recur (dec n) (* acc n)))) | |
(defn fac-c [n f] ; n identity |
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 d3Scale from "d3-scale" | |
import _ from "lodash"; | |
export interface MappingInfo { | |
onWindowSize: number[] | |
screenA: number[] | |
geoA: number[] | |
screenB: number[] | |
geoB: number[] | |
} |
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
module.exports = { | |
purge: ['./src/**/*.html', './src/**/*.tsx', './src/**/*.ts'], | |
darkMode: false, // or 'media' or 'class' | |
theme: { | |
// https://github.com/tailwindlabs/tailwindcss/issues/1232 | |
// using px2rem, 1rem = 100px for 1920 screen | |
fontSize: { | |
"xs": "0.12rem", | |
"sm": "0.14rem", | |
"base": "0.16rem", |
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
<!doctype html> | |
<html style="font-size: 100px"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="Cache-control" content="no-cache"> | |
<meta http-equiv="Expires" content="-1"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" /> | |
<% if (context.title != null) { %> | |
<title><%= context.title %></title> | |
<% } %> |
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
:: http://pngquant.org/ | |
@echo off | |
set path=%~d0%~p0 | |
:start | |
"%path%pngquant.exe" --force --ext .png --verbose --ordered --speed=1 --quality=50-90 %1 |
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 styled from '@emotion/styled' | |
import _ from 'lodash' | |
const DirectDict = { | |
t: [0], | |
r: [1], | |
b: [2], | |
l: [3], | |
x: [1, 3], |
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
// in: [['xxx'], ['yyy', 'zzz'], ...] | |
// out: [['xxx', 'yyy', ...], ['xxx', 'zzz', ...]] | |
function calcCombination(options) { | |
if (_.isEmpty(options)) { | |
return [[]] | |
} | |
let [firstOpt, ...rest] = options | |
let remainCombinations = calcCombination(rest) | |
return _.flatMap(remainCombinations, rc => { | |
return firstOpt.map(o1 => [o1, ...rc]) |
NewerOlder