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 isDateTime($input): bool { | |
return date('Y-m-d H:i:s', strtotime($input)) === $input; | |
} |
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 | |
declare(strict_types = 1); | |
use Bulletpoint\Core\{ | |
Control, | |
Filesystem, | |
Security, | |
Http, | |
Reflection, | |
Text, | |
UI, |
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 | |
echo IntlDateFormatter::formatObject( | |
new DateTime(), //a DateTime object | |
"eeee dd MMMM yyyy '@' hh:mm:ss", //UCI standard formatted string | |
'fr_FR' //the locale | |
); |
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 | |
$arr = [ | |
['id' => 123, 'name' => 'Joe'], | |
['id' => 345, 'name' => 'Sally'] | |
]; | |
array_column($arr, null, 'id'); // [ 123 => ['id' => 123, 'name' => 'Joe'] | |
array_column($arr, 'name', 'id'); // [ 123 => 'Joe', 345 => 'Sally'] |
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
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule !\.(css|js|icon|zip|rar|png|jpg|gif|pdf)$ index.php [L] |
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 | |
$array = [ | |
0 => 'A', | |
1 => 'B', | |
2 => 'C', | |
]; | |
array_combine(range(1, count($array)), $array); // [1 => 'A', 2 => 'B', 3 => 'C'] |
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 | |
echo implode(',', array_fill(0, count([1, 2, 3]), '?')); // ?,?,? | |
echo rtrim(str_repeat('?,', count([1, 2, 3])), ','); // ?,?,? |
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
browser.urlbar.clickSelectsAll;true | |
browser.backspace_action;0 | |
network.IDN_show_punycode;true | |
media.peerconnection.enabled;false |
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
gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ launcher-minimize-window true |
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 function saved my life. | |
found on: http://www.sitepoint.com/forums//showthread.php?t=438748 | |
by: crvandyke | |
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?! | |
*/ | |
$array = json_decode(json_encode($object), true); |
OlderNewer