Knowledge Updates

Observations while developing web applications and creating great software.

  • 1Password CLI and .env files ↗

    From NSHipster:

    We’ve touched on .env files in past articles about xcconfig files and secret management on iOS. But this week on NSHipster we’re taking a deeper look, exploring how the lesser-known 1Password CLI (op) can solve some problems many of us face managing secrets day-to-day.

    In case you’re not familiar with Twelve-Factor Apps:

    Around 2011, Adam Wiggins published “The Twelve-Factor App”, a methodology for building modern web applications that has since become canon in our industry.

    The third of those twelve factors, “Config”, prescribes storing configuration in environment variables:

    “Apps sometimes store config as constants in the code. This is a violation of twelve-factor, which requires strict separation of config from code. Config varies substantially across deploys, code does not.”

    This core insight — that configuration should be separate from code — led to the widespread adoption of .env files.

  • Fastfetch ↗

    Fastfetch is a Neofetch-like tool for fetching system information and displaying it prettily. It is written mainly in C, with performance and customizability in mind.

    brew install fastfetch

    Why Fastfetch?

    From the README:

    1. Fastfetch is actively maintained.
    2. Fastfetch is faster. As the name suggests.
    3. Fastfetch has a greater number of features, though by default fastfetch only has a few modules enabled; use fastfetch -c all to find what you want.
    4. Fastfetch is more configurable. You can find more information in the Wiki: https://github.com/fastfetch-cli/fastfetch/wiki/Configuration.
    5. Fastfetch is more polished. For example, neofetch prints 555 MiB in the Memory module and 23 G in the Disk module, whereas fastfetch prints 555.00 MiB and 22.97 GiB respectively.
    6. Fastfetch is more accurate. For example, neofetch never actually supports the Wayland protocol.

    Discovered from looking at this Ghostty post on X:

  • DOOM CAPTCHA

  • React Fibers, Scan, and Bippy ↗

    You may have heard of React Scan for automatically detecting performance issues. It uses Bippy internally. From the README:

    a react fiber is a “unit of execution.” this means react will do something based on the data in a fiber. each fiber either represents a composite (function/class component) or a host (dom element).

    fibers are useful because they contain information about the react app (component props, state, contexts, etc.). a simplified version of a fiber looks roughly like this:

    interface Fiber {
      // component type (function/class)
      type: any;
    
      child: Fiber | null;
      sibling: Fiber | null;
    
      // stateNode is the host fiber (e.g. DOM element)
      stateNode: Node | null;
    
      // parent fiber
      return: Fiber | null;
    
      // the previous or current version of the fiber
      alternate: Fiber | null;
    
      // saved props input
      memoizedProps: any;
    
      // state (useState, useReducer, useSES, etc.)
      memoizedState: any;
    
      // contexts (useContext)
      dependencies: Dependencies | null;
    
      // effects (useEffect, useLayoutEffect, etc.)
      updateQueue: any;
    }
    

    Further reading and watching:

  • MariaDB Sandbox Mode

    Today I ran into a problem I’ve never seen before when moving MariaDB databases between systems.

    ERROR at line 1: Unknown command '\\-'.

    Quickly searching on Perplexity revealed the problem. There was a dump file compatibility change in MariaDB which introduces a new directive on the first line of a dump file to disable the execution of shell commands:

    /*!999999\- enable the sandbox mode */

    There are several remedies available.