Skip to content

Instantly share code, notes, and snippets.


Bruno Gaspar brunogaspar

View GitHub Profile
brunogaspar /
Last active Oct 13, 2020
[PHP] Percentage Calculation Helpers

Calculate Difference

if (! function_exists('calculatePercentage')) {
     * Calculates the percentage between the given values.
     * @param int|string $previous
     * @param int|string $current
brunogaspar /
Last active Dec 3, 2021
Recursive Laravel Collection Macros


If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.


brunogaspar /
Last active Nov 30, 2021
Install wkhtmltopdf on Ubuntu (14.04 64-bit) or (16.04 64-bit)

Install wkhtmltopdf on Ubuntu

This was tested on:

  • Ubuntu 14.04 x64
  • Ubuntu 16.04 x64


brunogaspar /
Last active Feb 18, 2020
Sentry 3 Users Online

Step 1

Open the file app/config/session.php and change the driver to database.

Step 2

We need to create the sessions table, so use the following artisan command php artisan session:table to generate the migration file.

Step 3