Skip to content

Instantly share code, notes, and snippets.

Working from home

Sérgio Jardim sjardim

Working from home
View GitHub Profile
View filament_aggregation_example.php
namespace App\Filament\Resources\ItemResource\Pages;
use App\Filament\Resources\ItemResource;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\DB;
class CustomItemsList extends ListRecords
sjardim / update_meilisearch_index_command.php
Created May 31, 2022
Laravel command to update Meilisearch's index and filterable attributes
View update_meilisearch_index_command.php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use MeiliSearch\Client;
use function PHPUnit\Framework\throwException;
class UpdateMeilisearchIndex extends Command
sjardim /
Created Feb 1, 2022 — forked from chrispymm/
[Support nested urls for nested modules] #twill

By default Twill will disply the url of a module item to be {siteurl}/{module}/{slug} e.g. With the 'about' section being the editable slug. This is understandable as Twill knows nothing of your frontend routing. However it is likely confusing for editors, as that url presented will not be the final url of the content.

Remove module name form url

This will give us more correct urls e.g.

// app/Http/Controllers/Admin/PageController

	protected $permalinkBase = '';
sjardim / twill-light-and-dark-mode.css
Last active Jan 7, 2022
Light and Dark mode styles for Twill ( CMS admin
View twill-light-and-dark-mode.css
:root {
--primary-color-hue: 230;
--background-darkest: hsl(var(--primary-color-hue), 70%, 30%);
--background-darker: hsl(var(--primary-color-hue), 20%, 95%);
--background-normal: hsl(var(--primary-color-hue), 70%, 98%);
--background-contrast: hsl(var(--primary-color-hue), 90%, 100%);
--background-highlight: hsl(var(--primary-color-hue), 100%, 98%);
--border-normal: hsl(var(--primary-color-hue), 30%, 90%);
--border-highlight: hsl(var(--primary-color-hue), 100%, 95%);
--body-text-normal: hsl(var(--primary-color-hue), 45%, 55%);

Prefill a block editor from a selection of templates


  • Create a new module with a template field
  • Prefill the block editor for new items according to the selected template


View get_MP3_tags_and_duration.php
//Blog post:
//Tested ID3v2.2 and v2.4 and on UTF-8 and UTF-16LE encondings
// $file = 'audio.mp3';
View ProcessWireValetDriver.php
class ProcessWireValetDriver extends BasicValetDriver
private $possibleDirectories = [
'', // PW in root, do not remove except you're sure you never use it
sjardim / processire-sync-s3-images.module.php
Last active Sep 19, 2022
'Synchronize all the page images uploaded through ProcessWire to a specified bucket in Amazon S3 and other places using Flysystem library.
View processire-sync-s3-images.module.php
<?php namespace ProcessWire;
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local;
class ProcessSync extends WireData implements Module, ConfigurableModule {
public static function getModuleInfo() {
sjardim /
Last active Oct 31, 2019
This Python script will move the files of the current folder into the folder structure according to a defined structure.
import shutil
import os
# This script will move the files of the current folder into the folder structure according to the FoldersMap.
# detect the current working directory
currentFolder = os.getcwd()
filePath = currentFolder
FoldersMap = {
View gist:45cebbed791d4c0085d43af40072d2b1
Sub Export4KPowerpoint()
If ActivePresentation.CreateVideoStatus <> ppMediaTaskStatusInProgress Then
ActivePresentation.CreateVideo FileName:=Environ("USERPROFILE") & "\Desktop\export.mp4", _
UseTimingsAndNarrations:=True, _
VertResolution:=2160, _
FramesPerSecond:=30, _
Else: MsgBox "There is another conversion to video in progress"
End If
End Sub