Parametric Studios Logo Parametric Studios
  • Posts
  • Build An Intersection Observer Directive In Vue

    In this post, I want to share my experience integrating the IntersectionObserver API into a Vue app. By the end, we’ll have a custom directive that abstracts dynamically registering and unregistering DOM elements with an observer. Intersection Observer When you need to track an element coming into view, watching document scroll and calculating element offsets used to be the only way. The math isn’t particularly complex, but knowing which layout properties to use and just how to calculate position relative to the right elements is a painful task.…

    • JAVASCRIPT
    • VUE
    • INTERSECTION-OBSERVER
    Alex Regan
    Alex Regan

    Jun 6 · 12 min read

  • Idle Map

    When you have code to run that’s async, you have a few options. You can work with a Promise, schedule something to run at a later time with setTimeout, or schedule in coordination with the browser’s render cycle via requestAnimationFrame. Each has its own strength, but now there’s a new tool in our async toolkit: requestIdleCallback. I want to show off a trick to mix up promise-based tasks against the new requestIdleCallback API (we’ll just call it rIC).…

    • JAVASCRIPT
    Alex Regan
    Alex Regan

    Jun 3 · 3 min read

  • Wrapping Errors

    When performing I/O in Node.js servers, there is a lot of error handling to deal with. I always look to add as much context to errors as I can because it greatly reduces the time it takes me to find, understand, and fix bugs. We won’t go into an error propagation strategy here (that will be part of some of the upcoming material), but I wanted to share a quick idea for how to decorate errors with context as they propagate through the stack.…

    • JAVASCRIPT
    • ERROR-HANDLING
    Alex Regan
    Alex Regan

    Feb 14 · 6 min read

  • Pattern Matching Custom Data Types in Typescript

    Our application data comes in all shapes and sizes. We choose the best data structures for our problem, but when we need to put a variety of our data through the same pipeline, we have to manage safely distinguishing our data types and handling all their possible variations. In this post, I want to share a pattern I’ve discovered for working with different data types in a homogenous way. You can think of it as a functional programming version of the adapter pattern.…

    • TYPESCRIPT
    • FUNCTIONAL-PROGRAMMING
    Alex Regan
    Alex Regan

    Feb 2 · 11 min read

  • Blog Launch

    Welcome to the blog! I’ve been eager to start sharing tips, tricks, and the occasional tutorial for all things software. My business partner, Joel Cunningham, may wish contribute posts as well in his own field of expertise. In the spirit of talking shop, this blog has been launched on Netlify’s amazing and free hosting services via our Github repository. We host most of our work on DigitalOcean, but I wanted to take advantage of the continuous deployment perks that Netlify offers for Hugo static sites.…

    • ANNOUNCEMENTS
    Alex Regan
    Alex Regan

    Dec 29 · 1 min read