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_columns_array | |
* | |
* Columns for the loop, single function interface (limited) | |
* | |
* Copyright (c) 2011 hakre <http://hakre.wordpress.com/>, some rights reserved | |
* | |
* USAGE: |
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/q/10212752/367456 | |
* @link http://msdn.microsoft.com/en-us/magazine/ee335713.aspx | |
*/ | |
$file = 'billion-laughs-2.xml'; | |
$file = 'quadratic-blowup-2.xml'; | |
printf("Mem: %s (Peak: %s)\n", number_format(memory_get_usage(), 0, '', ' '), number_format(memory_get_peak_usage(), 0, '', ' ')); |
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 | |
/** | |
* Class CachedPDOStatement | |
* | |
* CachingIterator for a PDOStatement | |
*/ | |
class CachedPDOStatement extends CachingIterator | |
{ | |
private $index; |
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/q/10181054/367456 | |
*/ | |
/** | |
* Extending from a TraversableDecorator allows to decorate (change) the Iterator | |
* being Traversed without changing the object. | |
*/ |
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 | |
/** | |
* just some file | |
*/ | |
$a = 1; | |
if ($a > 0) { | |
$a += 2; | |
print($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 | |
/** | |
* WordPress 3.1 Taxonomy Feeds Plugin (Must-Use) | |
* | |
* Copyright (C) 2011 hakre <http://hakre.wordpress.com/> | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU Affero General Public License as | |
* published by the Free Software Foundation, either version 3 of the | |
* License, or (at your option) any later version. |
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/13865149/speeding-up-xml-schema-validations-of-a-batch-of-xml-files-against-the-same-xml | |
*/ | |
$mapping = [ | |
'http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd' => 'schema/xhtml1-transitional.xsd', | |
'http://www.w3.org/2001/xml.xsd' => 'schema/xml.xsd', | |
]; |
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 | |
/** | |
* How we can add two date intervals in PHP | |
* @link http://stackoverflow.com/q/11556731/367456 | |
* @link http://codepad.viper-7.com/oBW2le | |
* | |
* NOTE: This code is rough. | |
*/ | |
header("Content-Type: text/plain;"); |
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
<<'EOD' docker build --rm --tag rewrite-tester --no-cache - | |
FROM httpd:alpine | |
RUN set -e \ | |
; sed -i -e 's/^#LoadModule rewrite_module/LoadModule rewrite_module/' \ | |
-e 's/^LogLevel .*$/LogLevel debug rewrite:trace8/' \ | |
-e '\|<Directory "/usr/local/apache2/htdocs">|,\ </Directory> s/^ AllowOverride .*$/ AllowOverride All/' \ | |
/usr/local/apache2/conf/httpd.conf \ | |
; echo -e ' \n\ | |
RewriteEngine On \n\ | |
RewriteBase / \n\ |