johnlindquist.com

Explaining Streams to Rich Harris

September 5th, 2019

Before we begin, I'm intentionally avoiding loaded words found in stream libraries. If you're familiar with another library already, try and spot where the concepts align. Hi Rich! 👋 1. Start with an addEventListener Believe it or not, we're almost done... 2. Extract the callback Getting closer…

Continue reading...

Use Greensock With React Hooks

April 20th, 2019

I publish a use-gsap package on npm today. Here's the basic usage:

Continue reading...

Git Commit and Push From VS Code With a Single Keyboard Shortcut

April 20th, 2019

First, install the runInTerminal extension. Then, add the following to your keyboard shortcuts: && will wait for the previous command to finish before executing git add . will add all files to be commited git commit -m \"`date`\" --allow-empty will commit with the current date as a message even…

Continue reading...

Replacing Named Parameters With Function Composition

April 8th, 2019

A quick little https://egghead.io lesson if you're in to that sorta thing: Named parameters are a great feature of JavaScript, don't get me wrong, but sometimes functional composition is a more elegant solutions (I SAID SOMETIMES !). The example I'll be refactoring looks like this: Seems like…

Continue reading...

Understanding RxJS

March 19th, 2019

RxJS has these 4 parts: callback creating new callbacks from original callback caller startup I like to think of it like this:

Continue reading...

Alfred Workflow for Vanilla Codesandbox

March 14th, 2019

I open a Codesandbox so often, I wanted to set up a quick Alfred keyword to launch it. It's super easy to configure in Alfred, but if you want to download it I've included it below: Vanilla Codesandbox.alfredworkflow

Continue reading...

Create Command Line Tools With Node.js

March 10th, 2019

There are so many every day tasks that we all come across that we need to automate away. My most recent example is that I wanted to blog more. So what do I do first? I write code of course: Repo I setup this hard-coded example of a blog command which will create a new Markdown file pre-loaded with…

Continue reading...

Automatically Create a Github Repo From the Command-Line

March 9th, 2019

If you don't have hub installed, you should: Github's hub tool I use the git alias (instead of the default hub ) and I end up using git create almost every day. Easily Create Codesanboxes from Your New Repo It becomes so easy to work on something locally, run git create then push, then open…

Continue reading...

What Even is Programming?

March 8th, 2019

I don't know anymore. I thought that programming was writing some code and handing it over to a computer to execute. Now it seems like we weave together services and sites automatically appear through some magical internet portal. Take this example: Drag n' drop/commit a picture to Github This…

Continue reading...

Wrap an API with a Proxy

February 6th, 2019

Wrap an API with a Proxy codesandbox proxy api example

Continue reading...

Build a Lens From Scratch

January 16th, 2019

Let's take a backwards approach to dive into lenses by starting with our final implementation. What you see below is what we want our api to look like. We want prop to be a lens which can focus on a property and we want view to use the lens to focus onto the person (or any other object we pass…

Continue reading...

Focused - Putting Proxies to Work

January 11th, 2019

Focused With the power of our new proxy knowledge in hand, let’s turn to a library that leverages proxies behind the scenes. Focused is a library that uses similar techniques to get properties using proxies which allows us to do somewhat magical operations on deeply nested state. It’s worth noting…

Continue reading...

Safely Get Nested Values with Proxies

January 10th, 2019

We've all been in the situation where we are trying to access a very deeply nested property inside of an object but it errors out because one of those properties you're trying to access is undefined. Strings to the Rescue! Many of us turn to a tool called lodash which has a get method just safely…

Continue reading...

Use Reflect APIs with Proxy Handlers

January 8th, 2019

You'll notice something strange when you compare the Reflect API and the handler API for Proxies: Reflect API handler API Reflect.apply() handler.apply() Reflect.construct() handler.construct() Reflect.defineProperty() handler.defineProperty() Reflect.deleteProperty() handler.deleteProperty…

Continue reading...

Your First JavaScript Proxy

January 6th, 2019

A Proxy is a fancy word for intercepting how you interact with objects in JavaScript. Want to hi-jack what happens when you set a value? Care to log out every time you call a function? All this and much more can be done by wrapping your object in a Proxy and "handling" those interactions…

Continue reading...