Skip to content

Instantly share code, notes, and snippets.

View exuanbo's full-sized avatar
🎯
Focusing

Xuanbo Cheng exuanbo

🎯
Focusing
View GitHub Profile
TypeScript 26 hrs 14 mins ███████████████████▍░ 92.7%
JSON 1 hr 12 mins ▉░░░░░░░░░░░░░░░░░░░░ 4.3%
JavaScript 41 mins ▌░░░░░░░░░░░░░░░░░░░░ 2.5%
tsconfig 5 mins ░░░░░░░░░░░░░░░░░░░░░ 0.3%
GitIgno... 1 min ░░░░░░░░░░░░░░░░░░░░░ 0.1%
// ==UserScript==
// @name 托福考位查询增强
// @namespace https://github.com/exuanbo
// @version 2.0.1
// @author Exuanbo
// @description 一键查询所选地点所有时间的可预定考位
// @icon https://raw.githubusercontent.com/exuanbo/toefl-query-seats-enhance/master/src/img/icon48.png
// @updateURL https://gist.github.com/exuanbo/32ebda63925b60e7817ba0346b980d14/raw/toefl-query-seats-enhance.user.js
// @downloadURL https://gist.github.com/exuanbo/32ebda63925b60e7817ba0346b980d14/raw/toefl-query-seats-enhance.user.js
// @match https://toefl.neea.cn/myHome/*
@exuanbo
exuanbo / dummy.pdf
Last active September 20, 2022 21:40
foo bar
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// https://stackoverflow.com/a/34152244/13346012
export const hasSubArray = <T>(master: T[], sub: T[]): boolean =>
sub.every(
((index: number) => (value: T) =>
(index = master.indexOf(value, index) + 1))(0)
)
// https://stackoverflow.com/a/14810722/13346012
export const objectMap = <T, V>(
obj: T,
fn: (key: string, value: any) => [string, V]
): { [k: string]: V } =>
Object.fromEntries(Object.entries(obj).map(([k, v]) => fn(k, v)))
a {
background-image: linear-gradient(120deg, #fc0 0%, #fc0 100%);
background-position: 0 100%;
background-repeat: no-repeat;
background-size: 100% 0;
border-bottom: 2px solid #fc0;
text-decoration: none;
transition: background-size .125s ease-in;
}
export const throttle = (fn: any, timeFrame: number) => {
let lastTime = 0
return () => {
const now = Date.now()
if (now - lastTime >= timeFrame) {
fn()
lastTime = now
}
}
}
# https://stackoverflow.com/a/55445034/13346012
brew leaves | xargs brew deps --installed --for-each | sed "s/^.*:/$(tput setaf 4)&$(tput sgr0)/"
import { ESLint } from 'eslint';
declare type CLIOptions = Partial<{
[key in 'cmd' | 'version' | 'tagline' | 'bugs' | 'homepage']: string;
}>;
declare type ProvidedESLintOptions = Omit<ESLint.Options, 'cwd' | 'resolvePluginsRelativeTo'>;
interface ProvidedOptions extends CLIOptions {
[key: string]: unknown;
ESLint: typeof ESLint;
eslintOptions?: Partial<ProvidedESLintOptions>;
const excludeUndefined = <T>(item: T | undefined): item is T =>
item !== undefined
export default excludeUndefined