Craft By Zen

πŸ‘‹πŸ½ Hi! This is Jeremy's Craft by Zen


  • Intl Locale String with Timezone
    Posted

    It’s always fun when the MDN documentation doesn’t tell us what the options are within the methods page, I you have to dig deeper into the constructor. The TypeScript bindings don’t always make sense.

    MDN - toLocaleString

    Anyways, I needed a datetime string with the date, time in hours and minutes, and the timezone. I’ve made the timezone explicit and came up with this snippet.

    date.toLocaleString("en-us", {
      year: "numeric",
      month: "short",
      day: "numeric",
      hour: "numeric",
      minute: "numeric",
      timeZone: "America/Los_Angeles",
      timeZoneName: "short",
    });
    

    This would return something like β€œ2024-07-03, 12:00 PM, PDT”.

    Filed: 🚰 Stream
  • Chicago Recommendations
    Posted

    Travel recommendations to Chicago. For anyone who is looking on going for the first time.

    Filed: ✍🏼 Writing
  • Newsletter - June Bugs
    Posted

    Newsletter - We talk about having COVID and some web shares around the web, including China's Internet being wiped, Inbox Ten, in praise of amateurism, and exploring Jhanas.

    Filed: ✍🏼 Writing
  • 2024 Week 26 - Weekly Notes
    Posted

    jscodeshift notes, Dengue risk warning, SCOTUS latest rulings including overruling Chevron Doctrine, Dell's backlash for return-to-office, pop-up villages, Netflix's culture memo, and Claude 3.5 Sonnet.

    Filed: ✍🏼 Writing
    πŸ”– weeknote
  • jscodeshift Object Destructuring
    Posted

    The shorthand option is must be used in object destructuring to remove redundant prop: value to be prop.

    What I wanted was this shorthand:

    const { asFragment } = render(container);
    

    But what codemod generated was the following:

    const { asFragment: asFragment } = render(container);
    

    While both are true, I would rather have the shorthand, as that’s what we have strictly for eslint rules. This Github Issue helped describe the solution on how to implement in your transform file.

    const code = j.objectProperty(j.identifier("h"), j.identifier("h"));
    code.shorthand = true;
    
    j.variableDeclaration("const", [
      j.variableDeclarator(
        j.objectPattern([code]),
        j.callExpression(j.identifier("require"), [j.identifier('"packagename"')])
      ),
    ]);
    
    Filed: 🚰 Stream
  • 2024 Week 25 - Weekly Notes
    Posted

    Perplexity AI lying about their user agent, senior engineer fatigue, creating my first VSCode snippet, cutting an onion, and RIP Donald Sutherland and Willie Mays.

    Filed: ✍🏼 Writing
    πŸ”– weeknote
  • Embed TikTok videos in Obsidian
    Posted

    How to embed TikTok videos in Obsidian’s editing/live preview and reading mode.

    <iframe
      src="https://www.tiktok.com/player/v1/7382225350710824222?autoplay=0"
      allow="fullscreen"
      style="width:100%;height:50vh;"
    />
    

    where 7382225350710824222 is the video id you get from TikTok from this example link: https://www.tiktok.com/@_jen_hamilton_/video/7382225350710824222.

    The TikTok v1 player has a bunch of controls that you can use to modify from this documentation.

    There’s still some wonky height issues, and I suspect this is the default height Obsidian has on the container around the editor. I gave it a good enough viewable height of 50vh, which should be enough.

    Example Video

    Filed: 🚰 Stream
  • Running ESM on Node REPL
    Posted

    d3 v7 is packaged as ESM only. That made it difficult to use in the Node.js REPL. From this StackOverflow thread, I found a solution.

    let d3;
    import("d3").then((module) => {
      d3 = module;
    });
    // Then you can use d3 anywhere once the promise is resolved.
    
    Filed: 🚰 Stream
  • Posted
    Director: George Miller, Released: 2024
    As the world fell, young Furiosa is snatched from the Green Place of Many Mothers and falls into the hands of a great Biker Horde led by the Warlord Dementus.
    Filed: 🎞️ Films
  • 2024 Week 24 - Weekly Notes
    Posted

    Keeping a dev journal, book recommendations, how computers reduce efficiency, introduction to jhanas, some podcast notes about AI companies, and how do dogs see color.

    Filed: ✍🏼 Writing
    πŸ”– weeknote
  • Retrieval-Augmented Generation (RAG)
    Posted

    An explainer for Retrieval-Augmented Generation (RAG). Breaking down what it is and how people are implementing it.

    Filed: ✍🏼 Writing
    πŸ”– learning   ai
  • Package Dependency for @observable/plot
    Posted

    Extremely esoteric bug. I’ve had an open issue for the past three months related to this other issue. I couldn’t figure out why npm’s registry would pull an older version of d3-scale-chromatic when I upgraded the @observable/plot library. As a future note for myself, if I run into this issue again, I’ll have to go into the package-lock.json file and update d3-scale-chromatic to v3.1.0.

    Filed: 🚰 Stream
  • 2024 Week 23 - Weekly Notes
    Posted

    A change in format for weekly notes. Local rumblings like H5N1, international splashes with China's Internet disappearing, could AI solve science, the smart web could use our support, and engineering the slow internet from a user from Antarctica.

    Filed: ✍🏼 Writing
    πŸ”– weeknote
  • Stochastic Parrots
    Posted

    From this ACM paper, On the Dangers of Stochastic Parrots, the hypothesis is maybe these LLMs are parroting back what we already know and aren’t learning. We can probably, maybe, safely say that is no longer the case.

    Filed: 🚰 Stream
    πŸ”– politics
  • A Surprise "May" Be Afoot
    Posted

    Newsletter - Short Edition

    Filed: ✍🏼 Writing
  • 2024 Week 22 - Weekly Notes
    Posted

    Just Married!

    Filed: ✍🏼 Writing
    πŸ”– weeknote

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.