Skip to content

Instantly share code, notes, and snippets.

View dihjital's full-sized avatar

Peter Hrobar dihjital

  • votes365.org
  • Budapest
  • 06:55 (UTC +02:00)
View GitHub Profile
@dihjital
dihjital / LoopEliminator.php
Created June 9, 2023 16:18
Loop elimination in a weighted, directed graph
<?php
namespace App\Graph;
use Ds\{Set, Stack};
class LoopEliminatior {
const INFINITE = 1000000000;
@dihjital
dihjital / SmsClient_parallel.php
Last active May 26, 2023 08:41
SmsClient with parallel multi channel processing
<?php
require_once "vendor/autoload.php";
use App\Helper\Helpers;
use parallel\{Runtime, Channel};
Class SmsClient {
protected $taskChannel;
@dihjital
dihjital / SmsClient.php
Last active May 27, 2023 11:33
Simple example of Worker Pool model with PHP pthreads
<?php
class DirectoryNotFoundException extends Exception {
public function __construct($directory) {
$message = "Directory not found: " . $directory;
parent::__construct($message);
}
}
class Helpers {