The Campaign for More Winter Sun / / No Comments Today the residents of New York will see less than nine and a half hours of daylight. This lack of sunlight can lead to many people feeling SAD. Which is partly why every year there are calls to end the annual switch to standard time from daylight saving time, the result of which is that the sun sets even earlier every cold winter day. It is also why FiveThirtyEight has asked the question Can Maps Mania… more → Posted in: Interactive Maps Tagged with: campaign, More, Winter
Short Number Formatting in Python / / No Comments Yesterday I wrote a blog post about creating short number formats in JavaScript. Definitely check out that post first, but the idea was to take something like 9496301 and display it as 9.5M. In that post, I used the built-in Intl object and it worked really well. It got me thinking, could you do the same in Python? First off, I checked and was happy to see that like JavaScript, Python supports numeric separators. This makes it much easier to read large numbers in code. It also meant I could take my test array and copy and paste it into a Python program: inputs = [ 999, 1000, 2999, 12_499, 12_500, 430912, 9_123_456, 1_111_111_111, 81_343_902_530, 1_111_111_111_111, 62_123_456_789_011,... more → Posted in: JavaScript Tagged with: Formatting, Number, Python, Short
The Land of Generation X / / No Comments Modal Age by Neighbourhood is an interactive map which visualizes the median age of the population in English and Welsh neghborhoods (middle-layer super output areas), using data from the 2021 census. The map provides a fascinating insight into the average ages of the countries’ towns and cities (a Median Age map is also available).By area of land (but not necessarily by population) England and Maps Mania… more → Posted in: Interactive Maps Tagged with: Generation, land
How to Determine a JavaScript Promise’s Status / / No Comments Promises have changed the landscape of JavaScript. Many old APIs have been reincarnated to use Promises (XHR to fetch, Battery API), while new APIs trend toward Promises. Developers can use async/await to handle promises, or then/catch/finally with callbacks, but what Promises don’t tell you is their status. Wouldn’t it be great if the Promise.prototype provided developers a status property to know whether a promise is rejected, resolved, or just done? My research led me to this gist which I found quite clever. I took some time to modify a bit of code and add comments. The following solution provides helper methods for determining a Promise’s status: // Uses setTimeout with... more → Posted in: JavaScript Tagged with: determine, JavaScript, promises, status
A Little Map Fun x 3 / / No Comments If you want to celebrate New Year’s Eve in style then you should boogey on down to the Map Disco. The animated GIF above really doesn’t do Map Disco justice – because this GIF is missing sound. Visit Map Disco yourself and you can watch the countries of the world lighting-up to the amazing sounds of the Bee Gee’s classic ‘Staying Alive’. Slightly more ambient sounds can be enjoyed on Steve Maps Mania… more → Posted in: Interactive Maps Tagged with: Little
Wrapping Up 2022 / / No Comments I have a tradition here where – usually – I write up a "here’s what I did this year" post. Typically I write this just for myself as I figure it’s a good way to take stock and really appreciate what I’m accomplished. Sometimes it’s just a nice way to say goodbye and look forward to the next year. I feel like every year is incredibly busy as well as exciting, but kind of in the Chinese curse manner. That being said – my kids are healthy and happy, my wife is healthy and happy and I’m well employed. No matter what else happens, that’s a win for the year over all. What I Accomplished This was a huge year for my blog and I’m very... more → Posted in: JavaScript Tagged with: 2022, Wrapping
Detecting Fonts Ready / / No Comments Knowing when resources are loaded is a key part of building functional, elegant websites. We’re used to using the DOMContentLoaded event (commonly referred to as “domready”) but did you know there’s an event that tells you when all fonts have loaded? Let’s learn how to use document.fonts! The document.fonts object features a ready property which is a Promise representing if fonts have been loaded: // Await all fonts being loaded await document.fonts.ready; // Now do something! Maybe add a class to the body document.body.classList.add('fonts-loaded'); Font files can be relatively large so you can never assume they’ve loaded quickly. One simply await from... more → Posted in: JavaScript Tagged with: Detecting, Fonts, Ready
Santa Tracker Maps / / No Comments Santa has begun work on his busiest day of the year. This year you can follow Santa’s journey around the world, as he delivers presents to all the world’s children, on both the Google Santa Tracker and the NORAD Santa Tracker.The Official NORAD Santa Tracker uses NORAD’s geo-synchronous satellites to detect the heat signature of Rudolph’s red nose. It is then able to track Santa’s sleigh as it Maps Mania… more → Posted in: Interactive Maps Tagged with: maps, Santa, tracker