Skip to content

Instantly share code, notes, and snippets.

View flipeador's full-sized avatar
🇦🇷

Matías Juarez flipeador

🇦🇷
View GitHub Profile
@flipeador
flipeador / js-deref.md
Created February 8, 2023 22:55
JS Simple Deref Function

JS Simple Deref Function

/**
 * @param {String} s Input string.
 * @param {Object} options Options.
 * @param {Object.<string,any>} options.vars Variables: `{varname:format}`.
 * @param {Array} options.args Arguments: `%0, %1, %2...`.
 * @param {CallableFunction} options.fmt Format `function(varname,format)`.
 */
/*
AutoHotkey script - Windows Explorer
Author: https://github.com/flipeador
AutoHotkey: https://www.autohotkey.com
*/
#Requires AutoHotkey v2.0
#SingleInstance Force
#UseHook
@flipeador
flipeador / zero-width-character-encoding.js
Last active August 6, 2024 17:41
Zero-width character encoding in JavaScript.
const str = encode('→<Hello.World/>←');
console.log('encoded:', `_${str}_ (${str.length})`);
console.log('decoded:', decode(str));
function encode(str, off='​', on='‌', sep='‍') {
return [...(new TextEncoder()).encode(str)].map(byte => (
byte.toString(2).split('').map(bit => (bit === '0' ? off : on))
).join('')).join(sep);
}
@flipeador
flipeador / language-sensitive-relative-time-formatting.js
Last active April 18, 2025 01:44
Language-sensitive relative time formatting in JavaScript.
/**
* Language-sensitive relative time formatting.
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat
* @example
* // now
* console.log(formatRelativeTime(
* '2000/01/01 00:00:00',
* '2000/01/01 00:00:00'
* ));
*
@flipeador
flipeador / discord-app-protocols.md
Last active July 19, 2025 01:22 — forked from ghostrider-05/discord_app_protocols.md
Discord App Protocols

Discord App Protocols

Home

discord://-/<url>

Name URL
Friends channels/@me
Nitro store
@flipeador
flipeador / unicode-characters-emojis.md
Last active January 24, 2025 17:28
Unicode characters and emojis.

Unicode Characters & Emojis

A character is an overloaded term that can mean many things. This gist will briefly touch on the differences between Code Point, Code Unit, Grapheme and Glyph, with a particular focus on emojis.

Tip

Use [Full Emoji Support For All Websites][emoji] to ensure correct rendering of all emoji graphemes on any website.

Code Point

@flipeador
flipeador / vscode-dark-modern-bluish-color-theme.md
Last active January 4, 2025 02:10
VSCode "Dark Modern" Blue-ish Color Theme

VSCode "Dark Modern" Blue-ish Color Theme

This user configuration is applied over an existing color theme.

Setup

  1. CTRL++PPreferences: Color ThemeDark Modern.
  2. CTRL++PPreferences: Open User Settings (JSON).
Details
@flipeador
flipeador / finalization-registry.js
Last active December 26, 2024 03:49
JavaScript FinalizationRegistry & WeakRefs.
const $REF = Symbol();
const $DEL = Symbol();
/**
* Set a cleanup callback for the specified object.
* @param {object} target
* The target value to register.
* @param {Function} callback
* Function called when the target is garbage-collected.
* @returns {Function}
@flipeador
flipeador / asynchrony-concurrency-simultaneity.md
Created June 21, 2024 03:25
Asynchrony, concurrency and simultaneity.

Asynchrony - Concurrency - Simultaneity

🔄 Synchrony

Synchrony implies that the execution of multiple tasks occurs sequentially one after the other. Tasks are like steps that are executed in order, each operation blocks the others until completion.

Task #1   ├───────────┤............................
Task #2   .............├────────────┤..............
@flipeador
flipeador / image-sprites.md
Last active August 27, 2025 16:11
Create CSS/SVG image sprites.

Image Sprites

An image sprite is a collection of images put into a single image or file.

Helps reduce the number of HTTP requests, memory and bandwidth usage.

They are often used to significantly improve performance in emoji selectors.

Raster Sprites