Skip to content

Instantly share code, notes, and snippets.

View Pictor13's full-sized avatar
🤹‍♂️
Juggling with curiosity

Igor Pellegrini Pictor13

🤹‍♂️
Juggling with curiosity
  • BerlinOnline Stadtportal GmbH & Co. KG
  • Berlin
View GitHub Profile
@Pictor13
Pictor13 / gist:696ccbff671393e2c912
Created January 29, 2015 15:48
"Compare to Stash..." custom comparision for Sublimerge
# Add the custom comparision "Compare to Stash..." to SublimeMerge plugin
# This allows to compare the current file with the version contained in a stash.
# Custom Comparisions.sublime-settings -- User
{
"custom_comparisons_user": [
{
"name": "Compare to Stash...",
"requires": "git",
"steps": [
@Pictor13
Pictor13 / Honeybee\Honeybee\AggregateRootCommandBuilder.php
Created July 5, 2018 00:32
To understand flatten() method. This is an example of hierarchy of errors resulted from validation of command_state generated by the command builder (state would be passed to created Command, if there wouldn't be errors.
/**
* Contains conventions for errors array format.
* Probably used just for errors array.
* ^.|.(not "values" or "embedded_entity_commands").(decimal|.)..
* eg key for attribute path: .book.2.
$errors = [
[ // error
]
@Pictor13
Pictor13 / AgaviValidationManager-getErrorNames.php
Last active July 11, 2018 19:17
Override of AgaviValidationManager->getErrorNames() [that probably was forgotten to be implemented... ... anyway was deprecated]. Useful for retrieving the errors by the name that was used with 'throwError()' in the Validator or that is used for translations in the 'validate.xml'.
<?php
/**
* Retrieve an array of error names.
*
* @return array An indexed array of error names.
*
* @author Igor Pellegrini <[email protected]>
* @author Sean Kerr <[email protected]>
* @author Dominik del Bondio <[email protected]>
@Pictor13
Pictor13 / AgaviWebRouting.md
Last active July 18, 2018 13:53
Notes about AgaviRouting
  • input parameters are the input in the querystring. extraParams dunno yet. usedParams are the params provided to url generation method.
  • agavi doesn't filter the just valid parameters; if you add &foo=bar it will end in the result of gen(nullRoute)
    • (any parameter to just pass the validated parameters?)
  • AgaviWEBrouting encodes with rawurlencode by default (to test it try to create an AgaviRoutingValue with routing->createValue. One of the params should be to explicitly choose encoding or not.
  • fillGenNullParameters() returns getMatchedParameters(), that are the $url_params passed to routing->gen(route, url_params) E.g. {"firstchar":"a","baseSearch":"ricerca","baseVenue":"luoghi","basePath":"\/it\/biglietti"}
@Pictor13
Pictor13 / git-tag++
Last active September 12, 2018 18:20
Bash script to increment and add a new git-tag (according to 'semver') [e.g.: "git tag++ -p"]
#!/bin/bash
# Increment a version string using Semantic Versioning (SemVer) terminology, and adds it to git-tags
# - Customised from: https://github.com/fmahnke/shell-semver/blob/master/increment_version.sh)
# INSTALL: put the script in a PATH directory. 'git' will recognize automatically the new command.
# USAGE: "git tag++ -p"
# "git tag++ -Mp"
# BEWARE: "git describe" returns the last-tag JUST for the current tree!
# if amend a commit the SHA will change and the eventual tag will still point to the old unchanged commit
@Pictor13
Pictor13 / remove-google-ads-from-serp.js
Last active May 9, 2024 16:09
Tampermonkey userscript to remove the annoying first fake results (they are ADs), form Google SERP
// ==UserScript==
// @name remove-google-ads
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove ADs fake-search-results on Google SRP
// @author Igor Pellegrini
// @include /^https?\:\/\/.*.google\..*\/search.*$/
// @grant GM_log
// ==/UserScript==
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes (needs to be ran as root):
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@Pictor13
Pictor13 / Tampermonkey.FuckOffYoutube
Last active December 3, 2020 19:30
Youtube: press "Y" to watch /embed video version. Remove distractions, cookies/privacy requests (you can µBlock all now), useless comments, dopamine-dealers video-suggestions, and all that useless stuff that tracks you.
// ==UserScript==
// @name Youtube Fucookies
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Fuck off Youtube attempts to get your cookies. Press "Y" for going to /embed page and just watch the damn thing.
// @author Igor Pellegrini
// @include /^https?\:\/\/.*youtube\..*\/.*\?.*v=[^&]+.*$/
// @grant GM_log
// ==/UserScript==
@Pictor13
Pictor13 / php-docker-ext
Created October 28, 2021 01:47 — forked from hoandang/php-docker-ext
Complete list of php docker ext
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
@Pictor13
Pictor13 / fowler.md
Created November 11, 2021 13:49 — forked from danilobatistaqueiroz/fowler.md
Notes from Martin Fowler's "Refactoring"

Refactoring, Fowler

http://martinfowler.com/books/refactoring.html

Five or six years ago I was working on an essay about refactoring CSS. I didn't do that, but I did find these notes while working on something new. Hope they're useful! —Dean

p7 "When you find you have to add a feature to a program, and the program's code is not structured in a convenient way to add the feature, first refactor the program to make it easy to add the feature, then add the feature."

p7