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 | |
| $array = range(1, 1000000); | |
| $start = microtime(true); | |
| $count = count($array); | |
| for ($i = 0; $i < $count; $i++) { | |
| $array[$i] = $i + 1; | |
| } | |
| echo "Method 2: ".((microtime(true)-$start)); |
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 | |
| $array = range(1, 1000000); | |
| $start = microtime(true); | |
| // do while | |
| $count = count($array); | |
| $i = 0; | |
| do { |
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 PSession | |
| { | |
| /** | |
| * @var array | |
| */ | |
| private array $options = []; | |
| /** | |
| * @var array|string[] |
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 Atakde\RateLimiter; | |
| use Atakde\RateLimiter\Storage\StorageInterface; | |
| /** | |
| * Class RateLimiter | |
| * Token Bucket Algorithm | |
| * @package Atakde\RateLimiter |
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
| // check first letter capital and end with a dot | |
| const checkWord = (word) => { | |
| if (word[0] === word[0].toUpperCase() && word[word.length - 1] === ".") { | |
| return true; | |
| } | |
| return false; | |
| }; | |
| console.log(checkWord("Hello.")); // 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
| const isFirtstLetterCapital = word => word[0] === word[0].toUpperCase(); | |
| const isEndWithDot = word => word[word.length - 1] === "."; | |
| const checkWord = word => isFirtstLetterCapital(word) && isEndWithDot(word); | |
| console.log(checkWord("Hello.")); // 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 | |
| interface Shape | |
| { | |
| public function draw(); | |
| } | |
| class Rectangle implements Shape | |
| { | |
| public function draw() |
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
| try { | |
| (async () => { | |
| function sleep(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| let found; | |
| while (found = document.querySelectorAll('[data-testid="caret"]').length) { | |
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
| import os | |
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| import replicate | |
| app = FastAPI() | |
| os.environ.get("REPLICATE_API_TOKEN") | |
| class Item(BaseModel): | |
| image: str |
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
| { | |
| "builds": [ | |
| { | |
| "src": "main.py", | |
| "use": "@vercel/python" | |
| } | |
| ], | |
| "routes": [ | |
| { | |
| "src": "/(.*)", |