Quick Tips Tutorials

  • By
    Detect Browser Bars Visibility with JavaScript

    It's one thing to know about what's in the browser document, it's another to have insight as to the user's browser itself. We've gotten past detecting which browser the user is using, and we're now into knowing what pieces of the browser UI users are...

  • By
    JavaScript print Events

    Media queries provide a great way to programmatically change behavior depending on viewing state. We can target styles to device, pixel ratio, screen size, and even print. That said, it's also nice to have JavaScript events that also allow us to change behavior. Did...

  • By
    How to Internationalize Numbers with JavaScript

    Presenting numbers in a readable format takes many forms, from visual charts to simply adding punctuation. Those punctuation, however, are different based on internationalization. Some countries use , for decimal, while others use .. Worried about having to code for all this madness?

  • By
    Locate Empty Directories from Command Line

    As a software engineer that lives too much of his life on a computer, I like keeping my machine as clean as possible. I don't keep rogue downloaded files and removes apps when I don't need them. Part of keeping a clean, performant system...

  • By
    How to Extend Prototypes with JavaScript

    One of the ideological sticking points of the first JavaScript framework was was extending prototypes vs. wrapping functions. Frameworks like MooTools and Prototype extended prototypes while jQuery and other smaller frameworks did not. Each had their benefits, but ultimately all these years later I still...

  • By
    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 like getRandomValues() and window.crypto.subtle key management methods. One problem I run into is that the window.crypto object isn't available, so I need to shim it.To use the window.crypto...

  • By
    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...

  • By
    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...

  • By
    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...

  • By
    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...