Skip to content

Instantly share code, notes, and snippets.

View Oleksandr-Moik's full-sized avatar

Oleksandr Moik Oleksandr-Moik

View GitHub Profile
@Oleksandr-Moik
Oleksandr-Moik / UnitTest.php
Created May 19, 2024 21:53
Extract the YouTube Video ID from a URL in PHP (Larave, test suite on Pest)
<?php
it('extracts video ID from YouTube URLs', function ($url, $expectedId) {
expect(get_youtube_video_id($url))->toBe($expectedId);
})->with([
['https://youtu.be/dQw4w9WgXcQ', 'dQw4w9WgXcQ'],
['https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'dQw4w9WgXcQ'],
['http://youtube.com/v/dQw4w9WgXcQ', 'dQw4w9WgXcQ'],
['https://www.youtube.com/embed/dQw4w9WgXcQ', 'dQw4w9WgXcQ'],
['https://www.youtube.com/shorts/dQw4w9WgXcQ', 'dQw4w9WgXcQ'],
@tuanpht
tuanpht / php-artisan-bash-completion.md
Last active June 7, 2023 07:42 — forked from jhoff/README.md
Bash-only Laravel Artisan tab auto-complete

If you are an Oh-my-zsh user, see the Laravel 5 plugin

For the rest of us Bash users, all of the Laravel Artisan autocomplete solutions out there require installing a composer package to get a list of artisan commands. Turns out this isn't really necessary. Simply add the provided code in ~/.bash_profile ( or similarly sourced file ) and you'll get artisan command tab completes on any project on your system.

_artisan()
{
    local arg="${COMP_LINE#php }"

    case "$arg" in
@ankurk91
ankurk91 / xdebug-mac.md
Last active March 9, 2024 22:20
php xDebug v3 on Ubuntu/Mac and phpStorm

🪲 Install and Configure xDebug v3 on MacOS for PhpStorm 🐘

  • Assuming that you have already installed php and apache via Homebrew

  • Install xDebug php extension

pecl channel-update pecl.php.net
pecl clear-cache

pecl install xdebug
@RichardBronosky
RichardBronosky / multiple_ssh_setting.md
Last active June 5, 2024 19:16 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"