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 | |
/* | |
* Some Iterator Fun | |
* | |
* @link http://hakre.wordpress.com/2012/02/28/some-php-iterator-fun/ | |
*/ | |
/** | |
* Iterator that fetches each iteration value from a |
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 | |
/** | |
* Getting nested set model into a <ul> but hiding “closed” subtrees | |
* | |
* @link http://stackoverflow.com/a/7786733/367456 | |
*/ | |
// $categories = get_categories(); | |
$categories = get_categories_large(); | |
$current = array('lft' => '14', 'rgt' => '13'); |
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 | |
$for = array('ac', 'bc'); | |
$in = array('ax', 'ac', 'bc', 'cc'); | |
echo search($for, $in); // 1 | |
/** | |
* Search non-keyed array $for in non-keyed array $in | |
* and returning it's index position, or false if not | |
* found. | |
* |
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 | |
/** | |
* @link http://stackoverflow.com/questions/13129336/split-a-time-range-into-pieces-by-other-time-ranges | |
* @link https://gist.github.com/gists/3977645 | |
* @author hakre | |
*/ | |
class Range | |
{ |
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 | |
/* | |
* Get all 52 weeks of the year and work days given the first day of the January of current year | |
* @link http://stackoverflow.com/a/14147613/367456 | |
* @author hakre <http://hakre.wordpress.com/credits> | |
*/ | |
/** | |
* Filter a DatePeriod by year | |
*/ |
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 | |
/* | |
* Micro Class For Micro Data | |
* Powered by libxml | |
* | |
* @author hakre <http://hakre.wordpress.com/> | |
* @version 0.7.1 | |
*/ | |
/** |
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 | |
/* | |
* Converting a massive CSV to a specific XML format | |
* | |
* @link http://stackoverflow.com/a/32034227/367456 | |
*/ | |
/** | |
* Class XmlEncoder | |
* |
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 | |
/** | |
* StreamNotifyPrinter | |
* | |
* @author hakre <http://hakre.wordpress.com> | |
* @version 0.0.2 | |
* @example http://stackoverflow.com/a/24711469/367456 | |
* @link https://gist.github.com/hakre/8ba2c0d49b7baf062acd | |
*/ |
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 | |
class GroupIterator implements Iterator | |
{ | |
protected $keyfunc; | |
protected $iter; | |
protected $key = null; | |
protected $value = null; |
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 | |
header('Content-Type: text/html; charset=utf-8'); | |
#https://wiki.php.net/rfc/generators | |
require '../vendor/autoload.php'; | |
/* | |
Os Generators fornecem uma maneira fácil, livre de clichês para | |
implementar iterators. |