How to stay focused in the work?

During the last weeks, I started experimenting a bit with the focus of the work.

Key takeaways:

Split your work into blocks.

The first block should be reading and communication.

You can close your Slack and email after you read all.

Put proper status so your peers will know that you are in the zone.

Do not sit too long in the zone, use the Pomodoro technique to do breaks often.

Close the focus block and then take a break for reading and communication.

Spotify can be your friend and also an enemy, the song which you do not like at the moment can distract you.

As a replacement, I can recommend mynoise.net which has a built-in Pomodoro timer.

Put your phone in a different room, and use the focus mode on your Apple Watch and MacBook to keep focus.

Sleeping – what I have learned

Time for a new episode of what I have learned! 🎬


Wanna be better? Sleep more 💤 During the last few years, I discovered that sleeping eight hours works best for me.
Focused more and much more productive I am 💪
I have tried sleeping less than six hours plus naps. It worked well till I missed the nap. Waking up was hard 😓
Monitoring your sleep is vital. Many researchers say that it is easiest to wake up in the REM, and I can confirm that ✅
That is why I switched recently from 7.5 to 8 hours. I missed the zone.
Now I can wake up and almost instantly jump into the action.


Sleep well 🙂

YAML anchors & aliases

Hey! Last week I was focused on moving the API specification from slatedocs to OpenAPI. This was the first that I had the pleasure of writing a schema by hand, before that I always generated it. I learned a lot and I would like to share one thing.

By default the OpenAPI allows you to define a schema for reusability. But there is one more thing that you can do for reusability – YAML anchors and aliases. By using it you can reuse much more than just a schema:

Czytaj dalej YAML anchors & aliases

Learning mindfulnes

Howdy, some time has passed since I wrote the last message 👋

I was enjoying the #vacations, but, also learning something new 🎁

The thing that I was #learning/enjoying is #mindfulness 🧘🏻‍♂️

This is a technique which always you to take control of your thoughts 🧠

There are many situations where your thoughts are distracting you or prevent the #focus 🤯

Examples.

When you have finished the working day, but your brain still is there, thinking about that task you did not finish 😑

You had an intensive block of focus work, you were coding for a few hours. But now you have a meeting, but somehow your head is not listening. Your mind is still in the #zone 👨🏻‍💻

Or you are still stressed after the presentation you just did 😬

But, how to do it?

Czytaj dalej Learning mindfulnes

Improving the tests with try-finally block

This week I have learned a neat trick that you can apply to your test cases. You are testing an edge case. The system under test is expected to throw an exception. But, after the exception, you need to do a few assertions. Usually, I did it this way:

/**
 * @dataProvider markAsUndeliverableFailDataProvider
 */
public function testMarkAsUndeliverableFail(Order $order): void
{
    $exception = null;

    try {
        $order->markAsUndeliverable();
    } catch (\Throwable $exception) {
    }

    self::assertInstanceOf(OrderStatusChangeFailed::class, $exception);
    self::assertTrue($order->isAlreadySentToProduction());
}

But, there is a better way to do it! Check out the much more readable version with try-finally:

/**
 * @dataProvider markAsUndeliverableFailDataProvider
 */
public function testMarkAsUndeliverableFail(Order $order): void
{
    $this->expectException(OrderStatusChangeFailed::class);

    try {
        $order->markAsUndeliverable();
    } finally {
        self::assertTrue($order->isAlreadySentToProduction());
    }
}

Viola! Look how clean this is 🔥

Sytuacja w IT a COVID – przemyślenia

Cześć! Żyjemy już dość długo w świecie pandemicznym. Tym razem opiszę swoje przemyślenia o tym jak COVID wpłynął na branżę IT. W tym wpisie przedstawię moje obserwacje oraz przemyślenia w trzech etapach. Na końcu znajdziesz podsumowanie, gdzie subiektywnie podsumowuję całość.

Świat IT przed pandemią

Jeśli pracujesz/pracowałeś w IT to wiesz jak to było. Zdecydowana większość pracodawców nie zgadzała się na pracę zdalna. Czemu? Bo przecież pracownik w domu, zamiast pracować, będzie zajmować się wszystkim, byle nie pracą.

Czytaj dalej Sytuacja w IT a COVID – przemyślenia

Wpływ silence operatora na error reporting w PHP

Hej, w dzisiejszym krótkim wpisie bierzemy na tapet słynny i jakże często używany operator @ tzw. STFU. Czy wiesz że jego użycie ma wpływ na error_reporting w PHP? Weźmy pod lupę ten przykład:

<?php declare(strict_types=1);

error_reporting(E_ALL);

set_error_handler(
    function () {
        // int(0) [PHP <= 7.4]
        // int(4437) [PHP >= 8.0]
        var_dump(error_reporting());
    },
    E_ALL
);

// int(32767) [E_ALL]
var_dump(error_reporting());

@trigger_error('warning', E_USER_WARNING);
Czytaj dalej Wpływ silence operatora na error reporting w PHP

Moje dwa lata z Huel – subiektywna recenzja

Hej! Dzisiaj temat kompletnie niezwiązany z programowaniem, czy IT. W kwietniu 2021 minęło dokładnie dwa lata od kiedy pierwszy raz zamówiłem Huel. Produkt, który zmienił moje nawyki żywieniowe, i pozwolił mi prowadzić zdrowszy tryb życia. Postaram się opisać wszystkie swoje spostrzeżenia. Myślę, że przez ponad dwa poznałem produkt dobrze.

Czytaj dalej Moje dwa lata z Huel – subiektywna recenzja

Przegląd tygodnia – jak być produktywnym ✅

Cześć! Pokażę Ci moje ulubione narzędzie, które pozwala mi utrzymać wysoki poziom produktywności. Dzięki niemu mam kontrolę nad tym co się dzieje w kolejnym tygodniu. Pozwala mi utrzymać porządek we wszelkich moich sprawach. Co tydzień, zazwyczaj w niedzielę wieczorem, planuję kolejny tydzień, przeglądając wcześniej różne rzeczy. Krok po kroku pokażę Ci jak to wygląda.

Czytaj dalej Przegląd tygodnia – jak być produktywnym ✅