Skip to content

Instantly share code, notes, and snippets.

View DeityLamb's full-sized avatar
🎭
confused

Oleksii DeityLamb

🎭
confused
View GitHub Profile
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/Schema",
"definitions": {
"Schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"assetIndex": {
"$ref": "#/definitions/AssetIndex"
@DeityLamb
DeityLamb / readme.md
Last active December 24, 2024 15:46
Compile Tailwind v4 in runtime

Compile Tailwind v4 in runtime

The new Tailwind compiler is indeed quite fast, so you can use it for real-time SSR or something like that.

This example uses an existing @tailwindcss/node@next package,
but it seems setting up the compiler for a different runtime wouldn't be too difficult.
Check out the source code of @tailwindcss/node

Install deps

# Install Tailwind v4 (experimental release)
@DeityLamb
DeityLamb / clamp.md
Created April 27, 2024 23:02
The clamp function using only mathematical operators

(((x + min + |x - min|) / 2) + max - |((x + min + |x - min|) / 2) - max|) / 2

$\frac{(\frac{x + \min + |x - \min|}{2} + \max - |(\frac{x + \min + |x - \min|}{2} - \max|)}{2}$

image

{
"_comment_": [
"Please do not automate the download and installation of Forge.",
"Our efforts are supported by ads from the download page.",
"If you MUST automate this, please consider supporting the project through https://www.patreon.com/LexManos/"
],
"spec": 0,
"profile": "forge",
"version": "1.16.2-forge-33.0.61",
"json": "/version.json",
{
"_comment_": [
"Please do not automate the download and installation of Forge.",
"Our efforts are supported by ads from the download page.",
"If you MUST automate this, please consider supporting the project through https://www.patreon.com/LexManos/"
],
"id": "1.16.2-forge-33.0.61",
"time": "2020-09-10T18:57:08+00:00",
"releaseTime": "2020-09-10T18:57:08+00:00",
"type": "release",
@DeityLamb
DeityLamb / split-markdown.util.ts
Last active June 24, 2023 12:00
Split a markdown without breaking a code block
function splitMarkdown(str: string, limit: number): string[] {
return str.match(new RegExp(`.*([^]){1,${limit}}(\n)?$`, 'gm')).reduce((acc, curr) => {
const lastValue = acc.at(-1);
if (!lastValue) return [curr];
const heads = lastValue.match(/```.*/g) as string[] || [];
// If the number of heads is even or 0, then all code blocks are closed
@DeityLamb
DeityLamb / .dunstrc
Last active July 22, 2022 09:33
My wofi configs
width=400
lines=10
term=alacritty
prompt=Type an applicattion
allow_images=true
@DeityLamb
DeityLamb / floating.sh
Last active July 13, 2023 16:51
run application as floating in swaywm
#!/bin/bash
# [usage examples]
# sh ./floating.sh kitty -e "htop"
# sh ./floating.sh kitty -e "ranger"
$@ &
swaymsg "for_window [pid=\"$!\"] floating enable"
#!/bin/bash
# [DEPENDENCIES]
# dunst (https://github.com/dunst-project/dunst)
# pulseaudio (https://github.com/pulseaudio/pulseaudio)
# faba-icon-theme (https://github.com/snwh/faba-icon-theme)
# [USAGE]
@DeityLamb
DeityLamb / alacritty.yml
Last active January 11, 2024 13:39
alacritty - nord theme
# Colors (Nord)
colors:
# Default colors
primary:
background: '#071019'
foreground: '#D8DEE9'
# Normal colors
normal:
black: '#3B4252'