- Version: 0.1
- Date: 2016-11-14
- Author: Niklas Keller me@kelunik.com
- Status: Draft
- First Published at: https://gist.github.com/kelunik/7eb89b807dadda3edd05b4c48a23be06
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
// ==UserScript== | |
// @name GitHub Default Issue List | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description GitHub Default Issue List | |
// @author Niklas Keller <me@kelunik.com> | |
// @match https://github.com/* | |
// @grant none | |
// ==/UserScript== |
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 | |
interface Driver { | |
public function set(callable $callback); | |
public function invoke($foo); | |
} | |
<?php | |
class DriverA implements Driver { | |
private $callback; |
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
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <errno.h> | |
#include <linux/input.h> | |
#include <string.h> | |
#include <stdio.h> | |
static const char *evval[3] = { | |
"RELEASED", |
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
#!/usr/bin/env bash | |
function is_browser { | |
local path=$1 | |
local basename=$(basename $path) | |
if [[ $basename = "chromium-browser" ]]; then | |
return 1 | |
fi |
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 Amp\Parser\Parser; | |
class RespParser extends Parser { | |
private $onResponse; | |
public function __construct(callable $onResponse) { | |
$this->onResponse = $onResponse; | |
parent::__construct($this->parse()); |
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
Kelunik\StreamingResp\IterativeRespParser: 0.526520 @ simpleString | |
Kelunik\StreamingResp\IterativeRespParser: 0.788227 @ bulkString | |
Kelunik\StreamingResp\IterativeRespParser: 1.780007 @ simpleArray | |
Kelunik\StreamingResp\IterativeRespParser: 3.999639 @ incompleteArray | |
Kelunik\StreamingResp\IterativeRespParser: 0.163905 @ clueDos | |
Kelunik\StreamingResp\RecursiveRespParser: 0.779131 @ simpleString | |
Kelunik\StreamingResp\RecursiveRespParser: 1.274417 @ bulkString | |
Kelunik\StreamingResp\RecursiveRespParser: 3.103048 @ simpleArray | |
Kelunik\StreamingResp\RecursiveRespParser: 7.358338 @ incompleteArray | |
Kelunik\StreamingResp\RecursiveRespParser: 0.329863 @ clueDos |
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 | |
namespace Amp\Socket; | |
final class TlsContext { | |
const TLSv1_0 = \STREAM_CRYPTO_METHOD_TLSv1_0_SERVER; | |
const TLSv1_1 = \STREAM_CRYPTO_METHOD_TLSv1_1_SERVER; | |
const TLSv1_2 = \STREAM_CRYPTO_METHOD_TLSv1_2_SERVER; | |
private $minVersion = \STREAM_CRYPTO_METHOD_TLSv1_0_SERVER; |
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 | |
$opts = [ | |
"http" => [ | |
"header" => "User-Agent: kelunik" | |
] | |
]; | |
$context = stream_context_create($opts); |
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 | |
# Benchmark for the cost of returning a new promise from then() for coroutines. | |
# | |
# - composer install | |
# - php bench.php | |
# - vi vendor/amphp/amp/lib/functions.php # remove 'done' branch --> https://git.io/v7NWW | |
# - php bench.php | |
require __DIR__ . "/vendor/autoload.php"; |