Skip to content

Instantly share code, notes, and snippets.

View gkucmierz's full-sized avatar
💻

Grzegorz Kućmierz gkucmierz

💻
View GitHub Profile
// Dichroic Glass X-Cube Optical Prism with Interactive Drag-to-Rotate
// Built using Three.js inside Instacode Web Worker
import { canvas, onResize, getDisplaySize, onPointerDown, onPointerMove, onPointerUp } from 'canvas';
import * as THREE from 'three';
// ==========================================
// CONFIGURATION CONSTANTS (Adjust these to customize your X-Cube!)
// ==========================================
const BG_COLOR = 0xf3f2f8; // Soft light studio background color (#f3f2f8)
// Glassmorphism 3D Rotating Cube for Instacode
// Features: Dual-cube perspective engine, global depth sorting, Phong lighting, and specular glass gradients
import { canvas, getContext, onResize } from 'canvas';
const ctx = getContext('2d');
let width = 600;
let height = 400;
// Handle canvas resizing
// Mandelbrot Explorer for Instacode
// Features: Smooth zoom animation, continuous coloring, and HUD info display
import { canvas, getContext, onResize } from 'canvas';
const ctx = getContext('2d');
let width = 600;
let height = 400;
// Dynamic configuration
import { canvas, onResize } from 'canvas';
const ctx = canvas.getContext('2d');
let width = 300;
let height = 150;
// Handle canvas resizing automatically
onResize((w, h) => {
width = w;
import { canvas, onResize } from 'canvas';
import { mobius } from '@gkucmierz/utils@3.2.0';
const ctx = canvas.getContext('2d');
// --- Configuration Constants ---
const BG_COLOR = '#0f172a'; // Background color of the canvas (Slate 900)
const LINE_OPACITY = 0.7; // Opacity of all plotted function lines (0.0 to 1.0)
const MAX_X = 150;
const MAX_Y = 0; // Maximum limit on Y axis (set to 0 or -1 for auto-scaling)
import { canvas, onResize } from 'canvas';
import { mobius } from '@gkucmierz/utils@3.2.0';
const ctx = canvas.getContext('2d');
// --- Configuration Constants ---
const BG_COLOR = '#0f172a'; // Background color of the canvas (Slate 900)
const MAX_X = 250;
const MAX_Y = 0; // Maximum limit on Y axis (set to 0 or -1 for auto-scaling)
const STEP_X = 20; // Grid step size for X axis (set to 0 for auto-scaling)
import { canvas, onResize } from 'canvas';
const ctx = canvas.getContext('2d');
onResize((width, height) => {
// Adjust drawing buffer size to match splitter dimensions
canvas.width = width;
canvas.height = height;
// 1. Background - elegant, dark navy (cyber-dark style)
ctx.fillStyle = '#090d16';
import { factorsBI, arrayHistogram } from '@gkucmierz/utils';
const generatePin = () => {
return Math.trunc(Math.random() * 1e6).toString().padStart(6, '0');
}
for (let i = 0; i < 10; ++i) {
const pin = generatePin();
const csum = detSigDig(pin);
console.log(pin, csum);
const LagDetector = (() => {
let run = true;
const TRESHOLD = 1e3/60 + 1; // ~60 FPS
let lastTime = +new Date();
(function loop() {
const time = +new Date();
const diff = time - lastTime;
if (diff > TRESHOLD) {
console.log(`Interface blocked for ${diff}ms`);
@gkucmierz
gkucmierz / maze-creatated-with-llm.js
Last active May 20, 2026 04:56
maze-creatated-with-llm.js Run this code instantly in your browser: http://localhost:5026/gist/8134f76fe134332605b74a0f652e0bab Run this code instantly in your browser: https://instacode.app/gist/8134f76fe134332605b74a0f652e0bab
/* --------------------------------------------------------------
Labirynt
Otwarcie: górna krawędź po prawej → wejście
dolna krawędź po lewej → wyjście
Unikalny szlak od wejścia do wyjścia → perfekcyjny labirynt
-------------------------------------------------------------- */
const labW = 38; // szerokość (liczba pól)
const labH = 18; // wysokość (liczba pól)