Skip to content

Instantly share code, notes, and snippets.

🎛
On it

Holger Woltersdorf hollodotme

View GitHub Profile
@hollodotme
hollodotme / generatorForEach.php
Created Nov 7, 2018
Comparison of generator with foreach and yield from
View generatorForEach.php
<?php declare(strict_types=1);
class Test
{
private $arr = [];
public function __construct()
{
for ( $i = 0; $i < 10000; $i++ )
{
@hollodotme
hollodotme / GroupedTestDox.md
Last active May 6, 2018
PHPUnit Testdox mit gruppierten Data-Sets im Markdown-Format
View GroupedTestDox.md

😊 Passed | 🤬 Error | 😡 Failure | 😠 Warning | 🧐 Risky | 😶 Incomplete | 🤫 Skipped

Test suite: Unit

  • Environment: Development
  • Base namespace: Fortuneglobe\Prometheus\Exporters\Tests

Unit\Application\Metrics\GaugeListTest

  • Can Get Metric String For Multiple Gauges (😊 1)
@hollodotme
hollodotme / PassthroughCallbackWithTimedBuffer.php
Created Apr 17, 2018
Passthrough callback with timed buffer
View PassthroughCallbackWithTimedBuffer.php
<?php declare(strict_types=1);
final class TimedBuffer
{
private $buffer = '';
private $intervalMs;
private $startTime;
View phpunit-bootstrap.php
<?php declare(strict_types=1);
if (
extension_loaded( 'xdebug' )
&& version_compare( '2.6.0', phpversion( 'xdebug' ), '<=' )
)
{
/** @noinspection PhpUndefinedFunctionInspection */
/** @noinspection PhpUndefinedConstantInspection */
xdebug_set_filter(
@hollodotme
hollodotme / .travis.yml
Last active Jan 14, 2019
Using xdebug filter for code coverage on travis-ci
View .travis.yml
language: php
php:
- 7.1
- 7.2
branches:
only:
- master
- development
@hollodotme
hollodotme / keybase.md
Created Oct 28, 2017
Keybase.io Verification
View keybase.md

Keybase proof

I hereby claim:

  • I am hollodotme on github.
  • I am hollodotme (https://keybase.io/hollodotme) on keybase.
  • I have a public key whose fingerprint is 38F8 06CE 3071 114C 991A 6C2F B878 F8C0 C810 7679

To claim this, I am signing this object:

@hollodotme
hollodotme / convert.io-os-x-finder-service.md
Last active Oct 15, 2017
OS X Finder service for converting PDF to SVG via convert.io
View convert.io-os-x-finder-service.md

Install convert.io CLI client

See here.

Create an API key for convert.io

See here.

Create a Finder service to convert PDF to SVG files

View CompositeException.md
<?php declare(strict_types=1);


class CompositeException extends \Exception
{
	/** @var array */
	private $throwables = [];

	public function __construct( \Throwable ...$throwables )
@hollodotme
hollodotme / PhpStormProjectTemplateFeatureRequest-Draft.md
Last active Oct 16, 2017
[DRAFT] PhpStorm feature request to make project templates more beneficial
View PhpStormProjectTemplateFeatureRequest-Draft.md

Background

I often start new projects and need to set up a bunch of strings and variables inside my project created from a template. You can see my github repo template here. Just search it for "VendorName" or "PackageName" and you'll see what I mean.

These variables are always the same in the beginning and I need to remember what names I used and where I need to replace them. Since this is a repetitive task, I seek more automation. Currently the project template feature in PhpStorm 2017.1 does not support custom variables at all.

I also work in a team that uses a similar project template. The team should be able to benefit from the updates to the project template, and everyone on the team should be able to update the template. That's why we use a git repository for that, instead of local PhpStorm project templates. Again repetitive work has to be done when creating a new project from that repository (git clone, remember and replace variables, etc.). Curre

View serverguard-slack-proxy.php
<?php declare(strict_types=1);
/**
* @author hollodotme
* This script receives a POST request from www.serverguard24.de
* and transforms it to a POST request to a slack webhook URL with JSON payload
* 1. Configure a slack webhook URL and paste it here in line 75
* 2. Put this script on a server an make it accessible via http
* 3. Add a contact at serverguard24.de and paste the URL to this script in HTTP Push URL field
* 4. Add the contact to your server guard checks
* NOTE: Script is written for PHP >= 7.1
You can’t perform that action at this time.