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
| { | |
| "Nice output for debugging": { | |
| "prefix": "dbg", | |
| "body": [ | |
| "echo \"<pre>\";", | |
| "print_r($1);", | |
| "echo \"</pre>\";", | |
| "die();" | |
| ], | |
| "description": "Nice output of Array with print_r" |
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 | |
| $color = "red"; | |
| switch ($color) { | |
| case "red": | |
| echo "The color is red."; | |
| break; | |
| case "blue": | |
| echo "The color is blue."; |
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 | |
| $my_array = array('apple', '', null, false, 'banana', 0, 'orange', 'grape'); | |
| // Remove empty values from the array | |
| $my_array = array_filter($my_array); | |
| print_r($my_array); | |
| // Output: Array ( [0] => apple [4] => banana [6] => orange [7] => grape ) |
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 | |
| $users = [ | |
| 'Asd' => '123', | |
| 'Qwe' => '456', | |
| 'Zxc' => '789', | |
| ]; | |
| $users = array_change_key_case($users, CASE_LOWER); |
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 | |
| $users = [ | |
| [ | |
| 'id' => 123, | |
| 'username' => 'admin', | |
| 'name' => 'John Doe', | |
| 'avatar' => 'https://example.com/avatar.jpg', | |
| ], | |
| [ |
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
| chrome.webNavigation.onHistoryStateUpdated.addListener(function (details) { | |
| // Check if the URL matches medium.com and if the page is fully loaded | |
| if (details.url.includes('medium.com/@') && details.frameId === 0) { | |
| // Execute the content script in the new page | |
| console.log('Injecting content script'); | |
| // execute main.js | |
| chrome.scripting.executeScript({ | |
| target: { tabId: details.tabId }, | |
| files: ['main.js'] |
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
| console.log('Hello from main.js!'); | |
| // IIFE | |
| (async () => { | |
| // Wait for the target element to appear in the DOM | |
| await new Promise(resolve => { | |
| const observer = new MutationObserver(() => { | |
| if (document.querySelector('.pw-post-title')) { | |
| resolve(); | |
| observer.disconnect(); |
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
| { | |
| "name": "Mark as Read Medium Posts", | |
| "version": "1.0", | |
| "manifest_version": 3, | |
| "permissions": [ | |
| "webNavigation", | |
| "scripting", | |
| "tabs" | |
| ], | |
| "content_scripts": [ |
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\Http\Controllers; | |
| use Illuminate\Http\Request; | |
| use App\Services\UserService; | |
| use App\Repositories\UserRepository; | |
| class UserController extends Controller | |
| { |
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 UserService | |
| { | |
| private $userRepository; | |
| public function __construct(UserRepository $userRepository) | |
| { | |
| $this->userRepository = $userRepository; | |
| } |