Skip to content

Instantly share code, notes, and snippets.

View niladam's full-sized avatar

Madalin Tache niladam

View GitHub Profile
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'blank_line_after_namespace' => true,
@marcoarment
marcoarment / S3.php
Last active July 8, 2025 17:39
A simple PHP class to perform basic operations against Amazon S3 and compatible services.
<?php
/*
A simple PHP class to perform basic operations against Amazon S3 and compatible
services. Requires modern PHP (7+, probably) with curl, dom, and iconv modules.
Copyright 2022 Marco Arment. Released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@marcorieser
marcorieser / Setup PhpStorm to use Prettier and Laravel Pint (Antlers, Blade, PHP, Tailwind, Statamic).md
Last active October 16, 2025 13:18
Setup PhpStorm to use Prettier and Laravel Pint (Antlers, Blade, PHP, Tailwind, Statamic)

Install dependencies

Run npm install -D prettier prettier-plugin-antlers prettier-plugin-blade prettier-plugin-tailwindcss in your terminal

Prettier

Configure prettier

Create a .prettierrc file with the following content

{
    "singleQuote": true,
    "printWidth": 140,
@kaystrobach
kaystrobach / CreateBarCode.php
Last active May 20, 2022 07:01
Convert UUIDs into BigInt with ramsey/uuid
<?php
// needs picqer/php-barcode-generator
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
$barcode = $generator->getBarcode($data, $generator::TYPE_CODE_128, 3, 100, [0,0,0]);
// ensure the char count is even for CODE_128_C
$barcodeData = (strlen($data) % 2) === 0 ? $data : '0' . $data;
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open('app').then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
@stevebauman
stevebauman / AuthServiceProvider.php
Last active November 11, 2021 21:44
A Laravel Sanctum "token" User provider
<?php
Auth::provider('sanctum:token', function ($app, $config) {
return new SanctumTokenUserProvider($app['hash'], $config['model']);
});
@mithicher
mithicher / meilisearch-autocomplete.blade.php
Created September 27, 2021 07:06
MeiliSearch Laravel Blade Component
@props([
'id' => 'autocomplete-'. uniqid(),
'placeholder' => 'Search...',
'indexName' => '',
'publicKey' => '',
'host' => 'http://127.0.0.1:7700',
])
<div
x-data="{
@edgrosvenor
edgrosvenor / SignedOrLoggedIn.php
Last active July 22, 2021 07:02
A quick and easy way to let authenticated users share the current page using a temporary signed url.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class SignedOrLoggedIn
{
/**
<script data-turbo-eval="false">
document.addEventListener('turbo:before-render', () => {
let permanents = document.querySelectorAll('[data-turbo-permanent]')
let undos = Array.from(permanents).map(el => {
el._x_ignore = true
return () => {
delete el._x_ignore
}
@therealparmesh
therealparmesh / google-photos-takeout-metadata-fix.sh
Last active December 3, 2025 22:31
Google Photos Takeout Metadata Fix
exiftool -r -d %s -tagsfromfile "%d/%F.json" "-GPSAltitude<GeoDataAltitude" "-GPSLatitude<GeoDataLatitude" "-GPSLatitudeRef<GeoDataLatitude" "-GPSLongitude<GeoDataLongitude" "-GPSLongitudeRef<GeoDataLongitude" "-Keywords<Tags" "-Subject<Tags" "-Caption-Abstract<Description" "-ImageDescription<Description" "-DateTimeOriginal<PhotoTakenTimeTimestamp" "-FileCreateDate<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress --ext json .