Skip to content

Instantly share code, notes, and snippets.

🕵
Working from home

Bruno Gaspar brunogaspar

Block or report user

Report or block brunogaspar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brunogaspar
brunogaspar / difference.md
Last active Jan 12, 2018
[PHP] Percentage Calculation Helpers
View difference.md

Calculate Difference

if (! function_exists('calculatePercentage')) {
    /**
     * Calculates the percentage between the given values.
     *
     * @param int|string $previous
     * @param int|string $current
     *
@brunogaspar
brunogaspar / macro.md
Last active May 22, 2019
Recursive Laravel Collection Macros
View macro.md

What?

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.

Setup

@brunogaspar
brunogaspar / README.md
Last active May 5, 2019
Install wkhtmltopdf on Ubuntu (14.04 64-bit) or (16.04 64-bit)
View README.md

Install wkhtmltopdf on Ubuntu

This was tested on:

  • Ubuntu 14.04 x64
  • Ubuntu 16.04 x64

Installation

@brunogaspar
brunogaspar / README.md
Last active May 17, 2019
Sentinel Logged in Users for Laravel 4 and Laravel 5
View README.md

Sentinel Logged in Users for Laravel

This is a very basic, but hopefully an efective way to detect both Guest and Registered users on your Laravel application.

The Usage and the Eloquent Model are basically the same on both Laravel 4 and Laravel 5, just the installation differs, since the application structure is different.

Please refer to one of the following links for installation on Laravel 4 or on Laravel 5.

@DavidReinberger
DavidReinberger / MeteorOcean.md
Last active May 21, 2019
Running Meteor.js apps on Digital Ocean with Phusion Passenger and NGNIX
View MeteorOcean.md

How to setup Meteor.js with Phusion Passenger and ngnix

Introduction

This article will guide you thru running a production ready meteor.js app on Digital Ocean with Phusion Passenger and ngnix.

Quick Summary

  1. Create a droplet
  2. Install Phusion Passanger with NGNIX
  3. Install node.js
  4. Configure NGNIX
@irazasyed
irazasyed / Install Composer using MAMP's PHP.md
Last active May 23, 2019
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management
View Install Composer using MAMP's PHP.md

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php
You can’t perform that action at this time.