This file contains 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 script is using Laravel Dusk to take screenshots of a URL, but not in the context of a regular Dusk test. | |
* My Laravel application is taking screenshots of *other* sites, but you could adapt this to a Dusk test taking screenshots of your Laravel site. | |
* 1. Install Dusk https://laravel.com/docs/5.8/dusk#installation | |
* 2. Make sure it works with regular Dusk tests first. | |
* 3. Use the code below for a stand-alone Chrome webdriver instance to do automation things. | |
*/ | |
This file contains 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 | |
// Create the stream context | |
$context = stream_context_create(array( | |
'http' => array( | |
'timeout' => 3 // Timeout in seconds | |
) | |
)); | |
// Fetch the URL's contents |
This file contains 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
# Base image with PHP and FrankenPHP | |
FROM dunglas/frankenphp:1-php8.3 AS frankenphp | |
RUN apt-get update && apt-get install -y zip libzip-dev libpq-dev libicu-dev wget acl curl | |
RUN docker-php-ext-install sockets zip | |
RUN docker-php-ext-configure zip | |
RUN docker-php-ext-install pgsql pdo_pgsql intl | |
ENV SERVER_NAME my_app |
This file contains 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 | |
//Replacing multiple spaces with a single space simple single line of php code: | |
$output = preg_replace('/\s+/', ' ', $input); | |
//This mean that spaces, tabs or line breaks (one or more) will be replaced by a single space. | |
//Replace multiple spaces with one space: | |
$output = preg_replace('/\s+/', ' ', $input); | |
//Replace one or multiple tabs with one space: | |
$output = preg_replace('/\t+/', ' ', $input); |
This file contains 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 | |
// Test cards | |
$cards = array( | |
'378282246310005', // American Express | |
'371449635398431', // American Express | |
'5078601870000127985', // Aura | |
'5078601800003247449', // Aura | |
'30569309025904', // Diners Club | |
'38520000023237', // Diners Club |
This file contains 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 | |
class NumerologyCalc { | |
const BASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
const VALID_FINAL_NUMBERS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44]; | |
public $numerology = null; | |
function __construct($input = "", $show = false) { |
This file contains 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 | |
namespace App\Console\Commands\Horizon; | |
use Illuminate\Console\Command; | |
use Illuminate\Queue\Failed\FailedJobProviderInterface; | |
use Laravel\Horizon\Contracts\JobRepository; | |
use Laravel\Horizon\Jobs\RetryFailedJob; | |
class RetryAllFailedJobsCommand extends Command |
This file contains 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 | |
use \parallel\{Runtime, Future, Channel, Events}; | |
/* usage php crawler.php [http://example.com] [workers=8] [limit=500] */ | |
$page = $argv[1] ?: "https://blog.krakjoe.ninja"; # start crawling this page | |
$workers = $argv[2] ?: 8; # start this number of threads | |
$limit = $argv[3] ?: 500; # stop at this number of unique pages | |
$timeout = $argv[4] ?: 3; # socket timeout for producers |
This file contains 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 | |
use \parallel\{Runtime, Channel}; | |
class ExecutorService { | |
public function __construct(int $workers, string $channel = __CLASS__, int $backlog = Channel::Infinite) { | |
if ($backlog == 0) { | |
/* | |
* execute() will block until a worker is ready | |
*/ |
This file contains 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 | |
try{ | |
$url = "https://api.listclean.xyz/v1/"; | |
$endpoint = 'verify/email/'; | |
$api_key = YOUR_API_KEY; | |
NewerOlder