Summary of the steps to get a Ubuntu 16.04 production server running with LAMP, multiple virtual hosts and Let's Encrypt SSL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is code to return custom error message | |
// for Youtube tutorial: Laravel 5.4 Additional Login Conditions | |
// https://www.youtube.com/watch?v=Z8s6uhhD1Pk | |
namespace App\Http\Controllers\Auth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Crear un controlador: | |
php artisan make:controller NombreControladorController | |
Crear un modelo: | |
php artisan make:model NombreModelo | |
Crear un request |
Steps to get multiple versions of PHP running alongside on separate Apache virtual hosts using phpfarm.
The guide uses the example of PHP v5.4.45 and v7.0.7, but installation of any version and any number of versions will be done this same way.
Update the machine:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomDate(start, end) { | |
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())) | |
} | |
console.log(randomDate(new Date(2012, 0, 1), new Date())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add these three lines to CORSify your server for everyone. | |
Header set Access-Control-Allow-Origin "*" | |
Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE" | |
Header set Access-Control-Allow-Headers "Content-Type, Authorization" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function progress_bar($done, $total, $info="", $width=50) { | |
$perc = round(($done * 100) / $total); | |
$bar = round(($width * $perc) / 100); | |
return sprintf("%s%%[%s>%s]%s\r", $perc, str_repeat("=", $bar), str_repeat(" ", $width-$bar), $info); | |
} |