Skip to content

Instantly share code, notes, and snippets.

View mRoca's full-sized avatar
:octocat:
wip

Michel Roca mRoca

:octocat:
wip
  • Freelance
  • Lyon
View GitHub Profile
@mRoca
mRoca / github-prs-to-approve.js
Last active October 2, 2026 11:10
Browser script displaying the list of PRs I have to approve in a repository
// Source: https://gist.github.com/mRoca/112a0e6cb58b254b0c7da45ed4d1dac7
// Push every edit made to a local copy back to that gist: it is the copy everyone installs from.
// gh gist edit 112a0e6cb58b254b0c7da45ed4d1dac7 --filename github-prs-to-approve.js <local-copy>
//
// Changelog, newest first: add one line per version you push. The gist history starts at 8.20.0.
// 8.36.1 Leaves the pull request links of comments and descriptions alone.
// 8.36.0 Reloading the page refetches the whole scope once the cache is over thirty seconds old; the badge animates after a reload or a navigation.
// 8.35.0 A comment made after a review request answers it, so the pull request leaves the amber bucket although GitHub still lists you as a reviewer.
// 8.34.2 Approving then going back to the list within a few seconds refetches the approved pull request instead of nothing.
// 8.34.1 Adds this changelog.
@mRoca
mRoca / extension.js
Created July 7, 2026 15:24
Github Avoid truncating PR titles
// ==UserScript==
// @name Revert GitHub PR Title Truncation
// @namespace https://github.com/lionel-rowe/
// @version 0.4
// @description Revert GitHub PR Title Truncation
// @author https://github.com/lionel-rowe/
// @match https://github.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// @run-at document-start
@mRoca
mRoca / settings.json
Last active April 7, 2026 11:34
Claude status line
{
"statusLine": {
"type": "command",
"command": "bash .claude/statusline-command.sh"
}
}
// ==UserScript==
// @name GitHub Mark File Viewed
// @version 0.1
// @description Mark file as "viewed" on GitHub PR UI when hovering and pressing 'Escape' key
// @match https://github.com/*
// ==/UserScript==
function markFileAsViewed() {
// Legacy Github PR review page
const legacyFileEl = document.querySelector(
@mRoca
mRoca / CreateMissingForeignKeysIndexesTestCommand.php
Created October 8, 2024 09:43
Laravel - Create a migration adding an index for all foreign keys
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use Doctrine\DBAL\Schema\Index;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Schema;
#!/usr/bin/env sh
set -e
# Usage:
# export CI_API_TOKEN=<YOUR_TOKEN with api scope from https://gitlab.com/profile/personal_access_tokens>
# export CI_API_V4_URL=https://gitlab.com/api/v4
# export CI_PROJECT_ID=37
#
# ./deployment/bin/stop-all-dev-environments
<?php
/**
* Usage : php valleys.php 8 DDUUUUDD
*
* 1
*/
function countValleys(string $path): int
{
<?php
/**
* Usage : php staircase.php 4
*
* #
* ##
* ###
* ####
*/
<?php
/**
* Returns all days between two dates matching a wanted position in a week, in a month.
*
* For instance, in order to get all dates matching the request:
* "First and third monday and friday of each month between 2022-01-08 and 2022-06-15" :
*
* $days = getDatesInRangeByDaysInMonth(new DateTimeImmutable('2022-01-08'), new DateTimeImmutable('2022-06-15'), [1, 5], [1, 3]);
*
@mRoca
mRoca / EntityExporter.php
Last active February 9, 2022 17:32
Export all MySQL related data - One row and all its relationships
<?php
namespace App\Service;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Table;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;