Skip to content

Instantly share code, notes, and snippets.

View alphp's full-sized avatar

Fernando Herrero alphp

View GitHub Profile
@bohwaz
bohwaz / php-8.1-strftime.php
Last active April 26, 2024 12:09
strftime() replacement function for PHP 8.1
<?php
namespace PHP81_BC;
/**
* Locale-formatted strftime using \IntlDateFormatter (PHP 8.1 compatible)
* This provides a cross-platform alternative to strftime() for when it will be removed from PHP.
* Note that output can be slightly different between libc sprintf and this function as it is using ICU.
*
* Usage:
* use function \PHP81_BC\strftime;
@Jiab77
Jiab77 / real-time-php-fpm-status.md
Last active February 29, 2024 12:48
Real-time PHP-FPM Status

Real-time PHP-FPM Status

This gist will explain you how to enable an undocumented feature of PHP-FPM which will give a real-time performance stats.

Everybody knows the famous phpinfo() and the page it generates, right? Then the real-time PHP-FPM status page design is very similar.

image

Some informations from the top are not displayed to avoid security issues.

Enable PHP-FPM Status

@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active April 26, 2024 17:20
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
anonymous
anonymous / DDS238-2 ZN-S Modbus.txt
Created December 11, 2017 00:54
Hiking DDS238-2 ZN/S energy meter: Modbus holding registers
Hiking DDS238-2 ZN/S energy meter: Modbus holding registers
register(s) word order data format meaning unit (symb.)
0000h-0001h hi-lo unsigned? total energy decawatt-hours (daW·h)
0008h-0009h hi-lo unsigned? export energy¹ decawatt-hours (daW·h)
000Ah-000Bh hi-lo unsigned? import energy¹ decawatt-hours (daW·h)
000Ch unsigned? voltage decivolts (dV)
000Dh unsigned? current centiamperes (cA)
000Eh two's compl. active power watts (W)
@ghalusa
ghalusa / youtube_id_regex.php
Created June 20, 2015 23:14
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@ogrrd
ogrrd / Cake Composer.md
Last active May 9, 2020 03:30
Install Cake 2.x with Composer

Install CakePHP 2.x with Composer

Remove the main CakePHP lib directory

$ cd /path/to/your/website
$ rm -Rf ./lib

Add the following composer.json file