Earthquakes with Depth / / No Comments Earthquakes with Exaggerated Depth is an interactive globe which visualizes one year’s worth of earthquake activity around the world. The map was created by Esri’s Raluca Nicola using data from the USGS.On Raluca’s transparent globe earthquakes which occurred between July 2017 and July 2018 are shown with their depth exaggerated by a factor of eight. Each earthquake is shown on the map using a Maps Mania… more → Posted in: Interactive Maps Tagged with: Depth, Earthquakes
How to Use window.crypto in Node.js / / No Comments 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 methods, you will need Node 15+. You can set the window.crypto by importing the crypto package and setting it on the global: const crypto = require('crypto').webcrypto; // Shims the crypto property onto global global.crypto = crypto; I really loathe creating mock functions for missing libraries in Node because they can lead to faulty positives on tests; I really appreciate webcrypto... more → Posted in: JavaScript Tagged with: Node.js, window.crypto
Explore the First Route Around the World / / No Comments On September 20 1519 five ships set out with 239 men from Sanlúcar de Barrameda in Spain. Their goal was to find a new route to the Moluccan Islands, in Indonesia. On September 6 1522 just one of those ships, the Victoria, landed back in Spain. It was the first ship to have circumnavigated the globe. Only 18 men returned to Spain on the Victoria. Many of the others died on the journey, Maps Mania… more → Posted in: Interactive Maps Tagged with: around, Explore, first, route, World
How to Internationalize Numbers with JavaScript / / No Comments 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? Don’t — JavaScript provides a method do the hard work for you! The Number primitive has a toLocaleString method to do the basic formatting for you: const price = 16601.91; // Basic decimal format, no providing locale // Uses locale provided by browser since none defined price.toLocaleString(); // "16,601.91" // Provide a specific locale price.toLocaleString('de-DE'); // "16.601,91" // Formatting... more → Posted in: JavaScript Tagged with: Internationalize, JavaScript, numbers
How to Extend Prototypes with JavaScript / / No Comments 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 believe that the ability to extend native prototypes is a massive feature of JavaScript. Let’s check out how easy it is to empower every instance of a primitive by extending prototypes! Every JavaScript native, like Number, String, Array, Object, etc. has a prototype. Every method on a prototype is inherited by every instance of that object. For example, we can provide every `Array... more → Posted in: JavaScript Tagged with: Extend, JavaScript, Prototypes
Mapping Mariupol’s Destruction / / No Comments A Timeline of Mariupol’s Destruction is an animated map which visualizes the damage caused to buildings by the Russian attacks on the Ukrainian city of Mariupol. The map shows damage caused by Russian bombing between March 5th and July 29th of this year. The city of Mariupol was under siege from Russia from 25th February until 17th May 2022. In March the Red Cross declared the siege a Maps Mania… more → Posted in: Interactive Maps Tagged with: Destruction, Mapping, Mariupol's
Quick LiquidJS + Eleventy Example – All Posts / / No Comments So, on a whim today I decided to add a page to my blog to display every single post, separated by year. This was not meant to be used by anyone (hence me not linking to it in the nav), but something I’ve wanted around for a while. I’ve got a nice search form here, but sometimes I want to search for something I blogged a few weeks ago and having a simple list of posts would be useful. I didn’t want to build "proper" pagination, just one giant list in on an HTML page. That’s not the best UX but as I’m building this for me, I approve. I thought it would be a quick little script, but as I built it, I ran into a few interesting... more → Posted in: JavaScript Tagged with: Eleventy, example, LiquidJS, posts, Quick
Top 5 Moving Maps / / No Comments Day 23 of the #30DayMapChallenge calls for participants to create a map around the theme of movement. This year the vast majority of the maps I’ve seen posted on social media in response to the #30DayMapChallenge have been static maps. I’m hoping that the theme of ‘movement’ might inspire a few more participants to venture into creating interactive maps on the 23rd. Static maps can certainly Maps Mania… more → Posted in: Interactive Maps Tagged with: maps, Moving