Skip to content

Instantly share code, notes, and snippets.

View ifyour's full-sized avatar
🏁
问题解决师

明明 ifyour

🏁
问题解决师
View GitHub Profile
@ifyour
ifyour / base.yaml
Last active September 3, 2024 10:55
Clash 自定义规则,适用于 Subconverter 的订阅服务。
mode: rule
log-level: info
dns:
enable: true
ipv6: false
# 启动服务器,用于解析提供的 nameserver,只能用 IP
# default-nameserver:
# - 223.5.5.5
# - 119.29.29.29
enhanced-mode: fake-ip
export interface ConstructorOptions {
api: string;
key: string;
}
export default class JSONBin {
private api: string;
private key: string;
constructor(options: ConstructorOptions) {
function fromRecords<T>(items: T[], key: keyof T, value: keyof T) {
return Object.fromEntries(items.map(({ [key]: k, [value]: v }) => [k, v]))
}
const users = [
{ id: 'id1', name: 'Alice', email: '[email protected]' },
{ id: 'id2', name: 'Bob', email: '[email protected]' },
]
const userMap = fromRecords(users, 'id', 'name')
import React from 'react';
export function makeStore({actions}) {
// Make a context for the store
const context = React.createContext();
// Make a provider that takes an initialValue
const Provider = ({initialValue = {}, children}) => {
// Make a new state instance
const [state, setState] = React.useState(initialValue);
*://blog.csdn.net/*
@ifyour
ifyour / settings.json
Last active November 22, 2021 02:04
手动保存 VSCode 配置文件
{
"workbench.startupEditor": "none",
"editor.fontSize": 13.5,
"editor.fontFamily": "Victor Mono",
"editor.fontLigatures": true,
"editor.lineHeight": 24,
"editor.tabSize": 2,
"git.confirmSync": false,
"editor.guides.bracketPairs": false,
"git.autofetch": true,
// 检测给定字符串是否正确嵌套
// Determine whether a given string of parentheses (multiple types) is properly nested.
function solution(text) {
var openBrackets = ['(', '[', '<', '{'];
var closedBrackets = [')', ']', '>', '}'];
var requiredClosedBrackets = [];
var chars = text.split('');
for (var i = 0; i < chars.length; i++) {
@ifyour
ifyour / aria2.conf
Last active December 3, 2023 16:36
Aria2c Configuration Best Practices
## Disk Settings ##
dir = ${HOME}/Downloads
daemon = false
enable-mmap = true
disk-cache = 64M
file-allocation = none
## Download Settings ##
continue = true
split = 16
@ifyour
ifyour / json.d.ts
Created January 11, 2021 04:22
JSON 操作不丢失类型
declare class Stringified<T> extends String {
private ___stringified: T
}
interface JSON {
stringify<T>(
value: T,
replacer?: (key: string, value: any) => any,
space?: string | number
): string & Stringified<T>
@ifyour
ifyour / crud_xlsx.html
Last active December 4, 2020 06:10
xlsx crud
<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/xlsx.full.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jszip.min.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/preact/standalone.umd.min.js"></script> -->