Manipulating strings with TypeScript
February 20, 2023Some tips on how to remove prefixes or suffixes with TypeScript to ensure safer types
Written by Ricardo Magalhães who works for the Internet. By day, a front-end web developer with a passion for typography and design. By night, he sleeps. Follow me on Mastodon.
Some tips on how to remove prefixes or suffixes with TypeScript to ensure safer types
Personal reflections and lessons on 2022.
One way to think about goals as a new year comes around.
Like most years, I do a self-reflection at the end of December on several life topics, for the sake of personal and public accountability.
A quick explanation on how and when to use the `Record` type in TypeScript. Records are useful, and they also spin you round round.
As a runner of almost ten years, I have a few thoughts and feelings on what it means to be a runner during the pandemic caused by COVID-19.
Understanding generics isn't the easiest concept to grasp in TS. Let's break it down gently, and start from scratch to see how and when they can be useful. This is part one of a series in TS.
In May of 2019, I set out to do a rather ambitious journey: running across Japan. Of course, not really running across Japan, but rather…
Every year, I find myself saying the same words all over again: “This is the year I’ll shoot more often, and be bolder with my photography!” And, of course, it never really lasts for long. But 2018 was a good year for photos.
Earlier in 2018, I spotted a random advertisement on Instagram which featured a cinemagraph. As the eternal amateur photographer, my mind immediately responded to this with a very loud and childlike desire to do the same.
Lately I’ve been thinking a lot about just how much impostor syndrome, paired with copious amounts of self-deprecating humour, have been hindering my ability to effectively grow both as a human being and as a software developer.
For as long as I’ve known this one very dear friend of mine, a friendship spanning for almost a decade now, I’ve been finishing most of our long conversations, often times in the form of a letter, with 3 simple words: 'Be love today'.
Few things are more fascinating than cities. Having lived in a few different countries around the world by now (🇵🇹🇬🇧🇩🇪🇨🇦) , I’m constantly thinking about how one city feels different than the…
But while newer flavours of the JS language gives us a more robust toolset to work with than ever before, without the use of libraries like Immutable.js, things can still look a little bit scary when…
Lately I’ve found myself coming back to a thought from Olivia Laing, which you can find in her immensely beautiful and emotion-stirring book The Lonely City. The striking power of this thought comes…
Variable Fonts are still in active development, and the CSS Fonts Module 4 spec fully embraces them as the future of typography on the Web. And yet, there is still some uncertainty about how they’ll…
When, and how, to use aria-describedby and aria-labelledby to significantly improve the a11y of your pages.
It barely matters how many books on typography I’ve read and will read: I struggle just as much as anyone else when it comes to finding a good typeface for a particular project. The message, the mood…
Typography entails an endless amount of disciplines and perspectives, and you’d be forgiven for finding certain aspects of typography… a bit boring. As an analogy, consider “learning about cars”…
Sass mixins support named arguments to be passed in, instead of leaving it up for guesses. Let's use them more, shall we?
You can send the result of multiple calls to an Express view using Promise.all
It took me 12 months and a rainy, uneventful Saturday afternoon in Berlin to finally pay a visit to the Deutsches Technikmuseum (German Technical Museum). Mostly driven by the promise of seeing cool…
Vietnam was, and still is, one of the places that heavily piqued my curiosity. The media, as well as most cinematic appearances, never really portrayed Vietnam outside of this unknown, almost…
It was a long overdue mission, mind you: my running shoes, which have been traveling with me for (quite) a while, have shamefully more holes in them than I could count. But it wasn’t until I came…
Hearing the word “disrupt” nowadays makes me cringe. It’s thrown around so much that it almost loses its meaning; tell anyone about a disruptive startup and you can even hear the sound of eyes…
Curiosity, combined with the willingness to see with my own eyes how the atmosphere of a region that very often has it rough from the eyes of the media, the press and all kinds of misinformed people…
From strangers on the Internet, from my mother and my friends, to hiring interviews in startups and just about every blog post nowadays, comes the question that makes me fumble for words every single…
It’s now been close to a year since I started to work remotely, so I thought I’d finally gather my thoughts on the topic and share my experiences with the world. What I once saw only as a work perk…
Getting back to street photography has been one of the best decisions I’ve made in a very long time. And luckily for me, London’s not a bad place to start again.
The ones carrying their luggage on the underground, the ones carrying a backpack on the anonymous crowded streets of Central London — are they coming or are they going? Where are they headed? Could…
They look sleazy and don’t often look you in the eye, so neither do you. You don’t often see them standing up, ever noticed it? Always slouching or sleeping or curled up into a corner holding on to…
Pretty much ever since humans developed a self-conscious mind, much has been said and written about the meaning of life and our purpose in being part of this grand scheme of things. And yet, despite…
Didn’t always, though. I guess what they say is true, it is an acquired taste. Also, I was always terrible with chopsticks. Good thing the food is already supposed to be eaten cold, because I would…
When I was a kid, I remember telling my parents that I didn’t enjoy the quietness of the bedroom when I went to sleep; hearing the life happening outside, cars going by, people talking, these made me…