Archive for January 5, 2022

Wednesday, January 5, 2022

Wordle

Peter Hosey:

Wordle is a word puzzle game by Josh Wardle. The game is this:

  • Every day, there is a new five-letter word to guess. The word changes every day at midnight.
  • You have six tries to figure out what the word is.
  • In each of your guesses, the game highlights which letters were right but in the wrong place (in yellow) and which were right and in the right place (in green). (There’s also a color-blind mode that changes the color assignments to blue and orange, respectively.)

If you guess the word, the victory screen includes (at least on some browsers; it doesn’t show up on my iPad) a Share button that gives you the spoiler-free emoji representation of how you did.

John Gruber:

It’s fun and simple, and the fact that you can do one and only one puzzle per day is a huge part of the charm. It’s a habit, not an addiction, and feels like a wee bit of mental calisthenics to start the day.

Update (2022-01-17): See also: Josh Centers.

Using Kaleidoscope with XCTest Failures

Florian Albrecht:

Kaleidoscope 3.1.3 and later can show XCTest failures in that format for you! No further trick or conversion is needed. Kaleidoscope parses the incoming content and automatically splits it into A and B parts, so the exact differences can be seen instantly.

You can drag and drop from Xcode’s issues navigator to Kaleidoscope’s Dock icon.

Xcode goes to great lengths to provide specialized previews for user interface code, playgrounds, etc., but its tools for viewing unit test output are so primitive. I’ve long used a wrapper for XCTAssertEqual that prints the expected and actual values on separate lines, so that at least they line up and you can more easily see the differences. It can also optionally diff them to help find the interesting lines. This Kaleidoscope feature goes further by highlighting differences within a line.

Encoding and Decoding References with Codable

Guilherme Rambo:

The CodableReference property wrapper implements Codable and takes care of encoding only the id of the wrapped value, and decoding the id and resolving the reference when it’s being decoded.

There is a missing piece of the puzzle though: how do we figure out which Category corresponds to any given category ID when decoding Post?

The solution I came up with was to take advantage of the userInfo property in JSONDecoder in order to provide the collection of models that the property wrapper can use while decoding.

Previously:

Parsing .numbers Files With Python

numbers-parser (via Hacker News):

numbers-parser is a Python module for parsing Apple Numbers.numbers files. It supports Numbers files generated by Numbers version 10.3, and all 11.x up to 11.2 (current as of November 2021).

[…]

Numbers uses a proprietary, compressed binary format to store its tables. This format is comprised of a zip file containing images, as well as Snappy-compressed Protobuf.iwa files containing metadata, text, and all other definitions used in the spreadsheet.

Previously:

obb: ClojureScript OSA

obb (via Zane Shelby, Hacker News):

Ad-hoc ClojureScript scripting of Mac applications via Apple’s Open Scripting Architecture.

[…]

ClojureScript code is evaluated through SCI, the same interpreter that powers babashka. SCI is compiled to JavaScript which is then by executed by osascript.