Skip to content

Instantly share code, notes, and snippets.

View axiac's full-sized avatar

Valentin VĂLCIU axiac

View GitHub Profile

Keybase proof

I hereby claim:

  • I am axiac on github.
  • I am axiac (https://keybase.io/axiac) on keybase.
  • I have a public key whose fingerprint is DBE8 F661 2144 A5DA E92B 12A5 C676 B18D 4CA4 8DD5

To claim this, I am signing this object:

@axiac
axiac / GlobIterator-count--bug.php
Last active July 6, 2021 11:00
A PHP bug reported in 2011: https://bugs.php.net/bug.php?id=55701. Four years and four versions later, the bug is still there, affecting versions 5.3, 5.4, 5.5, 5.6 and 7.0
<?php
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', '1');
$glob = new GlobIterator(__DIR__.'/*.some-funky-termination-that-doesnt-match-any-file-in-this-directory');
echo('Number of matching files: '.$glob->count()."\n");
// It should display the above message with 0 files but it throws a confusing exception:
// LogicException: The parent constructor was not called: the object is in an invalid state
@axiac
axiac / TestFrameworkInATweet.php
Created February 29, 2016 15:13 — forked from mathiasverraes/TestFrameworkInATweet.php
A unit testing framework in a tweet.
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
@axiac
axiac / php-mock-objects-issue-260.php
Created March 15, 2016 13:51
Sample test case for sebastianbergmann/phpunit-mock-objects issue #260
<?php
/**
* Sample test case for https://github.com/sebastianbergmann/phpunit-mock-objects/issues/260
*/
interface Dependency
{
/**
@axiac
axiac / pythagorean-triples.c
Last active November 7, 2017 14:49
Verifies if three integer numbers can be the legs of a right-angle triangle, while trying to avoid overflowing on large input values.
/**
* A short program that verifies if three integer numbers can be the legs of a right-angle triangle.
* The program's purpose is to avoid overflowing when the legs are large numbers.
*
* It accompanies an answer to this StackOverflow question: http://stackoverflow.com/q/36623053/4265352
* @link http://stackoverflow.com/a/36626811/4265352
*/
#include <stdio.h>
#include <stdlib.h>
@axiac
axiac / merge-mockobjects-into-phpunit.sh
Created May 9, 2018 06:16
One-time script designed to "transplant" the history of PhpUnit MockObjects project into the PhpUnit repo as a branch
#!/bin/bash
#
# One-time script specifically designed to "transplant" a part of
# the PhpUnit MockObjects repo into the PhpUnit repo as a branch.
# @see https://github.com/sebastianbergmann/phpunit/issues/3103
#
#
# Define some constants