Skip to content

Instantly share code, notes, and snippets.

View niladam's full-sized avatar

Madalin Tache niladam

View GitHub Profile
# GitHub Action that will run prettier on the whole repo and commit the changes to the PR.
name: Prettier
on:
pull_request:
branches: [main]
jobs:
prettier:
runs-on: ubuntu-latest
@radermacher
radermacher / timelapse.sh
Last active July 16, 2024 16:33 — forked from stenuto/timelapse.sh
Timelapse script; Usage: `timelapse.sh -d 1 -i 3` to record display 1 (main display) with an interval of 3 seconds OR use `timelapse.sh` and manually select display. An interval of 3 is default.
#!/bin/bash
# Check if ffmpeg is installed
if ! command -v ffmpeg &> /dev/null; then
echo "Error: ffmpeg is not installed or not in the PATH." >&2
echo "Please install ffmpeg to use this script." >&2
exit 1
fi
interval=3
@Sammyjo20
Sammyjo20 / Pest.php
Created June 10, 2024 11:14
Lazy Man's Saloon Fake
/**
* Lazy Man's Saloon Fake
*
* This will record every request that you make in your application and store it in a folder
* based on the name of the test. This is incredibly powerful, but I wouldn't recommend it
* for every request if you are doing the same things over as it will waste API calls.
*
* @return void
*/
function lazyFakeSaloon(): void
<?php
namespace App\Livewire\Attributes;
use Attribute;
use Livewire\Features\SupportAttributes\Attribute as LivewireAttribute;
use function Livewire\store;
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
@inxilpro
inxilpro / --usage.php
Created February 13, 2024 17:22
Simple wrapper for OpenSpout
<?php
// Reading
CsvReader::read($path)->each(function(array $row) {
// Do something with $row
});
// Writing
return CsvWriter::for($data)->writeToHttpFile();
@sinnbeck
sinnbeck / Browsershot.php
Last active December 21, 2023 23:27
Browsershot for chrome-php
<?php
declare(strict_types=1);
namespace App\Services;
use Exception;
use HeadlessChromium\BrowserFactory;
use HeadlessChromium\Page;
use HeadlessChromium\PageUtils\PagePdf;
@devhammed
devhammed / SpatieLaravelDataSynthesizer.php
Last active February 6, 2024 11:51
This is a Livewire 3 Synthesizer (https://livewire.laravel.com/docs/synthesizers) for classes using spatie/laravel-data package (https://spatie.be/docs/laravel-data/v3/introduction)!
<?php
namespace App\Support\Synthesizers;
use Spatie\LaravelData\Data;
use Livewire\Mechanisms\HandleComponents\Synthesizers\Synth;
class SpatieLaravelDataSynthesizer extends Synth
{
public static string $key = 'spld';
class PathMe {
moves: string[] = [];
constructor() {
this.moves = [];
return this;
}
moveTo(x: number, y: number) {
@nathandaly
nathandaly / BaseResource.php
Last active July 13, 2024 17:03
Tenancy for Laravel & Filament V3 (Tenant per database)
<?php
/**
* Below is an the extended Filament resource your tenant panel resources
* will have to extend so that the queries are scoped properly.
*/
namespace App\Filament;
use Filament\Resources\Resource;
@JustSteveKing
JustSteveKing / State.php
Created August 11, 2023 18:31
US States as a PHP Enum
<?php
declare(strict_types=1);
namespace App\Enums;
enum State: string
{
case ALABAMA = 'AL';
case ALASKA = 'AK';