Skip to content

Instantly share code, notes, and snippets.

@yoanm
yoanm / action.yml
Last active March 27, 2024 10:29
Composit GHAction - with embeded standalone JS files
name: A NAME
description: A DESCRIPTION
inputs:
my-multiline-input:
description: A multiline user input
outputs:
my-output:
description: Returns "bar"
@yoanm
yoanm / pvm.sh
Created August 18, 2023 09:54
PHP version manager - brew
# Paste that function on your ~/.bashrc (or ~/.bashrc_profile for mac)
# /!\ PHP version has to be already installed, if not command won't work /!\
#
# Usage: `pvm 5.6` / `pvm 8.2` / ...
function pvm()
{
current=$(php --version | head -n 1 | sed 's/PHP \([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9][0-9]* .*/\1.\2/')
if [[ "$current" == "$1" ]]; then
echo "PHP already at $1 !"
else
@yoanm
yoanm / Readme.md
Last active June 30, 2020 08:08
Composer local package dev/debug
  • Add following to composer.json of project which uses the package to update/debug :
"repositories": [
    {
        "type": "path",
        "url": "../path/to/directory/of/package",
        "options": {
            "symlink": true
        }
 }
@yoanm
yoanm / Readme.MD
Created January 7, 2019 15:27
twgit with gpg sign
  • Apply patch
  • Add the following on conf/twgit.sh file:
TWGIT_GIT_COMMIT_GPG_SIGN_OPTION=' -S '
TWGIT_GIT_MERGE_GPG_SIGN_OPTION=' -S '
TWGIT_GIT_TAG_GPG_SIGN_OPTION=' -s '
@yoanm
yoanm / git_stat.md
Last active February 27, 2018 10:23
Git statistics by user

Basic

git ls-files | while read f; do git blame --line-porcelain $f | grep '^author '; done | sort -f | uniq -ic | sort -n

Without blank line nor moved line between files

git ls-files | while read f; do git blame -w -M -C -C --line-porcelain $f | grep '^author '; done | sort -f | uniq -ic | sort -n
\set QUIET 1
/* Replace null value on display by '(null)' */
\pset null '(null)'
/* Prompt customization */
\set PROMPT1 '%n@%/%R%x%#'
\pset linestyle unicode
\pset border 1
\pset pager_min_lines 100
\set COMP_KEYWORD_CASE upper
/* History by database */
<?php
Class Sample
{
private function deleteDirectory($dir)
{
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ('.' != $file && '..' != $file) {
$path = implode(DIRECTORY_SEPARATOR, [$dir, $file]);
@yoanm
yoanm / composer.json
Last active March 3, 2017 11:15
Composer scripts examples
{
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "2.*",
"behat/behat": "~3.0"
},
"scripts": {
@yoanm
yoanm / .scrutinizer.yml
Last active February 13, 2022 12:09
Default scrutinizer configuration for a newly created PHP project
checks:
php:
code_rating: true
duplication: true
build_failure_conditions:
- 'project.metric_change("scrutinizer.quality", < -0.10)'
- 'elements.rating(<= D).exists' # No classes/methods with a rating of D or worse
- 'elements.rating(<= D).new.exists' # No new classes/methods with a rating of D or worse allowed
- 'issues.label("coding-style").exists' # No coding style issues allowed