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 | |
//yikes | |
class ArrayArrayObject extends ArrayObject | |
{ | |
public function offsetSet($index, $value) | |
{ | |
array_map(function ($k) use ($value) { | |
parent::offsetSet($k, $value); | |
}, (array)$index); |
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 | |
use DateTimeImmutable; | |
use DateInterval; | |
use DateTimeZone; | |
use IteratorAggregate; | |
use ArrayIterator; | |
class BeHolidays implements IteratorAggregate | |
{ |
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 | |
namespace Studiow\Util; | |
class MatchAll | |
{ | |
private $result; | |
private $matches = []; | |
public function __construct($pattern, $subject, $flags = PREG_PATTERN_ORDER, $offset = 0) |
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
vagrant global-status | grep running | cut -c 1-9 | while read line; do echo $line; vagrant halt $line done; |
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 | |
use Valitron\Validator; | |
$data = ['contact_number' => '', 'email_id' => '']; | |
//add data with the keys you want to check | |
$data['contact_info'] = [ | |
'contact_number', 'email_id' | |
]; |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> |
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
{ | |
"scripts": { | |
"post-update-cmd": "rm -rf cache/*", | |
"post-package-install": "rm -rf cache/*" | |
} | |
} |
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 | |
//24 hours in one day, plus an extra hour to count any minutes past midnight | |
$totals = array_fill_keys(range(0, 24), array_fill_keys(range(0, 59), 0)); | |
//loop through the ranges | |
foreach ($ranges as $range) { | |
$start = (int) $range[0]->format('H'); | |
//the duration of this range | |
$delta = $range[1]->diff($range[0]); |