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\Domain\Entities\LootList; | |
use App\Domain\Entities\LootList\Models\LootList; | |
use Illuminate\Database\Eloquent\Model; | |
use ItemSchema\Parser\DataTransferObjects\LootListParseResultDto; | |
class LootListToItemSyncService | |
{ |
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 | |
/** | |
* Shorten large numbers into abbreviations (i.e. 1,500 = 1.5k) | |
* | |
* @param int $number Number to shorten | |
* @return String A number with a symbol | |
*/ | |
function numberAbbreviation($number) { | |
$abbrevs = [1000000000000 => 'T', 1000000000 => 'B', 1000000 => 'M', 1000 => 'K', 1 => '']; |
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
const CHANCE = 3; | |
function rollDoor() { | |
return Math.floor(Math.random() * CHANCE); | |
} | |
function randArr(arr) { | |
return arr[Math.floor(Math.random() * arr.length)]; | |
} |
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 | |
/** | |
* Counts all rectangles inside matrix by loop. | |
* | |
* For 3x3: | |
* *_*_* // 1x1 = 4 | |
* *_*_* // 1x2 = 2 | |
* * * * // 2x1 = 2 | |
* // 2x2 = 1 |
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 | |
/** | |
* Counts squares in matrix by loop. | |
* | |
* @param int $n | |
* @param int $m | |
* @return int | |
*/ | |
function countSquares(int $m, int $n): int |