Skip to content

Instantly share code, notes, and snippets.

@rrazor
rrazor / php-pcov-helper.sh
Created April 12, 2021 05:03
PHP wrapper to remove PhpStorm's XDebug command-line argument when PCov is in use
#!/bin/bash
# This script wraps php to help PhpStorm avoid loading XDebug when all we want
# is a PCov-enabled code coverage report (XDebug makes things very slow).
#
# We detect an argument that looks like -dzend_extension...xdebug.so and omit it
# if we _also_ detect a -dpcov.enabled=1 argument. All other arguments are
# passed through.
set -e
@rrazor
rrazor / time-datetime-test.php
Created May 23, 2019 14:24
Test showing that time() can be earlier than \DateTime() despite later in execution order
<?php
for ($tries = 0; $tries < 500000; ++$tries) {
$first = (int)((new \DateTime('now'))->format('U'));
$second = \time();
if ($second < $first) {
die("The second time was earlier after $tries tries:\n"
. " First: $first\n"
. " Second: $second\n");
@rrazor
rrazor / keybase.md
Created August 13, 2014 22:34
Keybase proof

Keybase proof

I hereby claim:

  • I am rrazor on github.
  • I am rrazor (https://keybase.io/rrazor) on keybase.
  • I have a public key whose fingerprint is 71DA 3537 5D8E 61DD 5370 50DC 3703 BDEF 734E 7374

To claim this, I am signing this object: