02 Jun 2021

One on one

History / Edit / PDF / EPUB / BIB / 1 min read (~191 words)
  • Define and agree on the purpose of the one on one
  • Define the topics to be discussed prior to meeting
  • Track and update metrics that you care about every time you meet
    • e.g., Predictability, Ownership, Purpose, Progress, Belonging
  • Discuss the status of those metrics if necessary
  • Write in a shared document (between the two of you) what is discussed
  • If any action items are defined during those meetings, use a task tracking system to keep each other accountable
    • Always define a deadline on tasks to indicate when the task should be revisited

01 May 2021

Answering coding interview questions

History / Edit / PDF / EPUB / BIB / 1 min read (~155 words)
  • Read the problem statement
  • Look at any provided unit tests
  • Add any unit tests you think might be relevant and not currently covered
  • Order the unit tests from easiest to hardest
  • Ask questions to confirm your understanding of the problem and verify edge cases
  • Think of a possible approach to solve the problem
  • Share your approach with the interviewers and get their buy-in
    • You may do this by writing pseudo-code as you are explaining your thought process
  • Implement your solution
    • If you encounter any difficulties, state them and explain what you are thinking
    • Make use of preconditions/early exit if possible to handle empty cases
  • Run your code frequently, even if it is not fully working
  • Discuss any follow-up questions with the interviewers
21 Apr 2021

Managing your reading

History / Edit / PDF / EPUB / BIB / 2 min read (~383 words)

The process described below attempts to optimize reading quality books and enjoying the reading experience. As such, it promotes book exploration (discovery of new books) and reading books which have a high rating according to your own taste. Books which receive lower ratings (compared to other books) are moved down the reading priority list and will not be read until books that have higher priority (i.e., rating) either are finished reading or their rating decreases such that other books are now high priority.

  • Pick highly read books (use a site like goodreads to identify those books).
  • When reading a book, record the page you start and stop reading on, the time you start and stop reading and emit a rating for what you've read.
    • You can decide to optimize whether you want to optimize per page rating or per duration rating, that is, get the most value per page or by time spent reading.
  • Add new books to your reading list regularly. Those books are considered as having the highest priority and are then added to the prioritized list of books according to its rating.
  • When not reading a new book, read the books in order of priority and by interest at the time of reading.
  • From time to time you may look at your list of prioritized books and decide whether the books with the lowest priority should ever be finished. In some cases it is reasonable to decide that certain books will never be read completely.

I make extensive use of Laravel Debugbar to track performance of parts of my application. I sprinkle calls to Debugbar::startMeasure and Debugbar::stopMeasure to track the duration of certain segments of my code. However, when this code goes into production, this dependency isn't present. This cause the code to break since it cannot find Debugbar anymore.

To solve this issue, I thought I would create a dummy Debugbar class and have it added as an alias, so that any code depending on Debugbar would still work, but end up as a "no operation". I found the article Dynamic class aliases in package which introduced the necessary piece of information to accomplish this.

<?php

use Illuminate\Foundation\AliasLoader;
use My\SuperPackage\FooBar;

class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
    public function register()
    {
        $this->app->booting(function() {
            $loader = AliasLoader::getInstance();
            $loader->alias('FooBar', FooBar::class);
        });
    }
}

In my desired use case, I simply implemented the following changes:

In app/Providers/DebugbarServiceProvider.php (a new file)

<?php

namespace App\Providers;

use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;

class DebugbarServiceProvider extends ServiceProvider
{
    public function register()
    {
        if (!class_exists('Debugbar')) {
            $loader = AliasLoader::getInstance();
            $loader->alias('Debugbar', NullDebugbar::class);
        }
    }
}

class NullDebugbar
{
    public static function __callStatic(string $name, array $arguments)
    {
        // Do nothing
    }
}

In app/config/app.php

    // under the 'providers' key, add
    'providers' => [
        [...]
        // This will take care of loading the service provider defined above
        App\Providers\DebugbarServiceProvider::class,
    ],

With those two changes, it is now possible to make use of Debugbar in most places and have it work even without the Laravel Debugbar dependency installed.

07 Mar 2021

Closing tabs

History / Edit / PDF / EPUB / BIB / 1 min read (~162 words)
browser tabs

  • Want to read but
    • Too long -> Transfer to pocket
  • Want to watch but
    • Too long -> Add to a youtube watchlist (which I'll never watch)
  • I need them open to quickly enter data
  • I want to watch them again and again
    • Download with youtube-dl and watch using VLC
  • Would maybe read one day, but definitely not now (very low priority)
    • Transfer to pocket

  • If a tab is scanned more than 5/10 times, it goes into the backlog bin