Quick Tips Tutorials
JavaScript closest
When it comes to finding relationships between elements, we traditionally think of a top-down approach. We can thank CSS and
querySelector
/querySelectorAll
for that relationship in selectors. What if we want to find an element's parent based on selector?To look up the element tree and find...JavaScript: Reverse Arrays
Manipulating data is core to any programming language. JavaScript is no exception, especially as JSON has token over as a prime data delivery format. One such data manipulation is reversing arrays. You may want to reverse an array to show most recent transactions, or...
Restart Mac From Command Line
Restarting and shutting down a computer remotely is a frequent task for remote system administrators. As someone that writes many shell scripts, I also find myself automating system restarts. Let's look at a few ways to restart Mac systems from command line!Restart a Local MacTo...
How to Get a Computer’s Hardware ID
Cheating in online games is a huge issue these days -- just ask anyone playing PUBG. Cheaters aren't difficult for players to spot but vendors oftentimes don't do enough to punish these villains. Krafton recently announced they would start banning cheaters by hardware ID...
How to Get Mac Battery Level from Command Line
I'm a big fan of having as much information as I can get within the command line. I couldn't go without knowing which git branch I'm on, for example. Another important piece of information I like having is my current battery percentage.To get...
How to Block a Range of IP Addresses
As much as content creators want traffic to their website, there is such thing as the wrong type of traffic. Sometimes it's content scrapers, sometimes it's malicious bots; either way, it's important to know how to block problematic IPs from your site.To block a range...
CSS ::file-selector-button
We all love beautifully styled
form
controls but, due to the differences between operating system displays, styling them can be painful. Due to that pain, we've created scores of libraries to mock these controls. Unfortunately that sometimes comes at the cost of accessibility, performance...How to Open a Tor Brave Window from Command Line
I love the Brave web browser for many reasons: ad blocking, Brave rewards, crypto integration, and even a Tor tab feature. I'll often use the Tor feature but wanted to know how I could automated opening Tor windows from command line.To open a Brave Tor...
How to Open an App from Anywhere on Mac Command Line
Many engineers like myself live in the command line, and perform actions from command line that most others would click an icon for. I've always found opening apps from command line on Macs painful. You need to references the
Applications
directory, add.app
to...Document.elementFromPoint
Reacting to events with JavaScript is the foundation of a dynamic experiences on the web. Whether it's a
click
event or another typical action, responding to that action is important. We started with assigning events to specific elements, then moved to event delegation...