This file contains hidden or 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
| // method 1 | |
| const mystring = "abcde"; | |
| // Split into 4 sections (since string length is 5, one section will be empty) | |
| function splitIntoFour(str) { | |
| const sectionSize = Math.ceil(str.length / 4); | |
| const sections = []; | |
| for (let i = 0; i < 4; i++) { |
This file contains hidden or 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 BenfordAnalyzer | |
| { | |
| protected array $data; | |
| public function __construct(array $data) | |
| { | |
| $this->data = array_filter($data, function ($value) { | |
| return is_numeric($value) && $value != 0; |
This file contains hidden or 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 Illuminate\Foundation\Application; | |
| require __DIR__ . '/vendor/autoload.php'; | |
| echo "=== Testing Optimized Module System ===\n\n"; | |
| $startTime = microtime(true); |
This file contains hidden or 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 RuntimeException; | |
| use InvalidArgumentException; | |
| /** | |
| * Full-featured GitHub Gist API client (pure PHP, no dependencies) | |
| * Supports: create, update, upload, download, list, delete | |
| * | |
| * @version 2.0 | |
| * @author saeedvir <https://github.com/saeedvir> |
This file contains hidden or 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 CuckooFilter | |
| { | |
| protected int $bucketCount; | |
| protected int $bucketSize; | |
| protected array $buckets; | |
| protected int $maxKick; // برای جلوگیری از حلقه بیپایان | |
| public function __construct(int $bucketCount = 64, int $bucketSize = 4, int $maxKick = 500) |
This file contains hidden or 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 BloomFilter | |
| { | |
| protected int $size; | |
| protected int $hashCount; | |
| protected array $bitArray; | |
| public function __construct(int $size = 1000, int $hashCount = 3) | |
| { |
This file contains hidden or 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\Services; | |
| use Illuminate\Support\Facades\Http; | |
| use Illuminate\Support\Facades\Log; | |
| /** | |
| * By saeedvir: https://github.com/saeedvir | |
This file contains hidden or 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 scripts = [ | |
| 'https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js', // ✅ Valid | |
| 'https://example.com/nonexistent-script.js', // ❌ 404 — THIS WILL BREAK SEQUENCE | |
| 'https://cdn.jsdelivr.net/npm/moment@2.29.4/moment.min.js' // ⛔ Won't load due to previous error | |
| ]; | |
| try { | |
| const loadedScripts = await loadScriptsSequentiallyEnhanced(scripts, { timeout: 5000 }); |
NewerOlder