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 | |
| /* | |
| This hack is supposed to help using regular file-based templates without writing to compiled_c directory. This should only be used in installers or similar! | |
| */ | |
| // load smarty | |
| require_once '…/Smarty.class.php'; | |
| // extend regular File Resource to suggest a source must be recompiled on every invocation |
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 | |
| $string = '{foreach $element->children as $c} | |
| {-if $c->max_count == 1} | |
| {-$c->getClassName()} {$c->getMemberVariableName()-}; | |
| {-else-} | |
| {$c->getClassName()} {$c->getMemberVariableName()}; | |
| std::vector<{$c->getClassName()}> {$c->getMemberVariableName()}s; | |
| {-/if-} | |
| {-/foreach} hello |
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 | |
| if (extension_loaded('xdebug')) { | |
| echo "WARNING: xdebug is enabled\n"; | |
| } | |
| function _count() | |
| { | |
| $array = array(1, 5, 8, 'Michael', 5, 4, 9, 'Martin', 18, 12, 'Michael', 4, 12); |
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
| RewriteEngine on | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_URI} !^/excluded-directories-like-css-or-js/ | |
| RewriteRule ^(.*)$ not-found.php [QSA,L] |
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 | |
| declare( encoding = 'UTF-8' ); | |
| namespace shurlook\net | |
| { | |
| class URL | |
| { | |
| const PROTOCOL = 'scheme'; | |
| const HOST = 'host'; |
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
| #!/bin/sh | |
| # configure stuff | |
| width=640 | |
| height=320 | |
| size=$width"x"$height | |
| # show help | |
| if [[ "$1" == "" || "$1" == "-h" || "$1" == "--help" ]]; then | |
| echo "USAGE: "; |
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
| #!/opt/local/bin/php | |
| <?php | |
| /* | |
| 1) replace the shebang (first line) with the path to your php binary | |
| (probably something like /usr/bin/php) | |
| 2) move the file to /usr/local/bin/datauri.php | |
| (this should be in your PATH) | |
| 3) chmod ugo+rx /usr/local/bin/datauri.php | |
| (make the script executable for everyone) |
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
| // regarding http://stackoverflow.com/questions/7887157/constructing-regular-expressions-to-match-numeric-ranges | |
| function IntRangeTest(expression) { | |
| var tests = []; | |
| /* | |
| possible expressions: | |
| "*" - any integer | |
| "0,3-4" - 0 or between 3 and 4 | |
| "0,-10--4" - 0 or between -10 and -4 |
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 FileDownload | |
| { | |
| public static $_response_status = array( | |
| 200 => 'OK', | |
| 201 => 'Created', | |
| 204 => 'No Content', | |
| 206 => 'Partial', | |
| 207 => 'Multi-Status', // WTF ?? |
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 | |
| mb_internal_encoding('UTF-8'); | |
| /** | |
| * multibyte string compatible range('A', 'Z') | |
| * | |
| * @param string $start Character to start from (included) | |
| * @param string $end Character to end with (included) | |
| * @return array list of characters in unicode alphabet from $start to $end |