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 causes 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
07 Mar 2021

Generic landing page

History / Edit / PDF / EPUB / BIB / 2 min read (~230 words)
landing-page
  • Company name
  • Product name
  • What problem we are trying to solve
  • How we are solving it
  • Why should you trust if vs our competitors
  • List what it can already do
  • List what we expect to be able to do
  • Link to our bug tracker
  • Subscribe to our mailing list
    • Become an alpha tester
    • Early access program
  • Email to contact for any question

  • A/B testing of the price

  • Testimonials

  • Full website

    • Packages/Pricing/Plans
    • Feature list
  • On signing

    • Send an email to a small survey
      • Establish the price range people would be willing to pay
      • Establish the type of model they'd be willing to accept
      • Check what feature they're the most interested in
      • Check which feature they'd like to see in the future
  • Events tracking
    • Seen sections of the landing page/
    • Mouse movement/heatmap/session recording (viewport + mouse position)

  • Define the information you want to collect/know more about

  • Unique Selling Proposition
  • Hero shot
  • Benefits of your offering
  • Social proof
  • Call-To-Action (single conversion goal)

  • The headline should inform the user what the product or service is all about

07 Mar 2021

Advertising yourself

History / Edit / PDF / EPUB / BIB / 1 min read (~27 words)
self-promotion
  • Produce content worth sharing
  • Get feedback from peers
  • Be vocal about your opinion
  • Have expertise on what you share your opinion about
  • Make yourself seen
    • Reddit
    • Twitter
07 Mar 2021

Improve part-time productivity

History / Edit / PDF / EPUB / BIB / 1 min read (~95 words)
productivity
  • It's difficult to remember/know the current state of a project
    • Keep notes of the work that has been done, what is left to do
      • Create a to do list first, then proceed from that to do list
      • Update the to do list as you notice things that should be/not be done

  • Determine what was worked on last time
  • Determine what needs to be worked on now (priorities)
  • Establish the current state of the project
    • Look at the state of tasks in the issues tracker
    • Ask others about the status of the project