Craft By Zen

๐Ÿ‘‹๐Ÿฝ Hi! This is Jeremy's Craft by Zen


  • TIL importmap
    Posted

    I forked a small demo from Wes Bos and ran in on my own sandbox. It seems much cleaner than using a script tag per each dependency, and works on all major browsers.

    In my little demo app, I placed the importmap in the head of the document. Iโ€™m using react as well as my own utils file to test out the functionality.

    <script type="importmap">
      {
        "imports": {
          "react-dom": "https://esm.sh/react-dom",
          "react": "https://esm.sh/react",
          "utils": "./utils.js"
        }
      }
    </script>
    

    Read more about importmap on MDN

    From there, I imported these libraries in a script module.

    <body>
      <div id="app"></div>
      <script type="module">
        /* eslint-disable */
        import { useState } from "react";
        import { createRoot } from "react-dom";
        import { formatMoney } from "utils";
        createRoot(document.querySelector(`#app`)).render(formatMoney(100.2365));
      </script>
    </body>
    

    I had a hiccup with [plugin:vite

    ] as I found countless others have, so I wrote a custom bun server to host this project. Hopefully thereโ€™s a better setup I can find with Vite using importmap in the future.

    Filed: ๐Ÿšฐ Stream
    ๐Ÿ”– TIL   programming
  • Luxon datetime library defaults startOf and endOf methods to UTC. But this isnโ€™t great for end users who donโ€™t live in UTC / GMT. To offset this, we need to grab the time zone offset from the userโ€™s system.

    const systemTimeZoneOffsetInMinutes = new Date().getTimezoneOffset();  
    const systemTimeZoneOffsetInHours = systemTimeZoneOffset / 60;
    

    Then we can add the offset to the Luxon datetime object.

    const now = DateTime.now();
    const startOfLocalDay = now.startOf('day').plus({ hours: systemTimeZoneOffsetInHours });
    const endOfLocalDay = now.endOf('day').plus({ hours: systemTimeZoneOffsetInHours });
    
    Filed: ๐Ÿšฐ Stream
  • 2024 Week 16 - Weekly Notes
    Posted

    Editing Advice, advice advice, second passports, sign posting, load balancing visualized, Figma's framework 2024, and the Hyperkey.

    Filed: โœ๐Ÿผ Writing
    ๐Ÿ”– weeknote
  • The "Boring" Stack
    Posted

    I was listening to this podcast: The boring JavaScript stack featuring Kelvin Omereshone (K.O.O) (JS Party #319). My takeaway is I should be using a boring stack to build my business ideas. Leave the shiny new toys for tinkering and use something stable.

    While Kelvin talks about the benefits of using Sails, I was thinking about the other โ€œboringโ€ things that constitute a boring stack. It goes beyond tecnologies, like how to run a business, how to organize your team, and how to market the product. And when those things are boring, they are unsexy and oftentimes neglected.

    Related: Kelsey Hightowerโ€™s nocode

    The best way to write secure and reliable applications. Write nothing; deploy nowhere.

    Filed: ๐Ÿšฐ Stream
  • Flag management in practice
    Posted

    An introduction to feature management using LaunchDarkly and if I use them as advertised.

    Filed: โœ๐Ÿผ Writing
  • I wrote a script that updates my daily notes to add properties. Since Iโ€™ve been using Obsidian for awhile, properties was introduced much later. Iโ€™ll walk through my code.

    // Get the current file title, which is in a common date format: YYYY-MM-DD
    const currentFileTitle = tp.file.title;
    
    // Set folder you want to get latest file for here
    const folder = "Calendar/Personal Reviews/journal and daily review/2022";
    
    // Get all files in that folder, including nested folders
    const filesInFolder = app.vault.getMarkdownFiles().filter(file => {
        return file.path.startsWith(folder);
    });
    
    // Sort files by file name
    filesInFolder.sort((a, b) => a.basename < b.basename ? 1 : -1);
    
    // Get the index of the current file
    const currentIndex = filesInFolder.findIndex(file => file.basename === currentFileTitle);
    
    // Get basename of previous and next TFiles to be used in link
    let previousEntry = '';
    let nextEntry = '';
    
    // Wrap it around a try catch block in case there's something wrong with getting these basenames
    try {
        previousEntry = `[[${filesInFolder[currentIndex + 1].basename}]]`
    } catch (err) {
        console.error(err);
    }
    try {
        nextEntry = `[[${filesInFolder[currentIndex - 1].basename}]]`
    } catch (err) {
        console.error(err);
    }
    

    Hereโ€™s my template that the templater plugin uses in markdown.

    <%*This is where the JS code above is inserted-%>
    ---
    tags: 
        - logs/daily 
    created: <% currentFileTitle %>
    previousEntry: 
        - "<% previousEntry %>"
    nextEntry:
        - "<% nextEntry %>"
    ---
    

    Iโ€™ve had to modify this depending if the file already has properties or not.

    Filed: ๐Ÿšฐ Stream
  • 2024 Week 15 - Weekly Notes
    Posted

    Film finds, SunoAI, Boeing and the Suicide Mission, Debugger's Toolkit, and OJ.

    Filed: โœ๐Ÿผ Writing
    ๐Ÿ”– weeknote
  • Elicit UX
    Posted

    I got a chance to play around with Elicit and was reading through Adam Wigginโ€™s Tweet. I think I might make a quick web app trying multi-column queries about a particular topic and allow more of a computational style of conversational chat.

    Computational style of conversational AI using Elicit
    Computational style of conversational AI using Elicit
    Filed: ๐Ÿšฐ Stream
    ๐Ÿ”– ux   LLMs
  • Setting up SVGR with Jest
    Posted

    I was getting some errors in my unit test output because I converted my SVGs to React components using SVGR. As such, I needed to re-configure Jest accordingly.

    1. Create the mock file
    export default "svgr-div"; // This is the kebab case that jest is looking for
    export const ReactComponent = "div";
    
    // @see https://react-svgr.com/docs/jest/ for setup
    
    1. Configure jest in package.json
    {
      "jest": {
        "moduleNameMapper": {
          "\\.svg": "<rootDir>/PATH_TO_FOLDER/svg.js"
        }
      }
    }
    
    Filed: ๐Ÿšฐ Stream
  • Open Office Hours
    Posted

    In practice, you try to eliminate task barriers that require back and forth communication by setting dedicated block of time to meet. An office hour, reminiscent of your professorโ€™s office hours, means you broadcast to your working network you are available in this block of time to chat about open loops.

    The problem this solves is eliminating the number of unknowns in your work, whether that be client feedback, questions about a design contract, or ambiguous bug tickets. These tasks become open loops are require external help in order to uncover what tasks you have to do next. It also lowers the communication gap with your work network or team and bridge that gap of understanding. The end goal is it helps with end output and/or goals.

    Championed by Cal Newport and highlighted in his book, Slow Productivity.

    Filed: ๐Ÿšฐ Stream
  • VSCode Fuzzy Search
    Posted

    In VSCode, open your palette, and type %, you get a fuzzy search across your files. And you can use navigational keybindings like cmd+up or cmd+down .

    Fuzzy search screenshot
    Fuzzy search screenshot
    Filed: ๐Ÿšฐ Stream
  • Context Archival
    Posted

    I periodically try to dump all of my mental contexts into my notes. I noticed this comes in a few different flavors.

    • Safari Tabs on my iPhone and iPad: Goes into daily notes
    • Random thoughts - go into drafts and get processed daily
    • Shopping - including groceries, bills, and things I would like but not need. Those all go into a task manager
    • Dangling tasks - gets reviewed in the task manager inbox weekly
    • Personal thoughts - journaling every two weeks, although I want to do this more often
    • Events I have not logged - go into my calendar.
    • Downloads folder - weekly processed into other folders.
      • Long-term storage in Dropbox and backup drive.
      • Short-term in Inbox folder
    • Photos - place special ones in folders. Select shots in favorites.

    I am trying to think of other things that I purge. I used to write in a notepad and write on the page of everything I was thinking about. I used to write about people I have not spoken to in a long time that I should reach out to, mantras I came up with, or completely random thoughts.

    Tiago Forte recommends putting all unused files into an Archive folder. This This activity helps remove our digital file mess and stops us from immediately organizing everything.

    Filed: ๐Ÿšฐ Stream
  • 2024 Week 14 - Weekly Notes
    Posted

    April Fools Round-up, primer on .xz hack, the web dev market, Taiwan's earthquake, and the sad stories about the A's move.

    Filed: โœ๐Ÿผ Writing
    ๐Ÿ”– weeknote
  • Introducing the Stream
    Posted

    My personal stream of thoughts, ideas, and inspiration.

    Filed: โœ๐Ÿผ Writing
  • OODA Loop
    Posted

    Stands for Observe-Orient-Decide-Act (โ€œOODAโ€) Loop. Itโ€™s an iteration because it feeds back into itself. Initially applied for military use, but has since been used for business decision-making and personal development.

    • Observe the situation and mentally note any key data points.
    • Orient by placing data in the context of existing knowledge and mental maps to create a picture of the current situation.
    • Make a decision on how to act in light of that situation.
    • Act and assess for any necessary adjustments.

    Source: Sahil Bloom - The Curiosity Chronicle

    Filed: ๐Ÿšฐ Stream
    ๐Ÿ”– mental models
  • RSS Feed Clean-up
    Posted

    Iโ€™m finally cleaning up my RSS feeds because itโ€™s too untenable. In my Readwise Reader, my inflow is far greater with things I know I wonโ€™t read over things that I know Iโ€™ll read later. Hence trapping me in a cycle of scrolling over reading. Iโ€™m going to unsubscribe from a bunch of things.

    Filed: ๐Ÿšฐ Stream

I'm currently leading application development at Clear Labs.

I write essays on eclectic topics, from programming, cooking, and strange habit of collecting obituaries.


๐Ÿ”– Top 10 Tags


Newsletter Series

I have put back together my newsletter after years of absense! These are primarily updates on my blog, "Craft By Zen", and maybe some highlights to the new articles I've written. There might be some life updates as well. I'm doing away with the old format of weekly longform essays, and trying some new things with my newsletter.

Powered by Buttondown.