Skip to content

Instantly share code, notes, and snippets.

View JordanRL's full-sized avatar

Jordan LeDoux JordanRL

View GitHub Profile
@JordanRL
JordanRL / refcount.php
Created August 17, 2021 16:40
Refcount Issue
<?php
class A {
public int $value;
public function __add(int $other, bool $left): A
{
$return = new A();
$return->value = $this->value + $other;
@JordanRL
JordanRL / polynomial.php
Created August 11, 2021 09:19
Polynomial
<?php
namespace Samsara\Fermat\Values\Algebra;
use Samsara\Exceptions\SystemError\PlatformError\MissingPackage;
use Samsara\Exceptions\UsageError\IntegrityConstraint;
use Samsara\Fermat\Numbers;
use Samsara\Fermat\Types\Base\Interfaces\Numbers\DecimalInterface;
use Samsara\Fermat\Types\Base\Interfaces\Evaluateables\FunctionInterface;
use Samsara\Fermat\Types\Base\Interfaces\Numbers\NumberInterface;
@JordanRL
JordanRL / translate_parts.php
Last active August 11, 2021 09:15
Translate to parts
<?php
protected function translateToParts($left, $right, $identity = 0): array
{
switch (gettype($right)) {
case 'integer':
case 'double':
$right = Numbers::make(Numbers::IMMUTABLE, $right);
break;
@JordanRL
JordanRL / complex_mul.php
Last active August 11, 2021 09:17
Complex number multiply
<?php
public function multiply($num)
{
[
$thatRealPart,
$thatImaginaryPart,
$thisRealPart,
$thisImaginaryPart,