Author: Franco Gilio

  • 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…

  • How to use Laravel’s Job chaining

    How to use Laravel’s Job chaining

    In the past, I’ve had to implement job chaining and TBH the end result was pretty gross. It was a system that needed to take a file and pass it through a series of steps, so nothing too complex. But, by the way the chain worked, every job was conscious about the next one in…

  • Working with discount coupons in Laravel Spark

    Working with discount coupons in Laravel Spark

    ** EDIT 2018/04/04: This is applicable to both Spark 6 and 5 **  EDIT 2018/10/19: This posts was made for Spark 5, but most likely it still perfectly applies to Spark . I’ve read the changelog and upgrade instructions, and those do not mention any changes regarding coupons. I’ll update this post once we upgrade to…

  • So you wanna yarn add a dependency from a git repo?

    So you wanna yarn add a dependency from a git repo?

    I’m posting this because, even if really basic stuff, I’ve bumped my head with this wall way too many times before successfully managing to accomplish the task: Use yarn add to pull a dependency while using a git repo as the source. It is, in fact, really simple (though I feel is way to verbose…

  • Easily transfer entire local directories to Amazon S3 using s3-parallel-put

    Easily transfer entire local directories to Amazon S3 using s3-parallel-put

    A couple of weeks ago I faced the need to upload a large number of files to Amazon S3, we’re talking about lots of nested directories and ~100gb. So, after entering panic-mode for a couple of seconds I turned to our trusty Google and kindly filled its input with “transfer from local to amazon s3”…

  • Cherry-picking your way out of trouble

    Cherry-picking your way out of trouble

    I find cherry-pick to be one of those great underutilized features of git. And maybe that’s good, because it’s mainly used to apply hot fixes. The way it works is very simple, it just let’s you merge one or more commits from one branch onto another. Awesome, right? Imagine a situation in which you have…

  • How to keep an SSH session alive

    How to keep an SSH session alive

    * This is a Has it ever happened to you… kind of post. Imagine you’re logged in to a server doing some magical stuff. Then you go grab a coffee and when you come back… you’re logged out from the server. Yes, it sucks. You have to SSH in again and cd into the same…