Skip to content

Instantly share code, notes, and snippets.

View filippotoso's full-sized avatar

Filippo Toso filippotoso

View GitHub Profile
@filippotoso
filippotoso / update.php
Created March 22, 2018 14:11
Update the Larevel's public/index.php file to work outside the project folder
<?php
$content = file_get_contents(__DIR__ . '/project/public/index.php');
$content = str_replace("__DIR__.'/../", "__DIR__.'/../project/", $content);
file_put_contents(__DIR__ . '/project/public/index.php', $content);
function array_clone($array) {
return array_slice($array, 0, null, true);
}
@filippotoso
filippotoso / temporary_filename.php
Created January 22, 2018 17:58
Get a temporary filename with a specific extension
/**
* Get a temporary filename with a specific extension
* @method temporary_filename
* @param string $dir The directory where it tries to create the temporary file
* @param string $extension The extension of the file (default: '')
* @param string $prefix The prefix of the file (default: '')
* @param integer $retry The number of times it tries to create a random filename (default: 100)
* @return string|FALSE
*/
function temporary_filename($dir, $extension = '', $prefix = '', $retry = 100) {