Skip to content

Instantly share code, notes, and snippets.

View MrZhouZh's full-sized avatar
💭
I may be slow to respond.

Jace Chow MrZhouZh

💭
I may be slow to respond.
View GitHub Profile
@MrZhouZh
MrZhouZh / code-editor-rules.md
Created February 19, 2025 09:55 — forked from yifanzz/code-editor-rules.md
EP12 - The One File to Rule Them All

[Project Name]

Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.

Project Context

[Brief description ]

  • [more description]
  • [more description]
  • [more description]
@MrZhouZh
MrZhouZh / exportLongImg-deepseek.ts
Last active February 14, 2025 03:04
Export PDF by html2canvas + jspdf
import html2canvas from 'html2canvas';
import { message } from 'antd';
export interface ExportLongImgOptions {
filename?: string;
scale?: number;
quality?: number;
maxChunkHeight?: number;
type?: 'png' | 'jpeg';
backgroundColor?: string | null;
@MrZhouZh
MrZhouZh / connectHTMLelements_SVG.png
Created December 16, 2024 10:16 — forked from alojzije/connectHTMLelements_SVG.png
Connect two elements / draw a path between two elements with SVG path (using jQuery)
connectHTMLelements_SVG.png

playground

@function themed($color) {
  @return $color;
}

@mixin triangle-arrow($direction: up, $width, $height, $color, $borderStyle: solid) {
  width: 0;
  height: 0;
@MrZhouZh
MrZhouZh / calculateWinner.js
Last active April 30, 2024 07:22
react tic-tac-toe 小游戏算法
/**
* 计算胜负
* refs: https://react.dev/learn/tutorial-tic-tac-toe
* leetcode: https://leetcode.cn/problems/find-winner-on-a-tic-tac-toe-game
*/
export default function calculateWinner(squares) {
const lines = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
@MrZhouZh
MrZhouZh / README.md
Last active April 29, 2024 06:05
1A2B 猜数字算法

1A2B 猜数字游戏

标准规则:

一方出数字, 一方猜. 数字不重复. 出数者需根据猜的人给的数字给出几个A几个B.

A 代表位置且数字都正确 B 代表数字正确但位置不正确

例如: 出 4057

@MrZhouZh
MrZhouZh / getPercentWithPrecision.js
Created April 16, 2024 02:43
席位分配-最大余数法
/**
* 议会席位分配
* echarts source code: https://github.com/apache/echarts/commit/fa8db37e5e11b74cbe6e377399c1bb49b8847704
* echarts issues: https://github.com/apache/echarts/issues/5850
* Ovilia fix: http://zhangwenli.com/blog/2017/06/13/pie-percentage
* wiki 最大余数法: https://en.wikipedia.org/wiki/Largest_remainder_method
*/
function getPercentWithPrecision(valueList = [], idx, precision) {
var sum = valueList.reduce((acc, val) => acc + val, 0)
if (sum === 0) return 0
/**
* nested providers
* reference: https://x.com/mattpocockuk/status/1765780004040761395
* TS Playground: https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgKQMoA0CiAbApiXAOxgGEJCBnGKAVwGMZoAaOAJVwEMGA5CAE1xwAvnABmUCCDgAiKJwbSA3AChlMAJ5hBvAJKFRuKAB4AKgD44AXjgBtEwF07cXAA8YRPhTgdC6uAH44AAY4AC44AEZ7FTVNQTJiDmBKEgALYGw+OUIrRGU4ODp0zOz-cPYuGAA6Cp5+XBUhGNEaQgZgcjgABQkAN2ABKFQYLgBrI3zuvoHDL1d3Qk9bSYKEkeSKNIysoiYVuCrDtaSU4p3CG3tJq7MACgRJsGnBij2Cou3svaFwh4KniD9F6-fY2UZwZJwUa4dQQURTQEzKAUezhGz7ApoLB4AjEBJUWgMaBGHqIl5g+xmN4FGkAeRAwBgRl0+kMJOeswpVJkHxKRGkZn20UmTUmvPO5XkMF4AkaAEo8gU8PBCPVcuLsjECqJoHBbnRyFRbKSgYYWACwCi4HC4ADTciFX8aaqBLl2WTDIhDlULRQhGYEC7cEIjAB6E1IswqApCVQFOQwGhQHJBxqqAR0bAcORiVrtTomVL4XARwa3X0ggowIsEcLSPjZ0bSOAAHxk2GAAHNUjAlGKztlJZUalKZQ1lEI5eEsVUcMXiCoM1mcy02jAOjkAKoUQylwzliSWytwGg7qA6PjhQg0EAAI0M0cKA6IQ4YI8qY-l04ws5xRBgMShqGcAAEKYAAYrSrCYKopg1iWHJQHA1bFpY9aNgKkxGNuu6ISeZ4XpYCARAATAAzP6AASuDYNgEBwAA6tAmQAIRhjhUB7lAgphoWxZcVGqhAXAACC4EmJgrCwVxwxjI8iEUER6I0ssKkFHxBBcdSKlOmpyHwXWDZQE22k0kIpn2KZyl
@MrZhouZh
MrZhouZh / screenshot.md
Created November 24, 2023 02:45 — forked from davestewart/broadcast-channel.md
Example of using BroadcastChannel to communicate with pages in the same domain

screenshot