I'm not good at Python. This entire script is converted from the TypeScript version by copilot itself.
Please refer: https://github.com/dragon-fish/github-copilot-ai
| /** | |
| * @param {string} src | |
| * @param {Record<string, string>?} attrs | |
| * @returns {Promise<HTMLScriptElement>} | |
| */ | |
| function loadScript(src, attrs = {}) { | |
| return new Promise((res, rej) => { | |
| const s = Object.assign(document.createElement('script'), { src }) | |
| Object.entries(attrs).forEach(([k, v]) => k && v !== void 0 && s.setAttribute(k, v)) | |
| s.onload = () => res(s) |
| #!/bin/bash | |
| set -e | |
| # ============================= | |
| # 参数与配置 | |
| # ============================= | |
| MONGOSH_FALLBACK_VERSION="2.5.1" | |
| MONGOTOOLS_FALLBACK_VERSION="100.12.1" |
I'm not good at Python. This entire script is converted from the TypeScript version by copilot itself.
Please refer: https://github.com/dragon-fish/github-copilot-ai
| <?php | |
| declare(strict_types=1); | |
| /** | |
| * @template T of object | |
| * @mixin T | |
| */ | |
| class BaseDecorator { | |
| /** @var T */ |
| #!/usr/bin/env python3 | |
| """ | |
| Check MediaWiki autoload.php class files | |
| 此脚本读取 autoload.php 中定义的类文件,并检查它们是否存在以及大小写是否正确 | |
| MediaWiki 的发行版压缩包里有可能会出现文件名不对或者文件缺失的问题,头疼 | |
| """ | |
| import os | |
| import re |
| #!/usr/bin/env python3 | |
| """ | |
| Fix Git Case-Sensitive File Names | |
| 这个脚本用于修复 Git 仓库中因大小写不敏感导致的文件名冲突问题。 | |
| 它会扫描所有已跟踪的文件,查找大小写冲突的文件名,并将其重命名为临时名称, | |
| 然后再重命名为最终名称,分两次提交。 | |
| 用法: |
| ;(() => { | |
| if (window.clickToSaveCanvas) { | |
| return window.clickToSaveCanvas() | |
| } | |
| /** | |
| * @param {HTMLCanvasElement} canvas | |
| */ | |
| async function canvasToBlob(canvas) { | |
| return new Promise((resolve) => { |
| /** | |
| * @author dragon-fish <dragon-fish@qq.com> | |
| * @lisence MIT | |
| * @refered https://github.com/hongkiulam/ipad-cursor-js by @hongkiulam | |
| */ | |
| const TEXT_ELEMENT_TAGS = ['P', 'SPAN', 'H1', 'H2', 'H3', 'H4', 'TEXTAREA'] | |
| export class IpadCursor { | |
| public cursor = document.createElement('div') |
| function animatedNumber({ | |
| from = 0, | |
| to = 0, | |
| duration = 0, | |
| onUpdate, | |
| onFinish, | |
| }) { | |
| const startTime = performance.now() | |
| ;(function tick() { | |
| const current = performance.now() |
| function loadScriptAsync(src = '', { isModule = false, noCache = false }) { | |
| return new Promise((resolve, reject) => { | |
| const script = document.createElement('script') | |
| script.async = true | |
| if (noCache) { | |
| src += `${src.includes('?') ? '&' : '?'}_=${Date.now()}` | |
| } | |
| script.src = src | |
| isModule && (script.type = 'module') | |
| script.addEventListener('load', resolve) |