This file contains hidden or 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
#!/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 |
This file contains hidden or 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 | |
$array = [5, 10, 11, 9, 5]; | |
$divider = 3; | |
$subArrays = []; | |
$subArraysIndex = 0; | |
for ($start = 0; $start <= count($array); $start++) { | |
This file contains hidden or 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
# 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 |
This file contains hidden or 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 | |
$token = 'xxxxx'; | |
$title = 'Testo notifica'; | |
$fcmUrl = 'https://fcm.googleapis.com/fcm/send'; | |
$serverKey = 'xxxxx'; | |
$notification = [ | |
'title' => $title, |
This file contains hidden or 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 | |
/** | |
* 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 |
This file contains hidden or 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
<article class="persist-area"> | |
<h1 class="persist-header">PERSIST HEADER 0</h1> | |
...<br> | |
...<br> | |
...<br> | |
...<br> | |
...<br> | |
...<br> | |
...<br> | |
...<br> |
This file contains hidden or 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 | |
// previene injection | |
function addslashes_deep($value) | |
{ | |
return is_array($value) ? array_map('addslashes_deep', $value) : addpslashes($value); | |
} | |
$_POST = array_map('addslashes_deep', $_POST); | |
$_GET = array_map('addslashes_deep', $_GET); |
This file contains hidden or 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
DROP FUNCTION IF EXISTS `slugify`; | |
DELIMITER ;; | |
CREATE DEFINER=`root`@`localhost` | |
FUNCTION `slugify`(dirty_string varchar(200)) | |
RETURNS varchar(200) CHARSET latin1 | |
DETERMINISTIC | |
BEGIN | |
DECLARE x, y , z Int; | |
Declare temp_string, new_string VarChar(200); | |
Declare is_allowed Bool; |
This file contains hidden or 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 | |
/* | |
* 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 = ''; | |