Skip to content

Instantly share code, notes, and snippets.

View ultrox's full-sized avatar
🏠
Working from home

Marko Vujanic ultrox

🏠
Working from home
View GitHub Profile
import { useState, useEffect, useRef, useCallback } from "react";
const BUFFER_SIZE = 120;
const TARGET_FPS = 60;
const TARGET_FRAME_MS = 1000 / TARGET_FPS;
function classifyFps(fps) {
if (fps >= 55) return "good";
if (fps >= 30) return "warn";
return "bad";
@ultrox
ultrox / styles.css
Last active December 13, 2025 20:42
modern-sql.com
:root {
/* background*/
--black-rgb: 0 0 0;
--white: #ffffff; /* white */
--white-smoke: #fcfcfc;
--pale-lime: #fafde5;
--mint-wash: #eeffe6;
--light-lime: #f4fbca;
--lime: #a1e12a;
--deep-green: #007434;
@ultrox
ultrox / block-youtube.json
Created November 14, 2025 13:44
youtube blocked
{
"blockedChannels": [
"TechLead",
"Apolxgy",
"HasanAbi",
"Phat Memer",
"Charlie Kirk",
"UnWoke",
"Living A Life Of Abundance",
"Asmongold Clips",
@ultrox
ultrox / ai2ajax.js
Created August 9, 2025 14:00
Ai -> Ajax
const TARGET_WORD = "Ajax";
function* walkTextNodes(root, limit = Infinity) {
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
acceptNode(n) {
const parentName = n.parentNode?.nodeName;
if (
parentName &&
/^(SCRIPT|STYLE|NOSCRIPT|TEXTAREA|INPUT)$/i.test(parentName)
) {
@ultrox
ultrox / reset.css
Last active December 30, 2024 00:11
reset.css
button {
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
}
:where(h1,h2,h3) {
margin: 0;
text-wrap: balance;
}
@ultrox
ultrox / lerp.ts
Last active December 31, 2024 15:17
Lerp
/**
* Linearly interpolates between two values (`start` and `end`) based on a given interpolation factor `t`.
*
* @param start - The starting value of the interpolation.
* @param end - The ending value of the interpolation.
* @param t - A factor between `0.0` and `1.0` that determines the weight of the `end` value.
* - `t = 0.0`: Returns the `start` value.
* - `t = 1.0`: Returns the `end` value.
* - `0.0 < t < 1.0`: Returns a value between `start` and `end`, weighted proportionally to `t`.
* - Values outside the range `[0.0, 1.0]` result in extrapolation beyond the `start` and `end` range.
@ultrox
ultrox / client.ts
Last active April 14, 2024 12:25
Here is solid concept for client using Zod and Ts.
/**
Many times I tryed to use fuctional concepts to make the client, like Result and Either and pattern match.
That being said while I like Elm and functional concepts I ended up coding myself to oblivion.
Everything is grate as long as you don't read the absolutelly brutal TypeScript errors when using such a concepts
in language that's not made for it. TypeScript errors are unreadable anyway, using it with functional concepts is even worse.
Hence I settle for middle ground which is this code here.
#!/bin/bash
alias zcompfix='rm -rf ~/.zcomp* && exec zsh'
# habits making, habits breaking
function clear { echo "ctrl+l" ; }
alias lsport.who='lsof -nP -iTCP -sTCP:LISTEN'
alias lsport='lsof -nP -iTCP -sTCP:LISTEN'
" .ideavimrc is a configuration file for IdeaVim plugin. It uses
" the same commands as the original .vimrc configuration.
" You can find a list of commands here: https://jb.gg/h38q75
" Find more examples here: https://jb.gg/share-ideavimrc
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
@ultrox
ultrox / pretty.ts
Last active January 24, 2024 10:11
Pretty Intersection
// Simple
type Prettify<T> = {
[K in keyof T]: T[K]
} & {}
// Recursive
type Prettify<T> = T extends {} ? {
[K in keyof T]: Prettify<T[K]>
} & {} : T