https://www.robinsloan.com/notes/home-cooked-app/
This article really spoke to me. I end up not building things all the time because I’m worried about product market fit, which tools to use to scale, etc. Instead, I need to lean into scratching my own itch and let it evolve however it may. Worst case scenario, I’ll build something useful for one person.
The author’s favorite family communication app shut down, so he built his own.
It launched in the first week of January 2020, and almost immediately, it was downloaded by four people in three different time zones. In the years since, it has remained...
Read More...
I’ve let this website atrophy a bit. Well, more than a bit. We’re coming up on 5 years since the last post - about as long as my oldest child has been alive and as long as I’ve been at my current job.
Not to imply that parenting and work have kept me so busy that I couldn’t write one measly blog post. But since that time, I’ve found myself less interested in writing the programming how-to’s that made up most of my past articles.
Still, I do want to write and share. I want this little corner of the internet to be a reflection of me.
But I’ve been dragging...
Read More...
I’m working on an Elixir app at the moment and really enjoying it, but some of my recent dabbling in the type-safe worlds of Elm and Crystal have left me desiring a bit more structure in my code. The app I’m building involves a multi-step data transformation and so I have a data structure to properly represent this process. But since Elixir is a dynamically typed language, you can’t, for example, have a non-nillable field in a struct. The Elixir/Erlang ecosystem does, however, have a type-checking syntax called Type Specs, along with a tool, Dialyzer,...
Read More...
I’m in the middle of writing an application in Elixir and Phoenix, so when I saw a link to an article by José Valim on an upcoming authentication solution for Phoenix, my initial reaction (before reading it) was negative. José is the author of the Devise framework for Ruby-on-Rails, so I assumed it was going to be the same idea, but for Elixir and Phoenix. I’ve implemented Devise in a handful of Rails apps, and each and every time I ended up ripping it out and writing my own auth solution (often based on this Railscasts tutorial). The reason is that while...
Read More...
I’m a big of ReactJS, but sometimes it is way too heavy for what I need. The majority of the applications I create are server-rendered and just need some “sprinkles” of JavaScript. In the past, I’ve leaned on jQuery for this, but I’m not a fan of the imperative nature of it.
Recently, I stumbled upon AlpineJS, which is a super minimalist framework that lets you write declarative sprinkles of JavaScript without resorting to something heavier like React or Vue. It comes in at just 6.4kb (compressed), less than a quarter of the size of Vue, React, or jQuery...
Read More...
I had a ridiculous typo in a Git commit message recently, so I decided to explore spell checking in Vim. As it turns out, it’s extremely easy.
I only wanted it enabled for Git commit messages and markdown, so I added the following to my vimrc / init.vim:
" Spell-check Markdown files and Git Commit Messages
autocmd FileType markdown setlocal spell
autocmd FileType gitcommit setlocal spell
By doing this, it highlights potential misspellings in red underline. You can see a list of potential corrections by moving the cursor over the word in normal mode and...
Read More...
Inspired by iOS’s new dark mode (and halloween!), I decided to a dark mode to the website using the new prefers-color-scheme
media query. It was surprisingly easy to do. After I’d changed the
This took care of 90% of it:
@media (prefers-color-scheme: dark) {
html {
background-color: #19222b;
color: #eee;
}
.page-wrapper__inner {
background-color: #222f3b;
color: #eee;
}
}
Using a straight black-and-white background and foreground combo looks too harsh on the eyes, so you want to find a gray-ish background. Mine is a bluish-grayish...
Read More...
Here’s a handy Vim command that I find myself searching for often. It could easily be made into a function in your vimrc.
" 4 spaces to 2 spaces
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
" Tab to 2 spaces
%s/\t/ /g
When using Elixir, I’ve long missed the special _
helper from irb that returns the result of the previous expression. Sometimes I actually type it out of pure habit.
Little did I know that Elixir has the same thing, except better.
IEx.Helpers has a function v(n \\ -1)
that returns the value of the nth expression in the session history. So v
alone returns the previous expression and v(-2)
returns the one before it.
iex(1)> "abc"
iex(2)> "zyx"
iex(3)> v
"zyx"
iex(4)> v(-3)
"abc"
Ruby has some handy Array shorthands, but I always forget which is which, so I thought I should write them down.
Symbol Array Shorthand:
%i{foo bar} # => [:foo, :bar]
String Array Shorthand:
%w{foo bar} # => ["foo", "bar"]
Both also work with square brackets %w[a b c]
or parenthesis %i(a b c)