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 | |
| function compute_age(string $ymd): int | |
| { | |
| return (new \DateTime($ymd))->diff(new \DateTime())->y; | |
| } |
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 | |
| function byte_format($bytes, $precision = 2, $dec_point = '.') | |
| { | |
| // From https://stackoverflow.com/a/37523842 | |
| $units = ['o', 'Ko', 'Mo', 'Go', 'To']; | |
| $bytes = max($bytes, 0); | |
| $pow = min( | |
| floor(($bytes ? log($bytes) : 0) / log(1024)), | |
| count($units) - 1 |
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
| gs \ | |
| -dNOPAUSE \ | |
| -sDEVICE=pdfwrite \ | |
| -sOUTPUTFILE=output.pdf \ | |
| -dBATCH \ | |
| -dPDFSETTINGS=/printer \ | |
| -dPrinted=false \ | |
| -dEmbedAllFonts=true \ | |
| -dSubsetFonts=true \ | |
| -dFastWebView=true \ |
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 | |
| # Run like this: | |
| # | |
| # sh change_rules.sh /path/to/wordpress | |
| # | |
| chown -R www-data:www-data "$1" | |
| find "$1" -type d -exec chmod 755 {} + | |
| find "$1" -type f -exec chmod 644 {} + |
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
| # Optimisation JPEG basique | |
| jpegoptim -s -o fichier.jpeg | |
| # Création d'une vignette pour un fichier PDF avec Ghostscript (PNG avec canal alpha, carré de 400x400px) | |
| gs \ | |
| -q \ | |
| -sDEVICE=pngalpha \ | |
| -dPDFFitPage=true \ | |
| -dLastPage=1 \ | |
| -dDEVICEWIDTHPOINTS=400 \ |
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->_View->viewVars['var']; |
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
| git log --oneline --decorate --all --graph |
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
| $handle = fopen('php://stdin', 'rb'); | |
| $contents = stream_get_contents($handle); | |
| fclose($handle); | |
| var_dump($contents); |
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
| AssertTrue & AssertFalse | |
| AssertEquals | |
| AssertGreaterThan | |
| LessThanOrEqual | |
| AssertContains | |
| AssertType | |
| AssertNull | |
| AssertFileExists | |
| AssertRegExp |
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 | |
| include('Michelf/Markdown.php'); | |
| use \Michelf\Markdown; | |
| /** | |
| * Custom Markdown class | |
| * | |
| * This class has just one method yet, to do inline transform without some |
NewerOlder