Skip to content

Instantly share code, notes, and snippets.

Christian Lück clue

Block or report user

Report or block clue

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
clue / StreamUnblock.php
Last active Dec 10, 2015
extend base React\Stream\Stream class by checking stream meta data for remaining stream buffer before reading from blocking streams
View StreamUnblock.php
// extend base Stream class by checking stream meta data for remaining stream buffer before reading from blocking streams
// heavily inspired by:
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,
clue / DatagramClient.php
Last active Dec 11, 2015
[deprecated] moved to [DRAFT] UDP DatagramClient and DatagramServer built on top of reactphp
View DatagramClient.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);
View SocketStreamAdapter.php
class SocketStreamAdapter extends EventEmitter
const DELAY_TICK = 0.01;
const DURATION_TICK = 0;
protected $loop;
protected $socket;
clue / defaultstub.php
Created May 24, 2013
View defaultstub.php
$web = 'web/index.php';
if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {
set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());
Phar::webPhar(null, $web);
include 'phar://' . __FILE__ . '/' . Extract_Phar::START;
clue / thejit.php
Last active Dec 18, 2015
thejit graph transformer prototype/mockup
View thejit.php
use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Vertex;
use Fhaculty\Graph\Algorithm\Tree\OutTree as Tree;
class TheJit
private $graph;
clue / Phakefile.php
Created Dec 20, 2013
jaz303/phake Loading vendor/autoload.php fails
View Phakefile.php
require __DIR__ . '/vendor/autoload.php';
task('default', function() {
echo 'Does not work.';
View hhvm-is-resource.php
$stream = stream_socket_client('tcp://');
View hhvm-array_rand.php
var_dump(array_rand(array()) === null);
clue / gist:8645729
Last active Jan 4, 2016
redis benchmark
View gist:8645729
host:~$ redis-server --version
Redis server v=2.6.13 sha=00000000:0 malloc=jemalloc-3.3.1 bits=64
host:~$ echo "port 1338" | redis-server -
host:~$ redis-benchmark -p 1338 -q
PING_INLINE: 156250.00 requests per second
PING_BULK: 185185.19 requests per second
SET: 192307.69 requests per second
GET: 188679.25 requests per second
INCR: 192307.69 requests per second
LPUSH: 200000.00 requests per second
clue /
Last active Aug 29, 2015
Running Ratchet test suite in a clean schroot

This gist demonstrates how to use a transient (temporary) schroot environment to set up a controlled environment to run the Ratchet test suite. It assumes you're running this on a recent version of Ubuntu (a virtual machine will do as well).

  • We want to run the test suite in isolation without installing the required tools on our host.
  • Instead, all tools will be installed in a transient schroot that will be reset whenever we leave it.
  • The schroot is a convenient wrapper to set up a blank system in a chroot, but still provides access to your home directory where the workspace (Ratchet) is installed.
  • This allows us to easily hack the source code on the host system and running exactly the same code in the schroot test environment.
  • As such, you can read/write to your home directory from within your schroot, which is convenient in our case. Obviously, this is not a safe option if you're running untrusted code.
  • We use debootstrap to set up a new Ubuntu Precise (12.04 LTS) VM.
You can’t perform that action at this time.