Skip to content

Instantly share code, notes, and snippets.

🌖
It's happening

Alex Rock Pierstoval

🌖
It's happening
Block or report user

Report or block Pierstoval

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
View README.md

Native mocks versus PHPUnit mocks

Mock type Tests duration
Native mocks 160.10 seconds
Mockery 177.01 seconds (+10%)
PHPUnit mocks 232.29 seconds (+45%)
Prophecy 3868.80 seconds (+2416%)
View GetHttpClientTestTrait.php
<?php
declare(strict_types=1);
namespace Tests;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase as BaseWebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
View change_bg.bash
# Change the current background according to a distant URL.
# Needs the "feh" package to work.
DISPLAY=:0 XAUTHORITY=$HOME/.Xauthority feh --bg-center http://rammb.cira.colostate.edu/ramsdis/online/images/latest/himawari-8/full_disk_ahi_natural_color.jpg
# Source: https://twitter.com/docteur_klein/status/1130730930031779840
View AdminPostController.php
<?php
declare(strict_types=1);
/*
* (c) Alexandre Rock Ancelet <pierstoval@gmail.com> and Studio Agate.
*
* Licensed with MIT
*/
View mysql_docker.bash
docker run \
--name=mysql_host \
-dit -e MYSQL_ROOT_PASSWORD=mysql \
-p 3306:3306 \
mysql:5.7
@Pierstoval
Pierstoval / Makefile
Last active Apr 2, 2019
RequestTracker bootstraping makefile
View Makefile
RTDIR = ${REQUEST_TRACKER_DIR}
echo:
@echo "${WOW}"
##
## RequestTracker
## --------------
##
View .php_cs
<?php
$finder = PhpCsFixer\Finder::create()
->exclude([
'vendor',
])
->in([
__DIR__.'/src/',
__DIR__.'/tests/'
])
View img_to_output_via_memory.php
<?php
$h = fopen('php://memory', 'ab+');
$gd = @imagecreate(110, 20);
if (false === $gd) {
throw new \RuntimeException('GD image is invalid');
}
@Pierstoval
Pierstoval / benchmark_outputs.txt
Last active Aug 23, 2018
Benchmarking array_key_last php function from version 7.3. | Script based on http://www.php-benchmark-script.com
View benchmark_outputs.txt
---------------------------------------------------
| PHP BENCHMARK SCRIPT |
---------------------------------------------------
Start : 2018-08-23 08:37:29
PHP version : 7.3.0beta2
Platform : Linux
Each test executed 10000 times
---------------------------------------------------
test_array_reverse 650.660 sec.
test_array_key_last 0.049 sec.
View weird.js
// LOOOTS of stuff there: https://github.com/denysdovhan/wtfjs
// From https://www.destroyallsoftware.com/talks/wat
[] + []; // empty string
[] + {}; // [object Object]
{} + []; // 0
{} + {}; // NaN
Array(16); // ,,,,,,,,,,,,,,,, (array with 16 undefined elements)
Array(16).join('wat'); // watwatwatwatwatwatwatwatwatwatwatwatwatwatwatwat (array with 16 "wat" strings)
You can’t perform that action at this time.