Skip to content

Instantly share code, notes, and snippets.

@Sharktheone
Sharktheone / Arch-Mojo.md
Last active December 7, 2023 15:44
Install the new mojo programming language on Arch. This will be obsolete when mojo adds official Arch support.
@VoxelPrismatic
VoxelPrismatic / hexToRgba.js
Last active May 7, 2024 16:14
hexToRgba, using lots of bitwise operations
function hexToRgba(st) {
if(st.startsWith("#"))
st = st.slice(1);
const len = st.length; // I don't know how JS works, I suspect this is recalculated
const has_alpha = !(len % 4);
if(len % 3 && !has_alpha)
throw new Error("invalid hex code");
var val = Number.parseInt(st, 16); // Only parsing the string once is faster than slicing constantly