This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.redmine.org/boards/2/topics/62095 | |
# RAILS_ENV=production bin/rails console | |
> p = Project.find("$project_name") | |
> p.issues.where("closed_on < '#{365.days.ago}'").each(&:destroy) | |
# To perform this actions across all projects... | |
> Issue.where("closed_on < '#{365.days.ago}'").each(&:destroy) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a search replace instruction to replace deprectated assertAttributeEquals by assertEquals in PHPUnit code : | |
Search : \$this->assertAttributeEquals\(([$\[\]|a-zA-Z1-9 ,]+), '([a-zAZ])([a-zAZ]+)', ([$1-9a-zA-Z\->]+)\); | |
Replace : $this->assertEquals($1, $4->get\U$2$3()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install ocrmypdf | |
ocrmypdf inputfile.pdf ocrized_outputfile.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This code show how you can easily convert a XML file to an associative array | |
// var_dump( | |
// json_decode( | |
// json_encode( | |
// simplexml_load_string( | |
// file_get_contents( | |
// "https://gist.githubusercontent.com/npotier/5732b6311d2baf95c0e6d5dd7fdeb93f/raw/f6c751f85ad6e646c6f89c81a5ee3a8d452151f5/sample.atom" | |
// ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install git fame | |
gem install git_fame | |
# Install all vendors with source | |
rm -rf vendor/* | |
composer update --prefer-source | |
# Do the calculations. This might take 30 minutes to complete. | |
rm output.txt | |
find ./vendor -type d -depth 2 ! -path "./vendor/composer" -exec echo {} \; -exec git fame --sort=loc --hide-progressbar --repository={} \; >> output.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Nicolas Potier <[email protected]> | |
* | |
* Convert img src="" present in HTML page to <img src="data:image..." | |
* This Script is inspired by https://joekuan.wordpress.com/2015/02/01/converting-html-document-with-img-src-link-to-img-embedded-data-in-php/ | |
* | |
* usage : php convert.php source.html destination.html | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The URL you want to check | |
url="HTTP_MY_AWESOME_URL" | |
status_code=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' $url) | |
date=`date` | |
# The channel or user you want to notify | |
channel="MY_CHANNEL" | |
# The displayed bot username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Guide du style de code | |
Ce guide étend et agrandit le PSR-1, le standard basique de codage | |
Le but de ce guide est de réduire la complexité de lecture du code d'auteurs différents. Il le fait en listant un ensemble de règles et d'explication à propos du format du code PHP. | |
Les règles de styles sont issues de points communs entre les différents membre du projet. Quans plusieurs auteurs collaborents ensemble sur différents projets, la mise en place de bonnes pratiques est une aide. Cependant, les avantages de ce guide ne sont pas les règles en elle-mêmes, mais le fait de partager ces règles. | |
Les mots clés "DOIT", "NE DOIT PAS", "REQUIS", "DEVRAIT", "NE DEVRAIT PAS", "RECOMMANDE", "POURAIT", "OPTIONNEL", dans ce document doivent être interprétés comme décrit dans la RFC 2119. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Présentation | |
Les fichiers DOIVENT utiliser uniquement les tags <?php et <?= . | |
Les fichiers DOIVENT utiliser uniquement un encodage UTF-8 sans BOM pour le code PHP. | |
Les fichiers PEUVENT soit déclarer des traitements (classes, fonctions, constantes, etc.) ou modifier l'environnement (par exemple générer du contenu, changer les paramètres .ini etc.) mais ne peuvent pas faire les deux. | |
Les Namespaces et les classes DOIVENT suivre un "autoloading" PSR: [PSR-0, PSR-4]. | |
Les noms de classes DOIVENT être déclarés en StudlyCaps. | |
les constantes de classe DOIVENT être déclarées en majuscule avec des underscore en séparateurs. | |
les noms des méthodes DOIVENT être déclarées en camelCase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: firewall | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Démarre les règles iptables | |
# Description: Charge la configuration du pare-feu iptables | |
### END INIT INFO |
NewerOlder