Skip to content

Instantly share code, notes, and snippets.

View bdsqqq's full-sized avatar
🎨

Igor Bedesqui bdsqqq

🎨
View GitHub Profile
@palmamartin
palmamartin / vesper-dark-color.json
Last active February 1, 2024 11:00
Vesper theme for Zed
{
"$schema": "https://zed.dev/schema/themes/v0.1.0.json",
"name": "Vesper",
"author": "Rauno Freiberg",
"themes": [
{
"name": "Vesper",
"appearance": "dark",
"style": {
"border": null,
@appsforartists
appsforartists / Linux for the Lenovo Legion Go.md
Last active October 2, 2025 19:37
Linux for the Lenovo Legion Go

I've been experimenting with running Linux (specifically NixOS) on the Legion Go. I intend to publish my configuration when it's in a good spot, but also thought it would be handy to have a shared space to document what we all learn in the mean time.

I'm admittedly new to both Linux and Nix, and appreciate any advice others can share too.

What's working

  • Touchscreen
  • Basic gamepad when both controllers are attached/detached
  • Rumble
  • Legion L+X to change perf modes
  • Sound + volume control
type Props<TagName extends keyof JSX.IntrinsicElements | void = void> = {
as?: TagName;
children?: React.ReactNode;
attributes?: Attributes<TagName>;
};
export type Attributes<TagName = void, O = void> = Omit<
(TagName extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[TagName]
export const chaosTestStrings = (): void => {
const textNodes = getAllTextNodes(document.body);
for (const node of textNodes) {
const textNodeLength = node.textContent ? node.textContent.length : 0;
if (node.textContent === null) {
return;
}
if (node.parentElement instanceof Element) {
if (node.parentElement.dataset.originalText === undefined) {
@solarkraft
solarkraft / syncthing-automerge.py
Last active November 27, 2025 18:25
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
# This script automatically handles Syncthing conflicts on text files by applying a
# git three-way merge between the previously synced version and each divergent version.
# It depends on the watchdog package and git.
# For automatic dependency installation when running with ´uv run --script deconflicter.py´:
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "watchdog",
@alii
alii / use-throttle.ts
Created July 7, 2021 00:14
use-throttle.ts
export function useThrottle<T>(value: T, limit = 1000) {
const [throttledValue, setThrottledValue] = useState(value);
const lastRan = useRef(Date.now());
useEffect(() => {
const handler = setTimeout(() => {
if (Date.now() - lastRan.current >= limit) {
setThrottledValue(value);
lastRan.current = Date.now();
}
@whoisryosuke
whoisryosuke / dynamic-refs.jsx
Created May 3, 2021 21:07
ReactJS - Dynamically create Refs for children using useRef hook and createRef - @see: https://stackoverflow.com/questions/55995760/how-to-add-refs-dynamically-with-react-hooks
const {
useState,
useRef,
createRef,
useEffect
} = React;
const data = [
{
text: "test1"
@itsMapleLeaf
itsMapleLeaf / validation.ts
Last active July 6, 2022 20:05
validation take 2
type ValidatorResult<T> = { type: "valid" } | { type: "invalid"; error: string }
type ValidateFn<T> = (value: unknown) => ValidatorResult<T>
type Validator<T = unknown> = {
validate: ValidateFn<T>
parse: (value: unknown) => T
is: (value: unknown) => value is T
}
@Merott
Merott / tailwind-colors-as-css-variables.md
Last active July 7, 2025 22:40
Expose Tailwind colors as CSS custom properties (variables)

This is a simple Tailwind plugin to expose all of Tailwind's colors, including any custom ones, as custom css properties on the :root element.

There are a couple of main reasons this is helpful:

  • You can reference all of Tailwind's colors—including any custom ones you define—from handwritten CSS code.
  • You can define all of your colors within the Tailwind configuration, and access the final values programmatically, which isn't possible if you did it the other way around: referencing custom CSS variables (defined in CSS code) from your Tailwind config.

See the Tailwind Plugins for more info on plugins.

@kapulkin
kapulkin / pyodide.html
Last active March 5, 2021 13:56
Pyodide sandbox: Loading csv file into numpy aray
<html>
<head>
</head>
<input type="file" id="fileInput" onchange="handleFiles(this.files)"/>
<div id="pyodide"/>
<body>
<script type="text/javascript">
self.languagePluginUrl = "/python/"