A linestring is simply a sequence of two or more points (or zero points), where each pair of points defines a line segment. Thus the sequence can be thought of as string of line segments that define some curve. To interpolate along a linestring is, effectively, to walk along the linestring until we get to […]
What’s a way of combining Maps of Iterables without losing information? In Scala, it’s common to combine or concatenate Iterables, usually something like this: val a = Vector(1, 2, 3) val b = Vector(4, 5, 6) val c = a ++ b This takes Vector a and concatenates it with Vector b. The resulting Vector […]
Giving a user the ability to download files in your app can be difficult to figure out. In iOS, you can use AlamoFire to download the file locally and then present it with a UIDocumentInteractionController. (The code would look something like this.) It presents the documents, images, gifs, videos, etc. in the app for you, […]
Two years ago, a coworker wrote a Spin post on Seven JetBrains shortcuts. Once you get used to using them and combining them, they significantly improve workflow. So here are a few more I find useful, plus how you can use them together. More JetBrains Shortcuts Duplicate with ⌘D ⌘D is useful when you have […]
When working with RecyclerView, our choices are limited to linear, grid, and staggered grid (unless you’re creating a custom layout manager). But what if we want something that works like a grid layout, but allows us to center rows or justify them as we like? That’s where a flexbox would work well. And it just […]
It would be nice if creating a SearchView with suggestions were as simple as giving the SearchView a list of strings. But unfortunately, that’s not the case. It requires a CursorAdapter. This tells the SearchView how to render the suggestions and keeps track of the selection and what’s visible.
For the past two years, I’ve attended a little-known convention called Gen Con. Okay, depending on who you ask, it might not be that little-known. It draws over 60,000 unique attendees (over 200k visits throughout four days). Besides spending time enjoying everything at the convention—from visiting exhibitor booths to making purchases, trying out new games, […]
When writing tests for a Node.js server, it’s common to test the database as well. (At least, one hopes.) Here are a few helper functions for testing a PostgreSQL database using Knex.
When working on an app in Kotlin or Android, it’s very common to use RecyclerViews to display lists of information. Typically, this data will be built up in ViewModels and passed to a list adapter. This works fine for most things and allows interaction with the items. Usually, they don’t need to change directly in […]
When building a Kotlin app, or any app for that matter, it’s pretty inevitable that it will contain push notifications. And with push notifications, it’s likely the app icon will need a badge. This is possible with the standard Android API, but unfortunately, the target SDK needs to be 26 or higher for it to […]