Relatively positioned images with correct aspect-ratio finally work in next/image. The biggest challenge using next/image(new tab) has always been relatively positioned images that stretch to their container but still keep their aspect ratio. You would either have to specify an absolute width and height or use a hard-coded padding-bottom: 45% to artificially create an aspect ratio.
With the new, improved version, we can finally do it:
<divstyle={{position:'relative'}}>
<Image
src={src}
alt={alt}
width={0}
height={0}
sizes="100vw"
style={{width:'100%',height:'auto'}}
/>
</div>
Sep 18, 2023
Rock, paper, scissors is not actually pure luck. Research by Besty Levy Paluck(new tab) shows there actually exists a gender bias with two crucial findings. Men tend to start with rock while women prefer scissors more often. On top of that, men repeat the same figure more often while women prefer switching up.
Aug 27, 2023
Using router.asPath for calculations can cause hydration errors. For one of our documentation pages at Carla(new tab), we use router.asPath as to check whether the current page matches one of the side navigation items to highlight them as the current page. This works fine until you add a hash value to the URL e.g. when using anchor links to navigate the page. Since the hash part of URLs is only accessible on the client, you might run into a client-server mismatch causing a nasty hydration error.
Aug 18, 2023
Humans can't store protein. Learned it from Stanford's Professor Christopher Gardner(new tab). At the end of the day, any excess protein is being turned into carbs and fat by taking off the nitrogen. This means, as long as we get enough protein through our diet - which actually is almost always the case - there's really no reason to take additional protein e.g. via protein shakes. Apart from wasting money, it usually doesn't harm you though, as the nitrogen is turned into ammonia and then excreted by our kidneys. But, if you already suffer from kidney problems, you should be cautious!Check the full interview on YouTube(new tab)
Jul 21, 2023
6 is the number people tell you when they're unhappy. Read about this in the article Numbers To Know For Managing(new tab) by Stay SaaSy(new tab). This one changed my perspective on company surveys and numerical feedback. As a manager, I frequently use scales to rate things and get feedback. A typical example would be a question like "How satisfied are you with your role" where the individual can choose a number between 1 and 10. I used to be very naive about the results, thinking that everyone above 5 would be fine, while only everything below is really worrysome. But it seems to be quite different. People usually choose everything from 7 to 10 if they're actually satisfied. A rating as high as 6 could already mean that they're preparing to quit. I wouldn't agree that it's always the case, but definitely something to look out for.
Jul 17, 2023
One does not need a booster vaccination for tetanus and diphtheria This is a weird one, but I recently realised that my last tetanus shot was over 11 years ago and I remembered that I was told to get a booster after 10 years. As someone who's outside a lot - be it gardening, hiking or something else - I'm at high risk of getting a tetanus infection, so I was really keen to get my booster as soon as possible. But before wasting my time going to a doctor just to figure out I was wrong, I quickly checked the web and saw that the WHO changed their recommendations. New studies found(new tab), that as long as you've had the full basic immunisation as a kid, the protection lasts a lifetime. The same is true for diphtheria.
Jul 11, 2023
JavaScript supports chaining `await` calls Learned this from a tweet by TheWindHasAWay(new tab). Awaits can be chained with parenthesis in a single line. I still prefer to use separate lines for readability, but I didn't know it's possible.
Reverse-engineering the interview process Heard about this practice on the Managing Up(new tab) Podcast. Hiring great people is a challenging task. It already starts with the job ad. Turns out it's not as straightforward as it might seem to figure out what one is searching for. What skills should a candidate bring? What values are really important to us? Instead of trying to figure that out from scratch, there's a much simpler solution: Reverse-engineer the process by looking at the people that already work with you. What is it that makes them great colleagues?
Jun 28, 2023
Name it to tame it Learned this in Josh Tichauer(new tab)'s blog post The power of empathy in software development leadership(new tab) about emotional intelligence. He starts by talking about how important emotional intelligence is as a manager and later recommends a technique to develop it."Emotional intelligence enables you to respond to difficult situations with empathy and compassion, rather than frustration or anger. It also helps you to build deeper relationships with your team members, as you are able to connect with them on a more personal level."He recommends the "Name it to tame it" technique to develop emotional intelligence and it's quite simple: You name the emotion you are feeling which helps to regulate the amygdala, the area responsible for processing emotions. This technique allows you to respond to challenging situations with clarity and compassion, rather than being controlled by your emotions.
May 21, 2023
Humans have a mild version of mono-hemispheric sleep And yet another one from Why We Sleep(new tab). You might have heard, that some animals, especially aquatic animals and birds, are capable of sleeping with only one half of their brain while the other half stays active. This is called mono-hemispheric sleep. Have you ever thought whether we humans can do that to? Sounds weird, right? But actually, we have a very mild version too! Studies haven shown that when we're in a new environment e.g. in a hotel room, one half of our brain stays alert while the other is fully asleep.
May 15, 2023
Preindustrial humans slept biphasic Another learning from Matthew Walker(new tab)'s book Why We Sleep(new tab). I always thought humans have slept monophasic forever, but it turns out that we actually slept biphasic before the industrialisation. In fact, some tribes whose lifestyle pretty much didn't change too much in the last 10.000 years are still sleeping biphasic today. But how actually do they sleep? While they also sleep for 7-8 hours during the night, they add an additional 30-45 minute nap at noon.
Mar 24, 2023
overflow: hidden on html finally works in iOS Post incoming on this topic, but while doing research on blocking background scrolling for overlays I learned that the issue was finally fixed in Webkit and overflow: hidden now works properly even on the main scrolling element in iOS.
Mar 10, 2023
Letting someone go is much harder than fair salaries Might sound obvious, but when we did the salary negotations, I wasn't really anticipating that I'd have to let someone go in the near future. Needless to say, that it was one of the most challenging things in my career yet and most definitely the toughest thing as a manager.
Lay offs suck.
Feb 26, 2023
Drinking coffee after noon drastically impacts your sleep Matthew Walker(new tab), author of the book Why We Sleep(new tab) talks about caffeine's disruptive effect on your sleep on Dr. Ragan Chatterjee(new tab)'s podcast(new tab). Caffeine has a halflife of about 6-7 hours and a quarterlife of around 12 hours. Meaning, if you drink a coffee at noon, that means that a quarter of the caffeine is still in your system. That's equivalent to drinking a quarter cup of coffee right before go to bed.Check the full video on YouTube(new tab)PS: If you drink coffee purely for it's smell and taste, you might try some decaffeinated coffee next time. I switched over - for different reasons - and got happily used to it!
Feb 21, 2023
Suggestions from a powerful person tend to be followed Today's learning comes from another book: The Culture Code(new tab) by Daniel Coyle(new tab). It might seem obvious at first, but I had to experience myself first to fully understand what it means. In product-focused companies, it's not uncommon that cross-functional teams work on a specific part of a product, effectively owning all processes and decisions. Yet, there often is some kind of approval process that includes C-level executives, if not the CEO themself. A team might have put a lot of effort into a feature, including research and data gathering, but sometimes a single comment from upper management can lead to a lot of uncertainty, stress and last-minute changes in the end. Most often it turns out that it wasn't even meant that way, but the suggestion is still followed. How would you possibly disagree with your CEO, right? Turns out, you need to be very careful with whom you ask for feedback and powerful people need to be very careful with what they say, even if it's just a little comment on something, because - even if you don't like it - it might eventually be followed.
Feb 19, 2023
Grapefruits block enzymes that clear drugs Another one from How not to die(new tab). This can be both positive and negative. For example, if you use a painkiller, you can prolong it's effect by eating a grapefruit. But it's also very dangerous e.g. when you're taking multiple pills and they intefere with each other.
Feb 16, 2023
Chopping brokkoli 40 minutes before cooking preserves sulforaphane I'm currently reading How not to die(new tab) by Michael Greger(new tab) and learned that brokkoli, which is super rich in sulforaphane, a substance that has many beneficial properties, needs to chopped 40 minutes before cooking in order to preserve it.
Feb 09, 2023
Graveyards can be beautiful places for mental retreat I'm not a religious person and thus I never really had a strong urge to visit a graveyards. Actually the concept of visiting the burried remains of deceased loved ones feels super weird to me. To put it simply, I usually avoid such places. However, I'm using my walks for self reflection a lot lately and thought I could check out the public graveyard of my hometown, Karlsruhe. Within weeks it became my favorite place to spend time outside and I regularly plan it into my route. Not only is it the perfect place to calm down, but it also is probably the most beautiful site in the whole city. There are artifical water courses, thousands of different plants, bushes and trees as well as birds, squirrels and other animals everywhere. It's probably a bit ironic, but in some way it's the most lively place in walking distance.
Permanent redirects are scary I recently lead a project which was all about improving our URL structure and hierarchy, primarily for SEO. At first glance, it sounded rather straightforward. I went in, renamed the respective files in our Next.js application and updated all internal and external links to all pages affected. In order to have a smooth update experience, we also set up permanent redirects for all paths to make that customers with old links still end up on the right page. So far so good. Here comes the problem: Not even an hour later, we realised that our redirects haven't been exhaustive. Turns out, the sheet we used to set them up was outdated and a lot of pages where missing that now followed a generic redirect and resulted in a lot of 404s. If you're wondering why we missed it during our QA process: We use a different database for our staging environments, so this discrepancy went unnotice. Long story short: Since it was already live and customers already had the new permanent redirects fetched, there was no going back. We tried to act fast on it and eventually pushed 5 consecutive fixes each introducing other issues like redirect loops and typos.
My takeaway: Be very careful with permanent redirects.If you want to be extra safe, start with temporary ones and switch over to permanent once everything has been tested successfully.
Feb 02, 2023
Fair salaries are extremely hard in remote tech teams Let's be honest. Salaries are always a delicate topic. In my career, I already had quite a few different negotations from 1-1 with my manager to open team discussions. Yet I was always on the employee side though. This year I'm facing my first full salary review as an engineering manager and to be fully honest again: I had no idea how hard it is. For small teams where everyone lives in the same area and has the same currency it might be straightforward, but dealing with a distributed remote-first team with different local currencies and thus different exchange rates is such a tough task. The goal for everyone is to have fair salaries of course, but what is fair? Do you pay the same salaries, no matter where people are located? Do you consider different tax rates and cost of living in general or is it purely performance based? Do you use a base currency and calculate the rest with the current exchange rates? How do employee salaries compare to consultant rates? Would love to hear how others are doing it, feel free to reach out to me!
In addition to that, it doesn't help that we're facing a huge regression in the industry right now with tons of layoffs everywhere in tech.
Feb 01, 2023
Reflecting on one learning per day is great I've done it in the past, but for some reason I never really kept up with it: Writing down one thing that you learned each day is a great way to reflect on your day and appreciate what you're doing. Therefore, I'm starting this little page to remind myself to add those learnings from time to time.