Quick Tips Tutorials
CSS :optional
A decade ago HTML and CSS added the ability to, at least signal, validation of form fields. The
required
attribute helped inform users which fields were required, whilepattern
allowed developers to provide a regular expression to match against an<input>
's value. Targeting required fields...Get a Random Array Item with JavaScript
JavaScript Arrays are probably my favorite primitive in JavaScript. You can do all sorts of awesome things with arrays: get unique values, clone them, empty them, etc. What about getting a random value from an array?To get a random item from...
Input valueAsNumber
Every once in a while I learn about a JavaScript property that I wish I had known about years earlier --
valueAsNumber
is one of them. ThevalueAsNumber
provides the value of aninput[type=number]
as a Number type, instead of the traditional string representation when...Immediately Executing setInterval with JavaScript
Employing
setInterval
for condition polling has really been useful over the years. Whether polling on the client or server sides, being reactive to specific conditions helps to improve user experience. One task I recently needed to complete required that mysetInterval
immediately execute and...JavaScript String replaceAll
Replacing a substring of text within a larger string has always been misleading in JavaScript. I wrote Replace All Occurrences of a String in JavaScript years ago and it's still one of my most read articles. The confusion lies in that
replace
only...Array.prototype.at
Working with arrays is an essential skill in any programming language, especially JavaScript, as we continue to rely on external data APIs. JavaScript has added methods like
find
and `findIndex
recently, but one syntax I love from languages like Python is retrieving values by negative indexes.When...Command Line trash
One of the first commands you learn when experimenting with command line is
rm
, the utility for deleting files and directories. Deletion is a core computer UI operation but operating systems use a "Trash" paradigm, where files are stored before truly deleted. With the...Terminate Process on a Port from Command Line
Once a week I have to deal with a zombie process or try to start a process that's already running on its designated port. In most cases I use macOS's Activity Monitor to kill the process, which is time-consuming. What if we could just...
CSS accent-color
For better or worse, form fields have been somewhat difficult to style with CSS. Form control display is dependent upon device, operating system, and browser, so you can imagine the difficulty in making styling easy. We have slowly been given some controls over form control...
How to Create a UUID in JavaScript
The UUID identifier has been used in programming since the days a baby-faced David Walsh became a professional software engineer. My first exposure to UUIDs was via a ColdFusion app I inherited and ... the less we say about that the better. In any...