Skip to content

Instantly share code, notes, and snippets.

View nik-rev's full-sized avatar

Nik Rev nik-rev

View GitHub Profile
@nik-rev
nik-rev / rust_import_style_attribute_lang_proposal.md
Last active April 7, 2026 16:47
Experimental Proposal for `import_style` attribute

Experiment: #![feature(import_style)]

I propose to add a new lint for making imports in codebases more consistent, which fires when items are imported inconsistently.

For example, many items in the std::fs, std::io, std::iter, std::env and other modules are conventionally referred to via the parent path:

use std::fs;
use std::fmt;
use std::io;
@nik-rev
nik-rev / catppuccin-cssvariable-transformer.js
Last active September 9, 2024 16:25
Catppuccin CSS Variable Getter and Transformer for websites
/**
* Retrieves all CSS custom properties (variables) from the document's style sheets.
* @returns {[string, string][]} An array of key-value pairs where the key is the CSS variable name and the value is its definition.
*/
const getAllCssVariables = () =>
[...document.styleSheets]
.filter(({ href }) => !href || href.startsWith(window.location.origin))
.flatMap(({ cssRules }) =>
[...cssRules]
.filter(({ type }) => type === 1)