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 (~84 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

The onboarding process described here is specific to a software engineer joining a tech company. While some/most of the items may still apply to any job where you mainly work from a computer, the assumption will be that you develop software as an individual contributor.

  • Setup laptop
  • Access to slack
  • Access to zoom
  • Setup calendar reminders
  • Initial meeting with buddy
  • Access to git central repository
  • Installation of development tools/languages
  • Access to CI/CD
  • Find where task management is done
  • Find the documentation to build projects
  • Connect 1 on 1 with each member of the team
  • Meet with manager 1 on 1
  • Define a 30-60-90 days plan with manager
  • Verify access to various systems (SSO, code repository, insurance company, payroll company, etc.)
  • End of week meeting with buddy

  • Setup and run the one step build process
  • Determine how are features/tasks prioritized, who prioritizes features/tasks
  • Review the team documentation
  • Review team practices/processes documentation (code style, code review, standups, planning, retrospective, demos)
  • Review common vocabulary, terminology, glossary documents
  • First PR + code review
  • Review the career ladder of the position

  • Review user definition, use cases, requirements

  • Identify how deployments are done
  • Review the team roadmap
  • Determine where I can have the biggest impact
  • Determine a timeline where I'll have reached my 80/20 at the company
  • Determine the maturity of existing projects
  • Determine fast can we iterate on certain aspects given the team/company composition
  • Identify the core/principal/staff contributors and their contributions
  • Review the architecture of the system
  • Review the database architecture
  • Learn about "how we got to this point"
  • Determine whether the product is a monolith or micro-services
  • Identify which (3rd party) tools are used by the team/company
  • Determine the portfolio of STARS situations of the team/company
  • Determine a rough estimate of the number of people in the different organizations
  • Connect 1 on 1 with important collaborator in other teams
  • End of first month meeting with buddy
  • First month performance review with manager
  • Informal 360-degree review with manager and peers on adaptation
  • Month 1 job satisfaction review

  • Month 2 job satisfaction review

  • Month 3 job satisfaction review
29 Nov 2020

Day trading in Canada

History / Edit / PDF / EPUB / BIB / 2 min read (~358 words)
finance stocks

Notice/Advisory: I am not an accountant nor a day trader. The following is not advice, only notes I've taken for myself. Content may be wrong or inaccurate. Use at your own risk.

The following is a list of items and things to think about if you would like to be a day trader. I wrote it with the intent of identifying what were the requirements to be a day trader and what would be the impacts of being considered as one vs being an investor.

  • Basics
    • Computer or phone
    • Internet
    • Broker
    • Money
  • Do not do day trading in your TFSA/RRSP/RESP accounts
  • Your gains/losses will either be categorized as capital gains (50% taxable) or business income (100% taxable) based on how you trade. In any case, since this is a day trading article, you can assume this will be business income. Here are some properties taken into account
    • Volume and frequency of trading
    • Length of ownership of securities
    • Type of securities owned
    • Your profession and level of stock market knowledge
    • If trading is your main source of income or substantially supplements it
      • Here it is not clear what substantially represents. I would estimate that anything below 25% of your non-trading income isn't substantial.
  • If you want to day trade, you will want to have access to level 2 data, which costs money depending on your broker
    • Some brokers will reimburse your data package fees if you spend a certain amount of money on commissions each month. For example, Questrade data package will cost you 90$/month, but if you spend over 400$ on commissions this fee will be rebated.
  • You do not need to register with the government or any agency
  • You do not need a minimal amount of money, although it is suggested to have a few thousands dollars otherwise you will not make a lot of profit daily and your commissions fees are likely to eat any profit you will make
    • Some brokers have minimum account balance
  • You have a trading strategy
  • Track your transactions
    • Time of entry/exit
    • Cost at entry/exit
    • Symbol/Ticker

15 Nov 2020

Habits

History / Edit / PDF / EPUB / BIB / 1 min read (~133 words)
habits
  • Decide what habit you want to have and record why you want this habit
  • Start with the smallest amount of effort possible
  • Increase the amount of effort regularly until you reach the desired amount of regular effort
  • Track your habit in a habit recording system such as Loop Habit Tracker
  • Review on a regular basis (monthly) whether you want to keep this habit or not
    • If you decide not to keep the habit, record why you decided to drop the habit such that if you decide to pick it up again, you can determine whether you might end up dropping it again.
  • It's not a problem if you miss doing your habit, just make sure to do it when you're supposed to