Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
/** | |
* The Damm check digit | |
* For more information cf. http://en.wikipedia.org/wiki/Damm_algorithm | |
* totally anti-symmetric quasigroup | |
* | |
* @author Wuri Nugrahadi <w.nugrahadi@gmail.com> | |
*/ | |
if (! function_exists('taq')) | |
{ |
I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.
These are the steps I went through to set up an SSL cert.
# File: /etc/apt/apt.conf.d/docker-autoremove-suggests | |
# Since Docker users are looking for the smallest possible final images, the | |
# following emerges as a very common pattern: | |
# RUN apt-get update \ | |
# && apt-get install -y <packages> \ | |
# && <do some compilation work> \ | |
# && apt-get purge -y --auto-remove <packages> | |
# By default, APT will actually _keep_ packages installed via Recommends or |
<?php | |
/** | |
How to run a code coverage report on a web page: | |
Simply put this code after the vendor require and before the rest of the calling logic. | |
(Assumes you have PHPUnit installed) | |
**/ | |
require_once __DIR__ . "/../vendor/autoload.php"; |
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
# Bazarr downloads subtitles | |
version: "3.4" | |
services: | |
bazarr: | |
image: linuxserver/bazarr:1.0.5-development | |
container_name: bazarr | |
restart: unless-stopped | |
environment: | |
- TZ=Europe/London |
<?php | |
$baselineFile = 'phpstan-baseline.neon'; | |
$branch = 'origin/main'; | |
echo "date;count\n"; | |
foreach (explode("\n", `git log {$branch} --pretty="format:%H;%cI" --date-order --reverse {$baselineFile}`) as $line) { | |
[$hash, $date] = explode(';', $line); | |
preg_match_all('`^\s+count:\s+(\d+)`m', `git show $hash:{$baselineFile}`, $matches); | |
echo $date, ';', array_sum(array_map('intval', $matches[1])), "\n"; | |
} |