Skip to content

Instantly share code, notes, and snippets.

View drissboumlik's full-sized avatar
🎯
Trying to focus

Driss B drissboumlik

🎯
Trying to focus
View GitHub Profile
@drissboumlik
drissboumlik / config\news-sources.php
Last active September 12, 2025 15:58
This is not the actual code, but very similar use case where we refactored legacy code to use design patterns
<?php
return [
'newsapi' => [
'class' => \Domain\NewsApis\Services\Sources\NewsApiService::class,
'config' => [
'url' => 'https://newsapi.org/v2/top-headlines',
'source' => 'NewsAPI',
'apikey' => env('NEWSAPI_KEY'),
],
@drissboumlik
drissboumlik / Export.php
Last active March 6, 2025 13:17
This a legacy code that we refactored to use design patterns (Builder)
<?php
// Export service
namespace App\Support;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Facades\Excel;
@drissboumlik
drissboumlik / user_aliases.cmd
Created September 12, 2024 23:08
Aliases i use within cmder
rem =========================================== CUSTOM ALIASES ===========================================
-cd=cd - $*
lsa=ls -a --show-control-chars -F --color $*
lsall=ls -latsh $*
e=explorer $*
rmrf=rm -rf $*
a:r=alias /reload
w:env=%windir%\System32\SystemPropertiesAdvanced.exe
env:r=RefreshEnv.cmd
@drissboumlik
drissboumlik / Toggle-XdebugInPhpIni.ps1
Last active September 12, 2024 16:11
This PowerShell script toggles the activation of the [xdebug] section in a php.ini file, based on a provided environment variable or path and an optional activation flag.
# Set-ExecutionPolicy Bypass -Scope Process -Force
# Parameters:
param( [string]$envVariableName, $user_activate = $null )
# Function to resolve input as a direct path or an environment variable
function Resolve-PathOrEnv {
param ( [string]$envVarOrFullPath )
if ($envVarOrFullPath -and (Test-Path -Path $envVarOrFullPath)) {
@drissboumlik
drissboumlik / Edit_System_Environment_Variable.ps1
Last active September 12, 2024 20:04
This PowerShell script sets or updates a system-level environment variable, automatically elevating to administrator privileges if necessary.
# Parameters:
param( [string]$variableName, [string]$variableValue )
# Check if running as administrator
If (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
# Relaunch as administrator with hidden window
$arguments = "-ExecutionPolicy Bypass -File `"$PSCommandPath`" -variableName `"$variableName`" -variableValue `"$variableValue`""
Start-Process powershell -ArgumentList $arguments -Verb RunAs -WindowStyle Hidden
exit
@drissboumlik
drissboumlik / PowerShell Customization.md
Created July 4, 2020 10:19 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.