Skip to content

Instantly share code, notes, and snippets.

@Fog3211
Fog3211 / URL Schemes.md
Created September 27, 2024 10:38 — forked from zhuziyi1989/URL Schemes.md
常用 URL Schemes 收集。

** 由于此文年事已久,可能某些URL Schemes已失效,可在评论区留言指出!(最后更新于 2024.4.16)

关于 URL Scheme 你知道多少?

iOS系统中

由于苹果的各应用都是在沙盒中,不能够互相之间访问或共享数据。但是苹果还是给出了一个可以在APP之间跳转的方法:URL Scheme。简单的说,URL Scheme就是一个可以让 APP 相互之间可以跳转的协议。每个 APP 的URL Scheme都是不一样的,如果存在一样的URL Scheme,那么系统就会响应先安装那个 APP 的URL Scheme,因为后安装的 APP 的URL Scheme被覆盖掉了,是不能被调用的。

Android系统中

@Fog3211
Fog3211 / rich-text-html-editors.md
Created June 14, 2023 16:01 — forked from manigandham/rich-text-html-editors.md
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

@Fog3211
Fog3211 / parse-url.ts
Last active February 15, 2023 16:03
[parse-url] 解析url参数 #Typescript
export const parseUrl = (url: string) => {
if (!url) return {}
const searchUrl: string = url.indexOf('?') ? url.match(/.+\?(.+)/)![1] : url
const searchParams = searchUrl.split('&')
const result: Record<string, string | string[]> = {}
searchParams.forEach(item => {
@Fog3211
Fog3211 / debounce-throttle.ts
Last active December 21, 2022 10:42
[debounce-throttle] 防抖和节流 #Typescript
export const debounce = <T extends Function>(fn: T, ms: number) => {
let timer: ReturnType<typeof setTimeout> | undefined;
return (...args: any[]) => {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
fn.apply(this, args);
}, ms);
};
};
@Fog3211
Fog3211 / concurrent-request-race.ts
Last active December 20, 2022 09:08
[Control Concurrent requests by promise.race and all] 控制请求并发 #Typescript
import axios from 'axios';
export const concurrentRequestRace = (urls: string[], max: number): Promise<unknown[]> => {
return (async () => {
const result: unknown[] = [];
const pool: Promise<unknown>[] = [];
if (urls.length === 0 || max <= 0) {
return Promise.resolve(result);
}
@Fog3211
Fog3211 / concurrent-request.ts
Last active December 13, 2022 12:20
[Control Concurrent requests by promise] 控制请求并发 #Typescript
import axios from 'axios';
export const concurrentRequest = (urls: string[], max: number): Promise<unknown[]> => {
return new Promise((resolve) => {
const result: unknown[] = [];
if (urls.length === 0 || max <= 0) {
return resolve(result);
}
// 已完成的数量
@Fog3211
Fog3211 / gitlab_download_with_github_desktop.js
Created April 1, 2021 06:33
在gitlab中使用github desktop下载代码
// ==UserScript==
// @name gitlab download
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 在gitlab中使用github desktop下载代码
// @author Fog3211
// @match *://gitlab.com/*
// @icon https://about.gitlab.com/ico/favicon.ico
// @grant none
// ==/UserScript==
@Fog3211
Fog3211 / mathRecordPath.ts
Last active March 30, 2021 09:04
根据子节点id匹配嵌套路径
export const mathRecordPath = <T extends AnyObj>(lists: T[], value: number | string, options?: {
keyAlias: string, // 键别名
childrenAlias: string // 子数组别名
}) => {
const result = []
const { keyAlias = 'id', childrenAlias = 'children' } = options ?? {}
try {
const getNodePath = (node: T) => {
result.push(node)
if (node[keyAlias] === value) {
@Fog3211
Fog3211 / swagger-token.js
Last active December 21, 2020 02:50
swagger自动填充token(油猴脚本)
// ==UserScript==
// @name swagger自动填充token
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://huce-sit.hupu.io/admin/swagger-ui.html
// @grant none
// ==/UserScript==
@Fog3211
Fog3211 / clonedeep.js
Created August 6, 2020 07:13
深拷贝
const cloneDeep = (data) => {
if (Array.isArray(data)) {
return [...data].map(cloneDeep)
} else if (typeof data === 'object' && data !== null) {
const result = {}
Object.keys(data).forEach(key => {
result[key] = cloneDeep(data[key])
})
return result
}