Skip to content

Instantly share code, notes, and snippets.

@Rattone
Rattone / bootstrap-sail.sh
Created November 13, 2023 21:29 — forked from njbair/bootstrap-sail.sh
Install Laravel Sail into an existing project without PHP & Composer
#!/bin/sh
# Installs Laravel Sail into an existing project
# The official Laravel Sail docs[1] provide instructions for installing Sail
# into an existing PHP application. But the official method requires invoking
# Composer locally. Part of Sail's appeal is that it removes the need to
# install PHP on your host machine.
# This script is lifted from laravel.build[2], and thus uses the same method
@Rattone
Rattone / deploy.sh
Created June 24, 2019 09:26 — forked from BenSampo/deploy.sh
Laravel deploy script
# Change to the project directory
cd /home/forge/domain.com
# Turn on maintenance mode
php artisan down
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin master
@Rattone
Rattone / roundForHumans.php
Created April 6, 2017 08:49 — forked from ludo237/roundForHumans.php
Round numbers in order to have something more human readable
<?php
/**
* Round a number into an human readable number
*
* The idea is to converts numbers like 999,999 into something like 0.9M or 999.99K
* using the scientific notation.
*
* @param $number
*
* @return string
@Rattone
Rattone / randomCode.php
Last active March 21, 2018 14:14 — forked from justinkelly/randomCode.php
Simple PHP function to generate a random apha-numeric code with only readable characters
<?php
/*
* Simple PHP function to generate a random apha-numeric code with only readable characters
*/
function randomCode($length=4)
{
/* Only select from letters and numbers that are readable - no 0 or O etc..*/
$characters = '23456789ABCDEFHJKLMNPRTVWXYZ';
$string = '';