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
| // measure scrollTime in browser console | |
| (() => { | |
| document.addEventListener('click', e => { | |
| console.log('scrollTop', document.documentElement.scrollTop); | |
| console.log('clicked target', e.target); | |
| }); | |
| let last = document.documentElement.scrollTop; | |
| let lastT = Date.now(); |
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
| function createInfiniteProxy(path = ['root']) { | |
| return new Proxy({}, { | |
| // 1. Definiujemy klucze widoczne w inspekcji i pętlach | |
| ownKeys() { | |
| return ['a', 'b']; | |
| }, |
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 { factorsBI, arrayHistogram } from '@gkucmierz/utils'; // @5.0.0 | |
| const generatePin = () => { | |
| return Math.trunc(Math.random() * 1e6).toString().padStart(6, '0'); | |
| } | |
| const detSigDig = pin6 => { | |
| let hash = 13; | |
| for (let i = 0, s = String(pin6); i < 6; i++) hash += Number(s[i]) * ([3, 7, 1, 9, 5, 2][i]); |
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 { measurePerformance } from '@gkucmierz/utils'; // @4.1.1 | |
| const measurePerformance2 = (fn, steps = 1e8, memo = 'noop') => { | |
| const t1 = performance.now(); | |
| while (steps--) { | |
| fn(steps); | |
| } | |
| const t2 = performance.now(); | |
| return { | |
| memo, |
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 { combinationsIterator, permutationsIterator } from '@gkucmierz/utils'; | |
| // ========================================== | |
| // ⚙️ CONFIGURATION | |
| // ========================================== | |
| const MIN_VAL = 30e3; | |
| const MAX_VAL = 40e3; | |
| const MAX_DEPTH = 4; // 1: basic, 2: medium, 3: deep nested formulas | |
| const USE_CONSTANT_FUNCTION_ONCE = true; | |
| const MAX_RESULTS = 1e3; |
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 { canvas, getContext, getDisplaySize, onResize } = require('canvas'); | |
| // Step delay for visual pipeline animation (in milliseconds) | |
| const STEP_DELAY_MS = 1000; | |
| // Optimal image processing parameters discovered via signal grid search | |
| const BLUR_RADIUS = 12; | |
| const CUTOFF_OFFSET = 5; | |
| // Target Twitter CDN image URL |
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
| { | |
| init: function(elevators, floors) { | |
| // Wykrywamy wyzwania oparte na limicie ruchów (Challenge #6 i #7) | |
| this.clearConditionIsMoves = ["#challenge=6", "#challenge=7"].includes(location.hash); | |
| // Zakres pięter | |
| const minFloorNum = Math.min.apply(null, floors.map(floor => floor.floorNum())); | |
| const maxFloorNum = Math.max.apply(null, floors.map(floor => floor.floorNum())); |
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
| /** | |
| * Shannon-Hartley Theorem: Channel Capacity Calculator | |
| * | |
| * Formula: C = B * log2(1 + SNR) | |
| * | |
| * Where: | |
| * - C = Channel Capacity (bits per second) | |
| * - B = Bandwidth (Hz) | |
| * - SNR = Signal-to-Noise Ratio (linear) |
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
| // Perrin Number Sequence Interactive Canvas Visualization | |
| // instacode-app compatible | |
| const { canvas, getContext, onResize, onPointerMove } = require('canvas'); | |
| const ctx = getContext('2d'); | |
| let width = canvas.width; | |
| let height = canvas.height; | |
| // Track canvas size |
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 { getContext, onResize, onPointerDown } from 'canvas'; | |
| // --- CONFIGURATION CONSTANTS --- | |
| const MAX_POINTS = 50000; // Total number of fractal points to generate | |
| const STAGE_1_POINTS = 15; // Number of points in slow educational phase | |
| const STAGE_1_DELAY_MS = 400; // Delay between steps in slow phase (milliseconds) | |
| const STAGE_2_POINTS = 100; // Number of points in normal phase (1 point/frame) | |
| const STAGE_3_POINTS = 500; // Number of points in medium phase (10 points/frame) | |
| const STAGE_4_SPEED = 250; // Number of points generated per frame in fast phase |
NewerOlder