Category: General

  • How to set a column’s position in a Laravel migration

    In a past post I wrote about How to move a column in a Laravel migration, but sometimes you’re better prepared and want to define the position of the column while creating it. Fortunately Laravel makes this real simple and we can fluently decide if a column must be positioned first or after another. To…

  • How to move a column in a Laravel migration

    This post could have also be titled “How to move a column in MySQL” or “How to move a column with SQL”… I guess you get it. Sometimes you just have to ship it and ship it now™ and, in the heat of the moment, you could oversee the order of some database columns. Or…

  • Learn how to import a function() in PHP

    TIL*¹ you can import just a function in a .php file, like we do with classes. It works from PHP 5.6+, so there’s no weird compatibility issue. And it’s dead simple. Here’s an example from Safe PHP, specifically let’s say we want to use the safer*² version of json_decode. Pay attention at how this allows…

  • How to mark something as binary in git

    Sometimes you may want to override git's decision of wheter a file contains text or binary data. For example, you may have to pull in some external library and want git to track it but not diff it inside. For this, git lets you define what to do with specific files or entire directories. Simply…

  • The first one

    This is the first post on this brand new blog, and it has a very descriptive title. I wanted to start a blogging for some time, but always ended up postponing it. Mainly because of a generous dose of impostor syndrome, but also because I haven’t been good at making the time to make the…