This file contains hidden or 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 React, { useRef, useState, useContext, createContext, useCallback, useMemo } from "react"; | |
| import { useInView } from "react-intersection-observer"; | |
| // 1. Create a single context to hold everything | |
| type SpyContextValue = { | |
| root: HTMLElement | null; | |
| onRatioChange: (key: string, ratio: number) => void; | |
| }; | |
| const SpyContext = createContext<SpyContextValue>({ |
This file contains hidden or 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
| #!/bin/bash | |
| # nvm-clean-major: 清理 nvm 已安装 Node.js 版本,只保留每个 major 版本的最新版本 | |
| # 仅在 macOS + bash 环境下测试通过 | |
| RED="\033[31;1m" | |
| GREEN="\033[32;1m" | |
| YELLOW="\033[33;1m" | |
| RESET="\033[0m" | |
| function clean_nvm_versions() { |
This file contains hidden or 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 lang="en-US"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>全球时区对照工具</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"> | |
| <style> | |
| * { | |
| margin: 0; |
This file contains hidden or 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
| const tmp = require('tmp'); | |
| const fse = require('fs-extra'); | |
| const path = require('path'); | |
| const dir = tmp.dirSync({ | |
| prefix: path.basename(path.dirname(__filename)) | |
| }); | |
| console.log(`Temporary directory created: ${dir.name}`); |
This file contains hidden or 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
| /** | |
| * 集合操作工具类 | |
| * 支持排列、组合、笛卡尔积和全排列操作 | |
| */ | |
| class CombinatoricsKit<T> { | |
| private elements: T[]; | |
| // #region 构造函数 | |
| /** | |
| * 构造函数 |
This file contains hidden or 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 { Typography, List, theme } from "antd"; | |
| import { FastColor } from "@ant-design/fast-color"; | |
| import { createGlobalStyle, ThemeProvider, type ThemeMode } from "antd-style"; | |
| import { NuqsAdapter } from "nuqs/adapters/react"; | |
| import type { PropsWithChildren } from "react"; | |
| import { parseAsStringEnum, useQueryState } from "nuqs"; | |
| export const setupInstructions = ` | |
| # Create a new directory for your project | |
| mkdir hi-antd-token && cd hi-antd-token |
This file contains hidden or 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
| const fs = require('fs'); | |
| const path = require('path'); | |
| const os = require('os'); | |
| const BACKUP_DIR = path.join(os.homedir(), 'chrome-extensions-backup'); | |
| // 获取Chrome扩展目录路径 | |
| function getChromeExtensionsPath() { | |
| const platform = os.platform(); | |
| const homedir = os.homedir(); |
This file contains hidden or 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 React, { useEffect, useRef, useState } from 'react'; | |
| import { Flexbox } from 'react-layout-kit'; | |
| interface BezierVisualizerProps { | |
| controls: [number, number, number, number]; // [x1, y1, x2, y2] | |
| width?: number; | |
| height?: number; | |
| } | |
| const BezierVisualizer: React.FC<BezierVisualizerProps> = ({ |
This file contains hidden or 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 React from "react"; | |
| import { createSelector, createSelectorCreator, lruMemoize, weakMapMemoize } from 'reselect' | |
| import { shallowEqual } from 'react-redux' | |
| import fastDeepEqual from 'fast-deep-equal' | |
| const createSelector2 = createSelectorCreator( | |
| lruMemoize, | |
| // fastDeepEqual | |
| { |
This file contains hidden or 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
| #!/bin/bash | |
| # | |
| # 一键本地运行视觉回归测试 | |
| # | |
| # 前置条件: | |
| # 1. 安装 GitHub CLI // brew install gh | |
| # 使用方法: | |
| # 1. 进入 ant-design 仓库目录 | |
| # 2. 执行 npm run test:image 生成本地视觉回归快照 |
NewerOlder