LH Log

Making Conditions Based on the Branch Being Deployed in Netlify

I love Netlify’s branch deploy feature. It allows you to automatically deploy a code located in a git branch on a different domain than your master/main branch. Whenever I write a new article I write it in a branch and then I can preview the article on the web on the branch domain. I wanted to forbid indexing of such branch deploys by robots like Google so the content doesn’t end up in the Google index.

Are there more odd or even numbers?

How can we tell if there are more odd or even numbers? What about the natural numbers? Are there more natural numbers, even numbers, or rational numbers? It’s not easy to tell because there are an infinite amount of natural or rational numbers. Yet, we can somehow compare their sizes. Let’s start with simple finite and small sets. Imagine two sets of numbers: blue numbers and red numbers. 1 2 3 4 5 6 7 8 9 Can we tell which set contains more numbers?

How Did We Become the Most Covid-Infected Country in the World 🇨🇿

The Czech Republic currently has the most newly confirmed cases of Covid and most Covid-related deaths in the World. How did a small country in Central Europe gain this achievement? In case you don’t know the Czech Republic: we have about ten million inhabitants, we are very good at brewing beer and even better at drinking beer. The black dot in the middle of Europe is us: (source) The First Wave We excelled in the first Covid wave.

How to Counter Zerg Units

A guide to StraCraft mode Direct Strike. If you struggle to counter specific Zerg unit in Direct Strike this can help you. How to Counter Zerglings Zergling is a biological light unit. Zergling is the strongest early-game unit, no unit counters a herd of Zerglings. Not even Banelings if you position Zerglings correctly. As Terran build Hellbats and upgrade Infernal Pre-Igniter (blue flame). As Zerg build a few Banelings and a few Roaches and eventually upgrade to T2 and build Lurkers and Infestors to Fungal the enemy’s Lings.

How to Counter Terran Units

A guide to StarCraft mode Direct Strike. If you struggle to counter specific Terran unit in Direct Strike this can help you. How to Counter Marines Marine us a biological light unit. It deals an incredible amount of damage in a short time but it’s pretty fragile. The key is to kill them fast. As Terran build more marines and mix it with Reapers for the grenade (KD8 Charge).

How to Counter Protoss Units

A guide to StarCraft mode Direct Strike. If you struggle to counter specific Protoss unit in Direct Strike this can help you. How to Counter Zealots In general, build anything that has bonus damage against light units. As Terran go to T2 and build a ton of Hellbats and upgrade blue flame (Infernal Pre-Igniter) which improves damage against light units. Do not build all the hellbats in a single line, use some circle-based formation.

How to use instanceof in switch statement in TypeScript

How to use the switch statement when checking whether some object is an instance of some class. If you don’t like long reading, skip to solutions: constructor based and DSL based. Imagine code like this: class Shape {} class Point extends Shape {} class Rectangle extends Shape {} class Circle extends Shape {} const shape = new Circle(); if (shape instanceof Point) { console.log('It is a point!'); } else if (shape instanceof Rectangle) { console.

Estimating Number of Unique Elements

Have you ever needed to count the number of distinct elements in a really large collection? I’ll walk you through some of the options you have. The Naive Solution Counting number of unique elements is a common problem in the computer science. Consider counting number of unique users that use Facebook each day. Or each month. This could be pretty big number. Billions of users! And counting it properly is possible, yet often not desirable because of performance issues.

SC2 Direct Strike Zerg Build

What units to build when playing as a Zerg in SC2: Direct Strike in 3V3 mode. You can also read my guide to Direct Strike for beginners. Against Another Zerg ZvZ is a fun matchup. I prefer to skip the first wave, go to T2, and then scan the opponent’s base. Then I decide to either: Go for Roach/Hydra composition. Roach/Hydra is an excellent composition because Roaches are good at tanking damage and Hydralisks are good at dealing damage.

Unit Testing Code That Uses a Database

Almost every application that we develop uses a database. It either stores data to a database or reads data from a database. Often both. Unit testing such code can be a tricky thing and we’ve tried multiple approaches to this problem. Eventually, we found a good compromise. For the sake of simplicity assume we have a function that communicates to a database: async function readPerson(personId, database) { const items = await database.

SC2 Direct Strike: Ultimate Guide

Welcome to Direct Strike’s beginner’s guide. If you are new to the game or if you want to read some tips on how to play better this is a perfect resource for you. Direct Strike Overview We’re going to talk about the standard 3v3 (or 2v2 or 1v1) format. The goal of this game is to build your units at the staging area and let them fight against your opponent’s units.

Every change to a public interface is a breaking change

Suppose we have a Typescript library called shapes exporting an interface called Point. What change can we make to this interface so we can release a new version of shapes as a minor change, not breaking anyone’s code? This is not an easy question as it sounds like. I’ve witnessed many people releasing a new version of a library as a minor change without realizing that this change is going to break someone else’s code.

Lukáš Havrlant

Hi, I’m Lukáš Havrlant and I live in the Czech Republic in a small city Opava. I’ve been working as a NodeJS/Typescript developer for many years. Currently employed by Ströer labs. I like green tea 🍵. I don’t like coffee ☕. I like to play StarCraft II. And I wrote one of the most visited websites about math in the Czech language matematika.cz!