Skip to content

Instantly share code, notes, and snippets.

View CharlieEtienne's full-sized avatar
🖖
Hi GitHub!

Charlie Etienne CharlieEtienne

🖖
Hi GitHub!
View GitHub Profile
php artisan tinker --execute '
$composer = json_decode(file_get_contents(base_path("composer.json")), true);
$deps = $composer["require"] ?? [];
$allPackages = collect($deps)->keys();
// Filter packages to only those that require filament/filament
$filamentPlugins = $allPackages->filter(function ($package) {
// Skip filament/filament itself
if ($package === "filament/filament") {
return true;
#!/bin/bash
# Temporary Artisan command runner
TMP_FILE="app/Console/Commands/__TempCheckFilamentCompat.php"
# Check if it's already installed
if [ ! -f artisan ]; then
echo "❌ This is not a Laravel project (no artisan file found)."
exit 1
fi
@CharlieEtienne
CharlieEtienne / CheckFilamentCompat.php
Last active June 22, 2025 03:48
Check if your Filament Plugins are ready for v4
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
class CheckFilamentCompat extends Command
{
/**
@CharlieEtienne
CharlieEtienne / functions.php
Created December 12, 2021 21:23
Whitelist IPs in Elementor Maintenance Mode
<?php
function my_elementor_maintenance_mode_whitelist_ips() {
// IPs Whitelist
$whitelist = [
'127.0.0.1',
'88.123.181.218',
];
@CharlieEtienne
CharlieEtienne / functions.php
Last active June 28, 2024 09:46
Add custom links to each image in Elementor Carousel
<?php
add_filter( 'attachment_fields_to_edit', function( $form_fields, $post ) {
$form_fields[ 'elementor_carousel_custom_link' ] = array(
'label' => __( 'Custom link', 'elementor' ),
'input' => 'text',
'value' => get_post_meta( $post->ID, 'elementor_carousel_custom_link', true ),
'helps' => __( 'This will add a link to images in Elementor Carousel', 'elementor' ),
);
@CharlieEtienne
CharlieEtienne / splitter.php
Created August 27, 2020 00:02
Split multi SCORM
<?php
define('BASEDIR', "splitted/");
$unite = 0;
foreach( glob("MODULE*/*/imsmanifest.xml") as $file ) {
$chapitre = 0;
$parent_dir = dirname($file);
$dest_parent_dir = BASEDIR . $parent_dir;
$xmlstr = file_get_contents($file);
@CharlieEtienne
CharlieEtienne / profile.ps1
Last active January 22, 2023 09:49
PowerShell Welcome Message
$curUser = (Get-ChildItem Env:\USERNAME).Value
$curComp = (Get-ChildItem Env:\COMPUTERNAME).Value
$pvmaj = $Host.Version.Major
$pvmin = $Host.Version.Minor
$psversion = "$pvmaj.$pvmin"
$identity = "$curUser@$curComp"
#-----------------------------------------------------
# WINDOW TITLE
@CharlieEtienne
CharlieEtienne / paginate-eloquent-collections.php
Created May 13, 2019 07:45
This allows you to call ->paginate() on an Eloquent Collection
<?php
use Illuminate\Database\Eloquent\Collection;
// Register in 'boot()' method in app/Providers/AppServiceProvider.php
// This allows you to call ->paginate() on an Eloquent Collection
Collection::macro('paginate', function ($perPage = 10, $current_page = null, $options = []) {
$current_page = $current_page ?: (Paginator::resolveCurrentPage() ?: 1);
return (new LengthAwarePaginator($this->forPage($current_page, $perPage)->values()->all(), $this->count(), $perPage, $current_page, $options))->withPath('');
});
@CharlieEtienne
CharlieEtienne / dev_deploy
Created May 9, 2019 07:49
Dev/Staging deploy script
#!/bin/bash
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# Replace "username" by your username
ME="username"
@CharlieEtienne
CharlieEtienne / prod_deploy
Created May 8, 2019 20:18
Production deploy script
#!/bin/bash
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# Replace "username" by your username
ME="username"