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
| void main() { | |
| print(foo('bar')); | |
| // will rise an error | |
| foo(1); | |
| } | |
| foo ($s) { | |
| return 'foo' + $s; | |
| } |
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 Symfony\Component\Debug\BufferingLogger; | |
| use Symfony\Component\Debug\Debug; | |
| use Symfony\Component\Debug\ErrorHandler; | |
| $loader = require_once __DIR__ . '/vendor/autoload.php'; | |
| class ConfigurableErrorHandler extends ErrorHandler | |
| { |
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
| # source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html | |
| # First of all you need to have a clean clone of the source repository so we didn't screw the things up. | |
| git clone git://server.com/my-repo1.git | |
| # After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command | |
| git filter-branch --subdirectory-filter your_dir -- --all | |
| # This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command. |
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 TestGenerator { | |
| public function task1($doGenerate = true) | |
| { | |
| echo "Enter generator\n"; | |
| if ($doGenerate) { | |
| echo "Generate values\n"; | |
| yield 1; | |
| yield 2; |
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 ParentClass | |
| { | |
| public $a; | |
| public $b; | |
| public function __construct($a, $b) | |
| { | |
| $this->a = $a; |
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 | |
| $size = 0; | |
| foreach (realpath_cache_get() as $pathInfo) { | |
| $size += strlen($pathInfo['realpath']) + 1 + 56; | |
| } | |
| var_dump($size, ini_get('realpath_cache_size')); |
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
| (function () { | |
| var d, f = this, k = function (a, c, b) { | |
| a = a.split("."); | |
| b = b || f; | |
| a[0] in b || !b.execScript || b.execScript("var " + a[0]); | |
| for (var e; a.length && (e = a.shift());)a.length || void 0 === c ? b = b[e] ? b[e] : b[e] = {} : b[e] = c | |
| }, l = Date.now || function () { | |
| return +new Date | |
| }; | |
| var p = function (a) { |
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 | |
| cd /var/www && | |
| service ghost stop && | |
| now=$(date +"%Y%m%d_%H%M%S") && | |
| tar -zcvf "ghost_${now}.tar.gz" ./ghost && | |
| wget http://ghost.org/zip/ghost-latest.zip -O ghost-latest.zip && | |
| rm -rf ghost/core && | |
| unzip -uo ghost-latest.zip -d ghost && | |
| chown -R ghost:ghost ghost/* && | |
| cd ghost && |
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 file is part of PDepend. | |
| * | |
| * PHP Version 5 | |
| * | |
| * Copyright (c) 2008-2013, Manuel Pichler <mapi@pdepend.org>. | |
| * All rights reserved. | |
| * | |
| * Redistribution and use in source and binary forms, with or without |