Skip to content

Instantly share code, notes, and snippets.

View nei's full-sized avatar

Nei Santos nei

View GitHub Profile
@nei
nei / Resend.php
Last active October 3, 2023 15:53
Example of reactphp usage to read lines of a file and raise X concurrent requests to an endpoint to check each line.
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Clue\React\Mq\Queue;
use Psr\Http\Message\ResponseInterface;
use React\Stream\ReadableResourceStream;
$loop = React\EventLoop\Loop::get();
$browser = new React\Http\Browser($loop);
@nei
nei / validate-uk-mobile-number.php
Last active November 6, 2019 05:06
Check if number is a valid UK mobile number.
<?php
/**
* Function to validate if the phone number is Uk Mobile number
* Optinal first part: '+44' or '44', also a
* Optinal second part: '0'
* Mandatory: 7 followed by [1-9] excluding 0,2 followed by 8 digits
* Reference: https://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom
*
* @param $number
* @return bool
@nei
nei / src-external-case-sensitive
Last active July 16, 2019 16:04
These are how I setup my src folder as case-sensitive on an external drive due to my shitty 128Gb macbook.
## Steps used to setup the ~/src
1. Create a virtual disk on my external hard drive
Install the script https://gist.github.com/scottsb/479bebe8b4b86bf17e2d
mkdir /Volumes/SAMSUNG/disks/
1.1. Review config