Malformed UTF-8 characters, possibly incorrectly encoded If you have ever seen this exception, chances are that you are saving byte strings to the database using a package like laravel-model-uuid . A byte string is arbitrary byte data formatted as a string; bytes, with string as their vehicle. This is great for efficiently storing small amounts of data, but as it’s arbitrary data, it’s not valid…
Update: This is now available as a package on Packagist: pindab0ter/constrained-morph-to-for-laravel , source on GitHub . In a project with a polymorphic one-to-one MorphTo relationship, you might want to constrain the relationship to a specific model type. Say, for example , that you have a Comment model that can belong to either a Post or a Video ; commentable s. posts id - integer title -…
TL;DR: We take the happy rocks out of the centrifuge and route them back in as long as they are in a quantity divisible by 10. When they are not, we take them out one by one until they are again. The Kovarex enrichment process is a very interesting recipe in Factorio. Most recipes in the game take a certain amount of one or more ingredients and output a single product. The Kovarex enrichment…
Our goal In Factorio, when you start building solar panels, you will quickly start to resent the coal power plants constantly burning fuel when they shouldn’t be. Let’s assume you have accumulators to store the power your solar panels provide, and that you have enough to get you through the night. Most of the time, at least. The accumulators provide the current charge percentage as a signal, so…
Table of Contents The context The implementation Enum Custom cast Why this is a bad idea The context For a local butchery chain, I created an intranet environment to maintain cleaning schedules, manage deliveries, and more. I built the intranet from the ground up, from software architecture and git init to DTAP 1 deployment and continued development. One of the uses of the intranet was to manage…
Table of Contents Introduction Requirements Provisioning a server Ansible Roles Tags Handlers Facts Final thoughts Introduction A previous employer was in the business of developing and hosting websites for small and medium-sized businesses. In order to reduce hosting costs, remove our reliance on an unreliable third party, give us more control over our offering, and improve our troubleshooting…
For a project I needed to create a page that would show organizational information. Each item is either a root item or a child item. The child items can have child items themselves. This is a recursive structure, which meant I could easily generate header numbers and depth. /** * The heading number including super-items. E.g.: '1.1'. * * @return Attribute<string, void> */ protected function…
When creating this blog I like to convert my images to WebP, as they save a lot of space at little to no quality loss. For example, the cover image of this post is 87 KB in PNG format, but only 27 KB in WebP format. That’s a 69% reduction. Nice. I use the cwebp command line tool to convert my images, but there’s something I really don’t like about it. It always requires you to explicitly specify…
To make a Discord bot to help organize co-op teams in Egg, Inc., I needed to get data from the game. There are no documented APIs, so I was going to have to reverse engineer the game’s network traffic. Charles Proxy Charles Proxy allows you to intercept network traffic. You can even use it to intercept encrypted HTTPS traffic from your iPhone . Perfect! So I set up my iPhone to use Charles Proxy…
Egg, Inc. Egg, Inc. 1 is an idle game by the lovely people at Auxbrain . The conceit of this game is that you have hatcheries that spawn chickens who lay increasingly more and valuable eggs that sell for increasingly high prices. The result is a game where numbers are almost always displayed in orders of magnitude 2 . To offer some perspective, my lifetime earnings in-game sit at a respectable…