Updates to Client Storage for the Browser

I made some edits to this post after some feedback from Dru Knox, a Chrome PM. I’ve marked them with “Edit:“, so please be sure to note those changes!

I’ve been interested in client-side storage for a few years now. (And in fact, last year I wrote a book on it as well.) When I first began to dig into the topic, my focus was on the various APIs themselves. In other words, what were the mechanics of actually storing and retrieving data. What I found is that we had multiple options, some easier than others, but in general, it was pretty cool to have a way to store data on the client for both performance and offline support. However… where things began to fall apart, and rather quickly, was on the higher level concept of how this storage was managed on the device itself. Specifically, how do you know your data will actually persist when you store it and what will the browser do when, and if, it determines you’ve stored too much. I played around with this a bit last year:

Read more

Advent of Code - Day 6 and 7

And so it begins - the Advent of Code has begun to royally kick my butt. While these two challenges weren’t necessarily killers, the amount of time I need to solve them is slowly growing. Let’s start with day 6. Day 6 The first challenge asked you to find the most common character in a column of input. So given this: art boo aot “a” would be the most common charcter in the first column, “o” in the second, and “t” in the third.

Read more

Advent of Code - Day 5

Another easy day for Advent of Code. The first challenge was to simply iterate over a string (take an input string, add 1 to it, and increase that number), make a hash, and check to see if the hash begins with 5 zeroes. If it does, you take the number after the 5 zeroes as a password character. You keep appending to a password until you have seven characters: var crypto = require('crypto'); var input = 'ojvtpuvg'; generatePassword(input); function generatePassword(s) { console.

Read more

Advent of Code - Day 3 and 4

Only 5 days into Advent of Code and already this thing is kicking my rear. Both challenges over the weekend were (mostly) simply, but I’m already having trouble keeping up. This is a good thing though. I’m still absolutely loving the hell out of these challenges! Day 3 Day 3 was a rather simple problem. Given three numbers, can you determine if they could be a triangle? Turns out there’s a simple mathematical formula for that - any two side lengths must add to a number larger than the third side.

Read more

Advent of Code - Day 2

The second day’s challenge for Advent of Code was a bit easier than the first, so it was nice to tackle it a bit quicker. The puzzle involves a set of directions for moving your fingers over a numeric keypad. Imagine a typical security keypad layed out like so: 1 2 3 4 5 6 7 8 9 Then take input in this form: LLRUDD UUD Each line represents a set of movements to the left, right, up, and down.

Read more

Begin the Advent of Code!

Forgive the somewhat dramatic title, but today begins one of the coolest coding challenges I’ve ever done, the Advent of Code. The Advent of Code presents you with two coding challenges a day. (The second is typically a minor modification of the first one.) You can solve the challenge anyway you want. They start off - mostly - kind of simple and then kind of go off the deep end towards the end.

Read more

A Simple Stats Script for Hugo

I’m somewhat obsessed with stats, and one of the things I look at is my rate of publishing overtime. I’ve run this blog since 2003 and have gone from blogging 30+ times a month to - well - somewhat less than that. Quality is - of course - far more important than quantity. But as a general stat, I just like to know how much I’m writing. My static site generator of choice, Hugo, doesn’t have anything built in to support getting this.

Read more

Scraping a web page in Node with Cheerio

In yet another example of “I will build the most stupid crap ever if bored”, this week I worked on a Node script for the sole purpose of gathering data about SiriusXM. I’m a huge fan of the radio service (mostly because 99% of my local radio stations are absolute garbage, except for KRZS), and I was curious if the service had an API of some sorts. I was not able to find one, but I did find this page:

Read more

Online Pug Testing Tool

I’ve never been shy about my feelings about the Jade templating language. I absolutely hate it. I think it is weird. I think it leads to moral depravity. I just really, really don’t like it. Mainly I think because I find HTML already succinct enough. I mean I get that this: h1 Foo is less code than <h1>Foo</h1> but my brain just has issues mapping the Jade version to the output.

Read more