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 | |
| /** | |
| * 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 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 | |
| $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 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 | |
| /** | |
| * @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 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 | |
| /* | |
| * 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 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 | |
| /* | |
| * Micro Class For Micro Data | |
| * Powered by libxml | |
| * | |
| * @author hakre <http://hakre.wordpress.com/> | |
| * @version 0.7.1 | |
| */ | |
| /** |
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 | |
| /* | |
| * Converting a massive CSV to a specific XML format | |
| * | |
| * @link http://stackoverflow.com/a/32034227/367456 | |
| */ | |
| /** | |
| * Class XmlEncoder | |
| * |
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 | |
| /** | |
| * 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 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 | |
| class GroupIterator implements Iterator | |
| { | |
| protected $keyfunc; | |
| protected $iter; | |
| protected $key = null; | |
| protected $value = null; |
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 | |
| 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. |
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
| export type Obj<T> = { [k: string]: T }; | |
| export type NumObj<T> = { [k: number]: T }; | |
| // export type List = ArrayLike; // no unapplied generic types :( | |
| export type List<T> = ArrayLike<T>; | |
| // progress: https://github.com/Microsoft/TypeScript/issues/16392 | |
| export function force<T, V extends T>() {} | |
| // export function force1<T extends '1'>() {} | |
| export type SafeArr<R extends { [i: number]: any }, Name extends string, Param extends number> = R & Array<{[K in Name]: Param }>; |