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 | |
$loop = React\EventLoop\Factory::create(); | |
$logger = new \Zend\Log\Logger(); | |
$writer = new \Zend\Log\Writer\Syslog(array('application' => 'movim')); | |
$logger->addWriter($writer); | |
$connector = new Ratchet\Client\Factory($loop); |
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
#!/bin/bash | |
# | |
# git-mv-with-history -- move/rename file or folder, with history. | |
# | |
# Moving a file in git doesn't track history, so the purpose of this | |
# utility is best explained from the kernel wiki: | |
# | |
# Git has a rename command git mv, but that is just for convenience. | |
# The effect is indistinguishable from removing the file and adding another | |
# with different name and the same content. |
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
$cancellable = new Promise(function () { }, function ($resolve, $reject) { $reject(); }); | |
$uncancellable = uncancellable($cancellable); | |
assertPending($cancellable); | |
assertPending($uncancellable); | |
// this is a NO-OP | |
$uncancellable->cancel(); | |
assertPending($cancellable); | |
assertPending($uncancellable); |
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 | |
// extend base Stream class by checking stream meta data for remaining stream buffer before reading from blocking streams | |
// heavily inspired by: https://github.com/clue/Worker/commit/8c6d7a4e733f0ee5aa431ffda1d4929229ae2336 | |
class StreamUnblock extends \React\Stream\Stream | |
{ | |
public function handleData($stream) | |
{ | |
// check stream meta data for remaining buffer | |
// yes, the manual explicitly says this value SHOULD NOT be used, |
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 DatagramClient extends DatagramSocketReadable | |
{ | |
public function __construct($loop, $socket, $address = null) | |
{ | |
if ($address === null) { | |
$address = stream_socket_get_name($socket, true); | |
} | |
parent::__construct($loop, $socket, $address); |
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 SocketStreamAdapter extends EventEmitter | |
{ | |
const DELAY_TICK = 0.01; | |
const DURATION_TICK = 0; | |
protected $loop; | |
protected $socket; | |
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 | |
$web = 'web/index.php'; | |
if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) { | |
Phar::interceptFileFuncs(); | |
set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path()); | |
Phar::webPhar(null, $web); | |
include 'phar://' . __FILE__ . '/' . Extract_Phar::START; | |
return; |
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 | |
use Fhaculty\Graph\Graph; | |
use Fhaculty\Graph\Vertex; | |
use Fhaculty\Graph\Algorithm\Tree\OutTree as Tree; | |
class TheJit | |
{ | |
private $graph; | |
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 | |
require __DIR__ . '/vendor/autoload.php'; | |
task('default', function() { | |
echo 'Does not work.'; | |
}); |
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 | |
$stream = stream_socket_client('tcp://www.example.com:80'); | |
assert(is_resource($stream)); | |
fclose($stream); | |
assert(!is_resource($stream)); |