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 / settings.json
Last active April 7, 2026 11:34
Claude status line
{
"statusLine": {
"type": "command",
"command": "bash .claude/statusline-command.sh"
}
}
@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;
// In Github PRs list page,
// this scripts adds "You approved this pull request, you opened this pull request, You left a review, ..." for each PR line
//
// Recommanded usage for Chrome
// - extension: https://chromewebstore.google.com/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld
// - for: https://github.com/*
//
// Recommanded usage for Firefox
// - extension: https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
#!/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;
---
format_version: '8'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
workflows:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install curl vim git htop iftop terminator zsh jq p7zip
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs
sudo snap install vlc
sudo snap install btop