Skip to content

Instantly share code, notes, and snippets.

View lyrixx's full-sized avatar
😀

Grégoire Pineau lyrixx

😀
View GitHub Profile
@lyrixx
lyrixx / .gitignore
Last active July 28, 2023 14:13
UUID generation in PHP
/vendor/
@lyrixx
lyrixx / README.md
Last active February 13, 2023 10:39
[GitHub] Bookmarklet to mark all files in a PR a "viewed"

Add the following bookmark:

javascript:boxes=document.getElementsByClassName("js-reviewed-checkbox"),counter=0;for(let e=0;e<boxes.length;e++){const t=boxes[e];!t.checked&&(t.click(),counter++)}alert("Folded "+counter);

Then click on it to mark all "viewed" checkbox to checked

@lyrixx
lyrixx / post-checkout
Created June 26, 2013 13:37
Git post checkout
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR='\e[0m'
@lyrixx
lyrixx / watch.sh
Created July 22, 2022 13:54
Watch dir and copy on change
watch -n 1 cp -u -R ./source ./dest
# Run every seconds: `-n 1`
# Copy everything from "source" to "dest":
# `-R ./source ./dest`
# But only if the content is different `-u`
@lyrixx
lyrixx / README.md
Last active August 18, 2022 08:41
How to "control" auto-completion in Google Chrome address bar?

How to "control" auto-completion in Google Chrome address bar?

For a while, when I type g in the address bar, it suggests me the following URL

https://github.com/foobar/hello/projects/9

But I don't want this URL at the first position. I don't even use this URL!

@lyrixx
lyrixx / README.md
Last active March 22, 2022 14:01
PHP + Stream Wrapper + Stream Filter // Reproducer

PHP + Stream Wrapper + Stream Filter // Reproducer

Reproducer for php/php-src#8219

Usage

Run php index.php

Output

@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 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 / README.md
Last active February 21, 2020 13:51
Add shared tracks in to slack to a Spotify Playlist
@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;