Photo credit: Buena Vista Pictures

Today I’m going to pick up where I left off with my basic JavaScript web API cookbook. We’ve set up two simple models and a working relationship between them, plus routes and controllers that handle it all. Today I’ll walk through adding token-based auth with bcrypt and jsonwebtokens, and we’ll briefly discuss how middleware helps us do that. I’m still pretty sick but dammit, I’m building a functional back end! Fork and clone the repository to follow along; our progress up to now is in the branch /part-2.

Background: a token of my extreme

Auth is a big subject and it’s not to be taken lightly…


Photo credit: 20th Century Fox

This blog post is part 3 in what’s quickly become a series about one of my favorite subjects: vector graphics—a shamefully underused way to bring your app from “meh” to “wow” with relatively little effort. Vectors are light, fast, and versatile, and manipulating/animating them is easy thanks to the main subject of this article series, <path>s (sequences of lines and curves).

On today’s episode I’m revisiting a bit of code from a month ago that I called PathParser. In that post I explained paths are defined with strings in a standard syntax; I wrote a class that parses those syntax…


Photo credit: NBC/Universal Television

Today’s blog post continues my series on computer poker with a brief exploration of lookup tables and perfect hashes. Huge thanks and acknowledgments are in order before we begin to Kevin Suffecool, Paul Senzee, and Mike Benson — without a doubt the founding fathers of modern computer poker. Feel free to fork/clone my repository to follow along as you read about their work, which has resulted in one of the most diabolically clever algorithms ever written…

Background: how the table turns

A lookup table is, essentially, a “phone book” or “encyclopedia” or “directory.” Instead of using math or logic to parse/return data, it’s often much…


Photo credit: NBC Universal

“Forgive me, Father, for I have sinned…”

Today we’re going to try something a little naughty: triggering a browser download entirely from the front-end. There are a few packages popular for doing this in React (a subject I blog about frequently), but today, I’ll share a simple, no-frills approach to front-end downloads that doesn’t require any packages. The concept is general enough to adapt for any framework, but in React-land all we’ll need is FileReader(), React’s useRef() hook and a little dark magic...

Background

It used to be triggering downloads from the front-end was frowned upon for a few reasons:

  • It’s…


Photo credit: IglooHome

It’s no secret I love games — for their pedagogical value just as much as for their entertainment value. There’s no better way to learn to code than writing a game. Even simple games have rules, hierarchies, states and conditions — the skills required to solve those problems are no different from the skills engineers use to solve real-world problems.

If I’m learning a new programming language, one of the first things I usually do is try to write a game, and that game is usually poker. Poker’s a source of endless joy and pleasure for me because it’s a…


It’s about time for a follow-up to the first part of my basic JavaScript web API cookbook. It’s a huge topic, and when we left off we’d only made it through setup: creating a basic Express app, provisioning our environment, and configuring Sequelize. On this episode, we’ll get to the main event: models, associations and migrations. Feel free to fork and clone this repository if you’d like to follow along; there are branches for before/after the instructions below to check progress.

5. Create your database

Before creating models, we have to create our database using the instructions we left for Sequelize in database.config.js. The…


Humble thanks to Particle in Cell, a California-based tech consultancy, and this fantastic article on their blog. The code is now a bit out of date so I’ve taken the liberty of updating/adapting it. Their work has been incredibly helpful in my personal projects! This blog post wouldn’t have been possible without it!

Today I’m following up on a previous blog post about one of my favorite subjects: vector graphics — just about the easiest way to make your web app stand out in a crowd. A talented vector artist can please nearly any taste: minimalism to realism and nearly…


This week the world saw the return of a depressing routine: new breathless headlines about another data breach

Also depressingly unsurprising? The claim of “8.4 billion leaked passwords” spread like wildfire among particularly shameless blogs and even a couple tabloids and majors; the hack was “jaw-dropping” according to The Express, and “the mother of all password leaks” according to Yahoo! News.

The least surprising part? The evidence is about as strong as the password 1234.

Here’s the deal: a source for a lot of the claims about RockYou2021 echoing around the scaremongering fringe of mainstream media seem to come from…


Photo credit: Milton Bradley Company

Acknowledgments and huge thanks to Yann Armelin for his amazing work on this subject.

There’s just nothing quite as delightful as vector graphics. Both diagonals and curves look crunchy and ill-defined with raster graphics, but with vectors they’re incomparably smooth and crisp at any scale. And vector files are light as a feather, especially compared to JPEGs, so load time is negligible and performance is fast.

On today’s blog post, we’re going to dig in to a task I’ve encountered in my personal work with vector graphics: parsing and validating path descriptors.


Colorized daguerreotype of unknown prospector with shovel and gold pan, California, ca. 1850 (Photo credit: My Colorful Past)

DISCLOSURE: I do not currently, nor have I ever, held any cryptocurrency assets. I welcome discussion and invite you to comment, but please disclose your stake in crypto if you do.

I usually blog about the technical nitty-gritty of software engineering, but today’s post is going to be a little different.

Even for the technologically uninitiated, cryptocurrency has become impossible to ignore. Celebrities promote it, big business is investing in it, and many, many ordinary people are obsessed with it. Some are even getting rich.

I won’t bore you with a detailed explanation of cryptocurrency — you’ll find one easily…

Josh Frank

Oh geez, Josh Frank decided to go to Flatiron? He must be insane…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store