Tutorials Page 7
How to Use window.crypto in Node.js
I've been writing a bunch of jest tests recently for libraries that use the underlying
window.crypto
methods likegetRandomValues()
andwindow.crypto.subtle
key management methods. One problem I run into is that thewindow.crypto
object isn't available, so I need to shim it.To use thewindow.crypto
...Convert Fahrenheit to Celsius with JavaScript
The United States is one of the last bodies that refuses to implement the Celsius temperature standard. Why? Because we're arrogant and feel like we don't need to change. With that said, if you code for users outside the US, it's important to provide localized weather...
Create a Thumbnail From a Video with ffmpeg
Creating a thumbnail to represent a video is a frequent task when presenting media on a website. I previously created a shell script to create a preview video from a larger video, much like many adult sites provide. Let's view how we can...
Detect System Theme Preference Change Using JavaScript
JavaScript and CSS allow users to detect the user theme preference with CSS'
prefers-color-scheme
media query. It's standard these days to use that preference to show the dark or light theme on a given website. But what if the user changes their preference...How to Use Storage in Web Extensions
Working on a web extension is an interesting experience -- you get to taste web while working with special extension APIs. One such API is
storage
-- the web extension flavor of persistence. Let's explore how you can usesession
andlocal
storage within...Skip or Only Run a Test with JavaScript Mocha
Whenever I start to feel anxiety about a big change I'm making, I start writing more unit tests. I'll write down my fear and then write a test that attacks, and eventually relaxes, that fear. There are two actions that I've been frequently using...
Determine Default App for File Type from Command Line
One quality of life improvement any developer can make for themselves is ensuring different file types open in the app they're most proficient in. If you know me, you know I prefer accomplishing as much as possible from the command line. The
duti
utility...Set Brave as Default Browser from Command Line
I've been a huge fan of the Brave web browser for years. They're crypto-friendly, provide native ad-blocking features, and even provide Tor integration. Whenever I set up new systems, I automate Brave as the default browser.You can use the following shell command to set...
CSS :autofill
Autofilling HTML
input
elements is a frequent user action that can drastically improve user experience. Hell, we all autofill for our passwords and address information. But what control do we have wheninput
elements have been autofilled?To add custom CSS styles to inputs whose...Monitor Events and Function Calls via Console
Despite having worked on the very complex Firefox for a number of years, I'll always love plain old
console.log
debugging. Logging can provide an audit trail as events happen and text you can share with others. Did you know that chrome providesmonitorEvents
and...