Skip to content

Instantly share code, notes, and snippets.

@dkaraush
dkaraush / oklch2rgb.js
Last active March 11, 2025 18:18
conversion OKLCH into RGB and RGB into OKLCH in js, simplified
const multiplyMatrices = (A, B) => {
return [
A[0]*B[0] + A[1]*B[1] + A[2]*B[2],
A[3]*B[0] + A[4]*B[1] + A[5]*B[2],
A[6]*B[0] + A[7]*B[1] + A[8]*B[2]
];
}
const oklch2oklab = ([l, c, h]) => [
l,
@dkaraush
dkaraush / code.bf
Created April 11, 2023 01:54
advent of code 2022 first task in brainfuck
>>>,----------[--------------------------------------<[->>++++++++++<<]>[->+<]>[
-<<+>>]<,----------]<[[-<+>]>,----------[--------------------------------------<
[->>++++++++++<<]>[->+<]>[-<<+>>]<,----------]<]<[<[->>+>+<<<]>>>[-<<<+>>>]<<[->
>+>+<<<]>>>[-<<<+>>>][-]>[-]>[-]+>[-]<<<<[>+>+<<-]>[<+>-]<<[>>+<<-]+>>>[>-]>[<<<
<->>[-]>>->]<+<<[>-[>-]>[<<<<->>[-]+>>->]<+<<-][-]>[-]>[-]<<<[-][-]>[-]<<[>+>+<<
-]>[<+>-]+>[<<<<[-]>[-<+>]>>->[-]]<[-]<<[-][-]>[-]>,----------[-----------------
---------------------<[->>++++++++++<<]>[->+<]>[-<<+>>]<,----------]<[[-<+>]>,--
--------[--------------------------------------<[->>++++++++++<<]>[->+<]>[-<<+>>
]<,----------]<]<][-]>[-]+>[-]+<[>[-<-<<[->+>+<<]>[-<+>]>>]++++++++++>[-]+>[-]>[
-]>[-]<<<<<[->-[>+>>]>[[-<+>]+>+>>]<<<<<]>>-[-<<+>>]<[-]++++++++[-<++++++>]>>[-<
@dkaraush
dkaraush / fragment shader
Created July 22, 2020 16:35
a beautiful gradient shader at the main page of stripe website (https://stripe.com)
precision highp float;
uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
uniform vec2 resolution;
uniform float aspectRatio;
uniform float u_time;
uniform float u_shadow_power;
uniform float u_darken_top;
uniform vec4 u_active_colors;