Skip to content

Instantly share code, notes, and snippets.

View nickyonge's full-sized avatar
♥️
🦆

Nick Yonge nickyonge

♥️
🦆
View GitHub Profile
@nickyonge
nickyonge / textFitter.js
Last active March 16, 2026 06:20
JS script that matches an element's text to fill the inline width of its containing element
/** TEXT FITTER
*
* A script that automatically matches an element's text
* to perfectly fill the inline width of its containing element.
*
* (At least, perfectly to the glyph level. If a glyph has a lot
* of leading or trailing space, that space will still be respected)
*
* Presented as-is under The Unlicense, see below for license info.
*/
@nickyonge
nickyonge / decapCharWidget.js
Last active March 13, 2026 20:08
A custom Decap widget like "string", that only allows a single character
/** DECAP CHAR WIDGET
*
* A custom Decap widget like "string", that only allows a single character
*
* INSTALLATION
*
* 1.) Drop/load this script the directory with Decap's index.html, and add:
<script src="decapServerWarning.js"></script>
@nickyonge
nickyonge / recolorer.js
Last active March 13, 2026 00:35
JS script that fuzzy recolors images based on target color. WIP
// @ts-check
// gist: https://gist.github.com/nickyonge/1988b42e7a30b5019c47125a0009bd81
// current major issue is that color replcaement doesn't work, see RecolorImage func
import {
clampGamut,
converter,
differenceCiede2000
@nickyonge
nickyonge / decapColorDisplay.js
Created February 12, 2026 04:33
Decap CMS Collection Title Color Display
/** DECAP COLLECTION SUMMARY COLOR DISPLAY
*
* Replaces a color string in your Decap CMS Collection's title text
* with a visual indicator of that color, including a color swatch,
* text output, and/or updating the collection item's background color.
*
*
* MARK: Setup
* Using marks for VSCode minimap navigation
*
@nickyonge
nickyonge / decapServerWarning.js
Last active February 12, 2026 04:27
Decap CMS server warning detector
/** DECAP SERVER CONNECTION WARNING DETECTOR
*
* Autodetects when Decap CMS fails to connect,
* and reminds you to run npx decap-server,
* because we could all use a little reminder sometimes
*
* More errors can be added to listen for, but it will only
* trigger on the first error recognized. Sometime I should
* generalize this~
*
@nickyonge
nickyonge / VSCode_Better_MARK_Regex
Created November 29, 2025 22:08
Improved MARK: section header regex for Settings > Editor > Minimap > Mark Section Header Regex. Recognizes the end of inline comments and removes trailing whitespace.
\bMARK:\s*(?<separator>-?)\s*(?<label>.*?)(?:\s*(?:(?:[*]\/)|(?:-{2,}>)|(?:#>)|$))
More details: https://www.reddit.com/r/vscode/comments/1p4f3jt/i_made_better_mark_regex_for_section_headers_in/
@nickyonge
nickyonge / obsolete_webpack.config.js
Created November 29, 2025 07:03
Outdated version of webpack.config.js
// NOTE: this is an outdated version of the Webpack template.
// Preserving this as a separate gist, in addition to the original's changelogs.
// See https://gist.github.com/nickyonge/bb9fe46458c16e1cd560bce505e4af39 for the new version.
/* WEBPACK TEMPLATE SETUP
* webpack.config.js
*
* All the steps for getting a new webpack-based website started via VS Code!
*
* This script itself is a file called webpack.config.js and is used to tell Webpack how to build your site.
@nickyonge
nickyonge / settings.json - PlatformIO fuse buttons
Last active December 19, 2024 02:03
PlatformIO IDE VSCode toolbar buttons for "Set Fuses", "Upload, Build, and Set Fuses", and "Upload w/o Build, and Set Fuses"
[ see: https://community.platformio.org/t/made-set-fuses-and-upload-and-set-fuses-toolbar-commands/44795 ]
[ ... the rest of settings.json above ... ]
"platformio-ide.toolbar": [
[ ... other toolbar commands ... ]
{
"text": "$(flame)",
@nickyonge
nickyonge / ATtinyX4_pinmap_warnings.cpp
Last active October 19, 2024 00:26
Series of checks + warnings for PlatformIO when working with ATtiny84 platform, to ensure you're using the correct CW/CCW pinmapping
// Warnings to ensure ATtinyX4's Arduino pinmapping is defined correctly
#ifdef __AVR_ATtinyX4__ // ensure ATtinyX4 platform, proceed with warning checks
// SETUP: Uncomment ONE of the two definitions below to select the desired pinmapping:
#define USE_CW_PINMAPPING // this project uses CLOCKWISE (CW) pinmapping
// #define USE_CCW_PINMAPPING // this project uses COUNTERCLOCKWISE (CCW) pinmapping
#ifdef USE_CW_PINMAPPING
#ifdef USE_CCW_PINMAPPING
#error "Both CW and CCW pinmappings are specified - only one may be selected!"
@nickyonge
nickyonge / ATtinyX4_X5_pinout
Created October 18, 2024 02:22
ATtinyX4 / ATtinyX5 pinout description and graphic diagram, with links and resources
/* PINOUT DIAGRAMS FOR ATTINYX4 / ATTINYX5
ATtinyX4
.--------.
VCC [2.7-5.5V] - 1 =| O |= 14 - GND
10(0),X1,PCI8,PB0 - 2 =| |= 13 - 0(10),A0,PCI0,PA0
9(1),X2,PCI9,PB1 - 3 =| |= 12 - 1(9),A1,TXD,PCI1,PA1
RESET,11(11),PCI11,PB3 - 4 =| |= 11 - 2(8),A2,RXD,PCI2,PA2
8(2),INT0,PCI10,PB2 - 5 <| |= 10 - 3(7),A3,PCI3,PA3
7(3),A7,PCI7,PA7 - 6 <| |= 9 - 4(6),A4,SCK/SCL,PCI4,PA4