Skip to content

Instantly share code, notes, and snippets.

View sjardim's full-sized avatar
🏠
Working from home

Sérgio Jardim sjardim

🏠
Working from home
View GitHub Profile
@sjardim
sjardim / Latex-Full-Year-Calendar.tex
Created April 1, 2025 13:09
A full year calendar in A1 paper size, showing US holidays.
% DIN-A1 year calendar
% Author: Robert Krause
% Modified by: Sérgio Jardim (@sjardim)
% License : Creative Commons attribution license
% Submitted to TeXample.net on 13 July 2012
\documentclass[landscape,a1paper,21pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz} % Use the calendar.sty style
@sjardim
sjardim / IndesignColorHeatmapTable.jsx
Created December 11, 2024 15:04
This script creates a "heatmap" table on Indesign. Uses tint values based on the cell's percentage value (from 100% to 0%)
/*
This script creates a "heatmap" table on Indesign:
- Checks for existing swatches named "HeatMapTableColor1", "HeatMapTableColor2", etc.
- Shows an error if no swatches are found with this naming pattern
- Shows an error if there aren't enough swatches for the table's columns
- Applies the colors in order (Color1 to first column, Color2 to second column, etc.)
- Uses tint values based on the cell's percentage value (from 100% to 0%)
- Maintains the text color logic (white text on dark backgrounds)
- If you don't want for the script to add a % after the values, if not present, comment the "// Add percentage sign if not present" block.
@sjardim
sjardim / clean_icml.py
Last active December 6, 2024 14:33
A Python script to clean up the paragraph and characters styles names from the converted Markdown to ICML file (via Pandoc).
# clean_icml.py
import sys
import re
import os
from pathlib import Path
def load_style_mappings():
"""Load style mappings from the configuration file"""
try:
# Get the directory of the current script
@sjardim
sjardim / UserResource.php
Last active March 20, 2024 07:25
Filament model with dependant selects
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\UsersResource\Pages;
use App\Filament\Resources\UsersResource\RelationManagers;
use App\Models\Company;
use App\Models\Folder;
use App\Models\User;
use App\Models\Users;
@sjardim
sjardim / simulated-typing.html
Created June 27, 2023 18:33 — forked from fontanon/simulated-typing.html
Simulate typing on HTML Input Box with Javascript
<html>
<head>
<title>Simulated typing</title>
</head>
<body>
<input type="text" id="transcribe-searchbox" placeholder="Escribe Aquí">
<input type="button" id="transcribe-button" value="Transcibir a Andaluz">
</body>
<script>
// Quotes to simulate typing, then deletion
@sjardim
sjardim / Money.php
Last active August 3, 2024 03:30
Creating a Money custom field for Laravel Filament
<?php
declare(strict_types=1);
namespace App\Forms\Components;
use Filament\Forms\Components\Concerns\HasAffixes;
use Filament\Forms\Components\Field;
class Money extends Field
@sjardim
sjardim / filament_table_aggregates.php
Created April 19, 2023 20:17
Adds a sum, avg, count column to a Laravel Filament table
//Adapted from https://filamentphp.com/tricks/aggregate-data-in-table-footer
// On your Resource list page
protected function getTableContentFooter(): View
{
return view('tables.footer', [
'calc_columns' => [
[
'column' => 'monthly_fee_in_cents',
'operation' => 'sum',
@sjardim
sjardim / NavigationComposer.php
Last active March 14, 2023 15:34
A flexible front end navigation build using the Filament admin for Laravel
<?php
namespace App\View\Composers;
use Illuminate\View\View;
use RyanChandler\FilamentNavigation\Facades\FilamentNavigation;
class NavigationComposer
{
# Salvar num arquivo ~/encode.sh, conceder direito de execução e
# executar desta forma (adaptar nomes de diretórios e arquivos para seu caso):
# $ ~/encode.sh ~/Video/bigFile.mp4 ~/Video/smallFile.mp4
ffmpeg -i "$1" -vcodec h264 -acodec aac "$2"
@sjardim
sjardim / index.php
Created February 8, 2023 12:53
Laravel Meilisearch search with relationships
<?php
//https://serversideup.net/advanced-meilisearch-queries-with-laravel-scout/
$customers = Customer::search('Dan')
->query( function( $query ){
$query->with('invoices');
} )->get();