Skip to content

Instantly share code, notes, and snippets.

@smcllns
smcllns / curly.js
Last active May 30, 2025 04:08
Replaces straight quotes with curly quotes (smart quotes) within text on a html page. I'm using this script to just update the html page when rendered, since Prettier doesn't support and VS Code solutions weren't great.
// Replace straight quotes with curly quotes
// Add to a html page inside a <script> tag
(() => {
const curly = (s) =>
s
.replace(/(^|[\s([{])"(?=\S)/g, "$1\u201C") // opening double
.replace(/(?<!\d)"/g, "\u201D") // closing double
.replace(/(^|[\s([{])'(?=\S)/g, "$1\u2018") // opening single
.replace(/(?<!\d)'/g, "\u2019"); // closing single
@CodingDoug
CodingDoug / README.md
Last active August 8, 2025 20:09
Copying data from Firebase Realtime Database to a Google Sheet in real time via Cloud Functions
@mjackson
mjackson / color-conversion-algorithms.js
Last active December 9, 2025 12:36
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation