Skip to content

Instantly share code, notes, and snippets.


Andrea Bergamasco vjandrea

View GitHub Profile
vjandrea /
Created Mar 15, 2022
Controller inheritance and extension
# src/Controller/ParentController.php

namespace App\Controller;

use App\Entity\Product;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
vjandrea /
Last active Nov 11, 2021
Change php cli version in plesk
printf "Switching php to version 5.6 with symlinks.\n"
printf "Press any key to continue...\n"
printf "Creating backups..."
# Backup original binaries
vjandrea / AccessChecker.php
Last active Jul 29, 2021 — forked from leotiger/
Symfony 4: Check if a route is accessible to a User based on their roles
View AccessChecker.php
* @Author Andrea Bergamasco <>
* Inspired by @leotiger:
* Usage:
* $token = $this->security->getToken();
* $this->accessChecker->userTokenCanAccessRoute($token, 'admin.index');
vjandrea / artboard_sort.js
Created Apr 22, 2020
Sort Illustrator artboards alphabetically - by OMOTI
View artboard_sort.js
Kudos to OMOTI
function sortArtboard() {
var doc = app.activeDocument,
properties = [],
vjandrea / workflow.yaml
Created Jan 6, 2020
workflow.yaml - testing double "from" marking
View workflow.yaml
# Entity workflow - object names redacted
# A SuperUser can send an Entity to an Evaluator
# The Evaluator decides to optIn or optOut the request. They can change their mind until a timeout defined in the Entity.
# If Evaluator opts in, the Entity is then sent to the Recipient.
# The Recipient finally decides to accept or refuse
type: workflow
vjandrea / SymfonyExtension debugging
Last active Sep 11, 2019
View SymfonyExtension debugging
$ composer require --dev friends-of-behat/symfony-extension:^2.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.3.*"
Nothing to install or update
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [OK]
vjandrea /
Created Feb 23, 2017
API Map for Snipe-IT

Snipe-IT API Map

Domain Method URI Name Action Middleware
GET/HEAD api/v1/accessories api.accessories.index App\Http\Controllers\Api\AccessoriesController@index auth:api
POST api/v1/accessories App\Http\Controllers\Api\AccessoriesController@store auth:api
GET/HEAD api/v1/accessories/{accessory} App\Http\Controllers\Api\AccessoriesController@show auth:api
vjandrea / cleanup.bat
Created May 20, 2019
Clean Mac folders on Windows
View cleanup.bat
@echo Removing .DS_STORE...
@echo ...OK
@echo Removing Thumbs.db...
DEL /S /AH "Thumbs.db"
@echo ...OK
@echo Removing __MACOSX...
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d __MACOSX') do ( rd /s /q "%%i")
vjandrea /
Last active May 20, 2019
Correct the filenames of files extracted in Windows from archives compressed on Mac OS
import glob
import re
import os
path = 'puntata*/**/BLOCCO*/*.mp3'
def repair_filename(filename):
repair = {
'´╝ê': '(', # U+0028 LEFT PARENTHESIS
vjandrea / quote_escaping_example.lua
Last active Sep 9, 2018
LUA Quote escaping in grandma2
View quote_escaping_example.lua
I am struggling to find the best way to nest quotes while developing grandma2 plugins in LUA
This example shows the best solution i've found so far (ESCAPED SiNGLE QUOTES), but unfortunately
the command line doesn't like single quotes either. Any suggestion?
function quote_escaping_example()
gma.echo("Quote escaping example")
gma.cmd('Store Sequence 1.1 "QUOTE ESCAPING"');