Skip to content

Instantly share code, notes, and snippets.

View Cold06's full-sized avatar

Cold06

  • 18:18 (UTC -03:00)
View GitHub Profile
@Cold06
Cold06 / parser.js
Last active June 3, 2024 19:42
Stupid custom loosely defined query language parser
const parse = input =>
input.split(',') // params separated by comma
.map(part => part.split(/[:=]/g) // param/value pair separated by : or =
.map(part => part.map(term => term.trim()))) // trim params and values
.filter(([k, v]) => k && v) // filter out empty entries
.reduce((p, [k, v]) => ({ ...p, [k]: v }), {}) // join everything on one object
// parse('a : 1, b=32423, c: true, d e f g : example AND test, test = false ')
// outputs
@Cold06
Cold06 / react-css-renderer.tsx
Last active April 2, 2024 00:27
I expect 50K stars by the end of the month
// Of course you can see it live
// https://stackblitz.com/edit/vitejs-vite-sxrsd9?file=src%2FApp.tsx
import * as CSSType from 'csstype';
import {
PropsWithChildren,
createContext,
FC,
useId,
useEffect,
const adapter = await navigator.gpu.requestAdapter();
const device = await adapter.requestDevice();
const shaderModule = device.createShaderModule({ code: `struct VertexOutput {
@builtin(position) position: vec4<f32>,
@location(0) fragmentPosition: vec2<f32>,
}
struct Uniforms {
center: vec2<f32>,
@Cold06
Cold06 / UnrealEngineSubgrids.md
Created August 9, 2023 15:03
HOW are we in 2023 and didn't solve this yet?