Skip to content

Instantly share code, notes, and snippets.

View ziadoz's full-sized avatar

Jamie York ziadoz

View GitHub Profile
@ziadoz
ziadoz / Laravel-Container.md
Last active June 19, 2025 09:47 — forked from zhilinskiy/Laravel-Container.md
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@ziadoz
ziadoz / console.php
Last active June 5, 2025 09:13
Laravel 12.x - Lazy Ghost Contextual Attribute
<?php
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Container\ContextualAttribute;
use Illuminate\Support\Facades\Artisan;
#[Attribute(Attribute::TARGET_PARAMETER)]
class LazyGhost implements ContextualAttribute
{
/**
@ziadoz
ziadoz / youtube_rss.txt
Last active May 29, 2025 21:55
YouTube RSS URLs
Channel: https://www.youtube.com/feeds/videos.xml?channel_id=<channel-id>
Playlist: https://www.youtube.com/feeds/videos.xml?playlist_id=<playlist-id>
User: https://www.youtube.com/feeds/videos.xml?user=<user_id>
Link: https://news.ycombinator.com/item?id=32192352
@ziadoz
ziadoz / ParallelTestingServiceProvider.php
Created May 23, 2025 15:28
Laravel 12 - Custom Connection for Parallel Testing
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Testing\Concerns\TestDatabases;
use Illuminate\Testing\ParallelTestingServiceProvider as LaravelParallelTestingServiceProvider;
// Laravel doesn't support changing the database connection when running tests in parallel, so we have to override the relevant method.
@ziadoz
ziadoz / install.sh
Last active May 21, 2025 19:32
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@ziadoz
ziadoz / firefox.sh
Created May 20, 2025 13:55
Isolate Firefox Profile
#!/usr/bin/env bash
PROFILEDIR="$(mktemp -d)"
firefox --no-remote --profile "$PROFILEDIR" --screenshot $PWD/output.png https://xkcd.com
rm -r "$PROFILEDIR"
@ziadoz
ziadoz / awesome-php.md
Last active May 8, 2025 07:37
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@ziadoz
ziadoz / macos-ms-teams-audio-driver-issues.txt
Last active May 2, 2025 11:16
macOS Microsoft Teams Audio Driver Issues
In the middle of a Zoom call my audio in/out devices changed to “Microsoft Teams Audio Devices”, despite no longer having Microsoft Teams installed.
It turns out Teams leaves its audio driver on your system running, and it occasionally decides to make itself the default.
I had to delete: /Library/Audio/Plug-Ins/HAL/MSTeamsAudioDevice.driver in the end to fix it:
sudo rm -rf /Library/Audio/Plug-Ins/HAL/MSTeamsAudioDevice.driver
https://forums.macrumors.com/threads/how-to-uninstall-core-audio-driver-msteamsaudiodevice-driver.2344450/
@ziadoz
ziadoz / composer_path.json
Last active April 25, 2025 09:46
Composer Using Local Repositories and Branches
{
"repositories": [
{
"type": "path",
"url": "../relative/project/path"
}
],
"require": {
"${project}": "dev-${branch}"
}
@ziadoz
ziadoz / js-return.js
Created April 1, 2025 14:03
JS Function Return
// @see: https://github.com/hassanshaikley/pico-pubsub
foo = () => ('foo', 'bar');
console.log(foo()); // Returns 'bar'