Skip to content

Instantly share code, notes, and snippets.

View lyrixx's full-sized avatar
😀

Grégoire Pineau lyrixx

😀
View GitHub Profile
@lyrixx
lyrixx / index.php
Created April 22, 2020 13:20
Very low memory usage iterator
<?php
function m()
{
$memory = round(memory_get_usage() / 1024 / 1024, 2);
$frame = debug_backtrace(0, 1)[0];
$file = basename($frame['file']);
$line = $frame['line'];
printf("%s:%d | %sMb\n", $file, $line, $memory);
@lyrixx
lyrixx / README.md
Last active February 21, 2020 13:51
Add shared tracks in to slack to a Spotify Playlist
@lyrixx
lyrixx / README.md
Last active March 17, 2020 16:34
Spotify does not handle Media Keys

Debug media keys and Spotify

TL;DR: There is a bug in gnome that have been fixed in 3.3. But you can temporary fix this issue with: pkill gsd-media-keys

Let's Debug

  1. We check logs

@lyrixx
lyrixx / .gitignore
Last active July 28, 2023 14:13
UUID generation in PHP
/vendor/
@lyrixx
lyrixx / HardCoreDebugLogger.php
Last active April 27, 2024 14:09
Hardcore Debug Logger
<?php
const STREAM_OPEN_FOR_INCLUDE = 128;
final class HardCoreDebugLogger
{
public static function register(string $output = 'php://stdout')
{
register_tick_function(function () use ($output) {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
@lyrixx
lyrixx / rootCA.pem
Created February 25, 2019 10:24
my rootCA.pem (mkcert)
-----BEGIN CERTIFICATE-----
MIIEjTCCAvWgAwIBAgIQcxWNVb9OEeS51am6xUW6FzANBgkqhkiG9w0BAQsFADBf
MR4wHAYDVQQKExVta2NlcnQgZGV2ZWxvcG1lbnQgQ0ExGjAYBgNVBAsMEWdyZWdv
aXJlQGdyZWdvaXJlMSEwHwYDVQQDDBhta2NlcnQgZ3JlZ29pcmVAZ3JlZ29pcmUw
HhcNMTkwMTIzMTAyNjMzWhcNMjkwMTIzMTAyNjMzWjBfMR4wHAYDVQQKExVta2Nl
cnQgZGV2ZWxvcG1lbnQgQ0ExGjAYBgNVBAsMEWdyZWdvaXJlQGdyZWdvaXJlMSEw
HwYDVQQDDBhta2NlcnQgZ3JlZ29pcmVAZ3JlZ29pcmUwggGiMA0GCSqGSIb3DQEB
AQUAA4IBjwAwggGKAoIBgQDz7qMbfPDd3tn8Q1RYMZBuQiQclK/MRi9mwOT78rnw
Oy520t2VqThX6Cp47JnSgmglOQK0LuY2YuYXIVAMusnC5M+oP6vRK2H4DIFq/9Pc
HVIgPDsbx1e4hyEodqDK0G8Q0sufvmWqHu7olvHpXIVSvp+1nGtOgkJ8kTkjrHWR
@lyrixx
lyrixx / BrokerFactory.php
Last active July 1, 2019 15:21
PHPStan extension to extract property type hint from constructor argument
<?php
use PHPStan\Broker\Broker;
use PHPStan\Broker\BrokerFactory as PhpstanBrokerFactory;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\Php\PhpPropertyReflection;
use PHPStan\Reflection\PropertiesClassReflectionExtension;
use PHPStan\Reflection\PropertyReflection;
use PHPStan\Type\ObjectType;
@lyrixx
lyrixx / run.php
Last active November 9, 2023 13:51
Updated your templates with the new twig include
<?php
<<<CONFIG
packages:
- "symfony/finder: ~3.0"
- "symfony/console: ~3.0"
CONFIG;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@lyrixx
lyrixx / index.php
Created August 11, 2017 16:14
Box PHP calls
<?php
class Foobar
{
public function success()
{
return $this->box('doSuccess', false, '123', '456');
}
public function fail()
@lyrixx
lyrixx / .gitignore
Last active February 24, 2017 15:50
Blackfire Upload
/composer.json
/composer.lock
/vendor/