Digging to China

If you dig a hole anywhere in the United States then some wag is likely to ask you if you are digging to China. Of course if you could somehow dig a hole through the center of the Earth you wouldn’t end up anywhere near China. You would emerge soaked to the skin in the south Indian Ocean, somewhere between Madagascar and Australia. That is because no point in the contiguous United States has an Maps Mania… more →
Posted in: Interactive Maps

7 Ways to Optimize Performance for Your WordPress Site (Sponsored)

The vast majority of blogs, news websites, and information websites run on WordPress. While the WordPress developer team and community do their best to ensure wordPress is performant, there are a number of practices you can implement to keep your site blazing fast. Let’s look at some of them! Use Cloudinary WordPress Plugin for Media Cloudinary is the most dynamic media transformation, delivery, and optimization service on the internet. With Cloudinary you can: Deliver optimized images, audio, and video per device, platform, and browser Use the Cloudinary API or querystring parameters to customize media on the fly Take advantage of client side JavaScript libraries to create image viewers,... more →
Posted in: JavaScript

An example of Algolia Search with Alpine.js

As my readers know, I’ve been falling in love with Alpine.js lately and am always on the hunt for more ways to practice using the framework. I thought I’d share an example of how you could use it with Algolia’s JavaScript client. I use that on my search page here with Vue.js, so it wasn’t a terribly difficult thing to rebuild a similar interface in Alpine.js. Here’s how I did it. Raymond Camden… more →
Posted in: JavaScript

The (Not So) Great Salt Lake

The Great Salt Lake in Utah is very, very big. Although it isn’t as big as it used to be. In 1987 the lake was 3,300 square miles in size. Now, in July 2022, the lake is only around 950 square miles in size. While the size of the Great Salt Lake can fluctuate a lot naturally, due to seasonal changes in the weather, it is now undoubrably drying-up because of global warming. You can see how Maps Mania… more →
Posted in: Interactive Maps

How to Get Extension Manifest Information

Working on a web extension can be kinda wild — on one side you’re essentially just coding a website, on the other side you’re limited to what the browser says you can do in the extension execution environment. One change in that environment is coming January 2023 — pushing extensions to move to manifest version 3. I recently got curious about whether other popular extensions had completed the version 3 update. Executing the following command in the background page (manifest version 2) or service worker (version 3) will provide you the extension’s manifest: chrome.runtime.getManifest() The getManifest call returns a large object detailing the extension’s... more →
Posted in: JavaScript

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 replaces the first occurrence of a substring, not all occurrences. For example: 'yayayayayaya'.replace('ya', 'na'); // nayayayayaya To replace all instances of a substring, you’ve needed to use a regular expression: 'yayayayayaya'.replace(/ya/g, 'na'); // nananananana Using regular expressions is certainly powerful but let’s be honest — oftentimes we simply want to replace all instances of a simple substring that shouldn’t... more →
Posted in: JavaScript

How to Reverse an Animated GIF

Modifying visual media via code has always been a fascination of mine. Probably because I’m not a designer and I tend to stick to what I’m good at. One visual effect I love is seeing video reversed — it provides a sometimes hilarious perspective on a given event. Take this reversed water effect for example: To reverse an animated GIF or video, you can use the ImageMagick library: convert water-forward.gif -coalesce -reverse -quiet -layers OptimizePlus -loop 0 water-reversed.gif If you’re interested in media engineering, check out my previous ImageMagick tutorials. These awesome media libraries are as close to an artist I will ever get! The post How to Reverse an... more →
Posted in: JavaScript
1 58 59 60 61 62 190