Netlify has support for creating redirects and rewrites using the _redirects file syntax. Borrowing from an idea I saw from Kent C. Dodds and @caarlos0, I built a script to make it easy to create short links for my website or other sites that I can then access via my newly minted go.mskelton.dev subdomain.
Bits and bytes of code
Bytes is my collection of short-form posts, tips, and things I learn as I build software.
I recently started using a tool called Zoxide from a friend's recommendation and I must say, it's pretty awesome. Zoxide is a smarter cd command that tracks your most used directories and allows you to jump to them with ease.
Building slideshows using Markdown is really convenient and fast. There are three great projects on GitHub which do this well, but I always forget their names, so posting them in this Byte for my own reference but also to promote each of these great open source projects.
Something that came up at work recently was joining buttons into a group. When joined, we wanted the buttons to have no border radius between them to achieve a nice visual aesthetic.
I've been working on a Rust side project lately and as I always do when I write Rust code, I find myself loving pattern matching even more than I did before. It seems like such a simple thing, sort of just a better if statement, but the more you use it, the more you realize just how powerful and elegant it really is.
We use GraphQL at work and one area that has always caused me a lot of pain is extracting a deeply nested, and deeply optional field from the GraphQL return type.
I was adding an expand/collapse feature to my website code blocks the other day, and I wanted to create an animation where the arrows flip vertically when you press the button.
A common challenge in React is managing state for components that have animations. For example, closing a modal after it transitions closed, resetting the state of a copy button after the animation finishes, or removing temporary height/width from expandable containers during open/close transitions.
You've likely encountered the common issue of calculating a border radius value when you have an element with a border radius within a parent element which also has a border radius. If you use the same value for both, the inner radius will look wrong.
If you use TypeScript, you've more than likely seen keyof typeof obj at one point or another to get a union type representing the keys of the given object. But what if we want to get a subset of the object keys, based on the values in the object?