Skip to content

Instantly share code, notes, and snippets.

<?php
require __DIR__.'/vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$socket = new React\Socket\Server($loop);
// Create a blob of data for testing
$data = '';
for ($i = 1; $i <= 8; $i++) $data .= $i.str_repeat("\0", 1022)."\n";
$ phing -f test.xml
Buildfile: test.xml
[PHP Error] Argument 1 passed to Mapper::__construct() must be an instance of Project, none given, called in vendor/phing/phing/classes/phing/Project.php on line 767 and defined [line 52 of vendor/phing/phing/classes/phing/types/Mapper.php]
test > test:
[copy] Copying 1 file to /tmp
BUILD FINISHED
@cs278
cs278 / getEnvironment.php
Created November 7, 2013 14:13
Fetch environment even if the $_ENV superglobal is unset due to the `variables_order` INI setting.
<?php
function getEnvironment() {
if ($_ENV) {
return $_ENV;
}
$keys = array_keys($_SERVER);
return $_ENV = array_filter(
@cs278
cs278 / github-pr-tag.js
Last active May 25, 2017 16:20
GitHub PR tag toggle boorkmarklet
(function(tag, domain) {
domain = domain || 'github.com';
// No tag supplied.
if (!tag) return;
// Bail out if not the correct domain.
if (domain !== window.location.hostname) return;
// String.trimLeft() method is required.
@cs278
cs278 / github-sudo.js
Last active August 29, 2015 14:00
Allow GitHub Sudo input to be filled by Chrome.
(function($, id) {
var $label = $('label[for=' + id + ']');
var $input = $('#' + id);
if ($('#sudo_username').length > 0) {
return;
}
$label.clone().attr('for', 'sudo_username').text('Username').insertBefore($label);
$input.clone().attr({
@cs278
cs278 / github-ws-toggle.js
Last active August 29, 2015 14:04
Toggles ignore whitespace on GitHub diffs.
(function(location, domain) {
var search, regexp;
domain = domain || 'github.com';
search = location.search;
regexp = /[\?&]w=1/;
if (domain !== location.hostname) return;
if (regexp.test(search)) {
@cs278
cs278 / github-list-hotkeys.js
Last active August 29, 2015 14:04
List GitHub hotkeys.
$('[data-hotkey]').map(function() {
var $this = $(this);
return '\''
+ ($this.text().trim() || $this.attr('href') || $this.attr('placeholder'))
+ '\': '
+ $this.data('hotkey').replace(/, */, ' or ');
}).toArray().join("\n")
@cs278
cs278 / gist:885545a2c923a56d6800
Created August 20, 2014 23:10
EmailValidator test results
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from /home/chris/src/symfony/vendor/egulias/email-validator/phpunit.xml.dist
.............................F...........FF.FF.F......F.....F.. 63 / 328 ( 19%)
....F..FF..F.F.F.F.......................................FF.... 126 / 328 ( 38%)
........FF.....FFFFF....FFFFF....F............................. 189 / 328 ( 57%)
............................................................... 252 / 328 ( 76%)
................................F.............F......FFFFF....F 315 / 328 ( 96%)
FFFF.........
<?php
use Composer\Autoloader\ClassLoader;
class loader
{
private $loader;
private $overlays = array();
public function __construct(ClassLoader $loader, array $overlays)
@cs278
cs278 / gist:a3a96af7bed205e18007
Last active August 29, 2015 14:15
Xubuntu setup

Cleanup

apt-get purge thunderbird*
apt-get purge firefox* xul-*
apt-get purge gnumeric*
apt-get purge abiword*
apt-get purge pidgin* libpurple*
apt-get purge gmusicbrowser
apt-get purge transmission*