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 | |
$finder = (new Symfony\Component\Finder\Finder) | |
->in([ | |
__DIR__.'/src', | |
__DIR__.'/tests', | |
]) | |
->name('*.php') | |
->ignoreVCS(true) | |
->ignoreDotFiles(true); |
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 | |
/** | |
* @return array An array of two elements containing roots in any order | |
* @link https://www.testdome.com/questions/php/quadratic-equation/38497 | |
*/ | |
function findRoots($a, $b, $c) | |
{ | |
return [ | |
(-$b + sqrt(pow($b, 2) - ((4 * $a) * $c))) / (2 * $a), | |
(-$b - sqrt(pow($b, 2) - ((4 * $a) * $c))) / (2 * $a), |
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 | |
function make_pipeline(...$funcs) | |
{ | |
return function($arg) use ($funcs) | |
{ | |
foreach ($funcs as $func) { | |
$arg = $func($arg); | |
} | |
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 Thesaurus | |
{ | |
private $thesaurus; | |
function __construct(array $thesaurus) | |
{ | |
$this->thesaurus = $thesaurus; | |
} |
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 LeagueTable | |
{ | |
public function __construct(array $players) | |
{ | |
$this->standings = []; | |
foreach($players as $index => $p) { | |
$this->standings[$p] = [ | |
'index' => $index, |
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
using System; | |
using System.IO; | |
using System.Web; | |
using System.Web.Helpers; | |
namespace Helpers | |
{ | |
/// <summary> | |
/// Helper class for parsing the Laravel Mix manifest. | |
/// </summary> |
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\System; | |
use Spatie\ArrayToXml\ArrayToXml; | |
trait GeneratesXml | |
{ | |
/** | |
* The XML template. |
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\System; | |
use Spatie\ArrayToXml\ArrayToXml; | |
trait GeneratesXml | |
{ | |
/** | |
* The XML template. |
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; | |
use Illuminate\Database\Eloquent\Builder; | |
trait IsSelfReferencing | |
{ | |
/** | |
* The self referencing key on the database table. |
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 | |
Route::get('/queue', function () { | |
echo "Starting Queue...<br/>"; | |
ob_flush(); | |
flush(); | |
Queue::before(function (JobProcessing $event) { | |
$message = "Processing {$event->job->resolveName()}..."; | |
info($message); |