Skip to content

Instantly share code, notes, and snippets.

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

sathish ssatz

🏠
Working from home
View GitHub Profile
@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();
@aniket-magadum
aniket-magadum / AppServiceProvider.php
Last active April 4, 2024 15:37
RequestHandled Event in Laravel
<?php
namespace App\Providers;
use Event;
use Log;
use Illuminate\Foundation\Http\Events\RequestHandled;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@bizz84
bizz84 / macOS-Podfile
Last active October 5, 2023 01:42
macOS Podfile template for Flutter apps
# Set the platform at the top
platform :osx, '10.15'
# Rest of the pod file
# Update post_install step
post_install do |installer|
# Ensure pods use the minimum deployment target set above
# https://stackoverflow.com/a/64385584/436422
pods_project = installer.pods_project
@JustSteveKing
JustSteveKing / ApiRenderer.php
Last active September 8, 2023 15:03
Handling Errors in Laravel
<?php
declare(strict_types=1);
namespace App\Exceptions\Rendering;
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;
@austenc
austenc / app.js
Last active February 15, 2023 10:21
Alpine JS + Floating UI Tooltip Directive
import Alpine from 'alpinejs'
import tooltip from './tooltip'
Alpine.plugin(tooltip)
Alpine.start()
@murdercode
murdercode / laravel-fastcgi-cache-config.md
Last active July 3, 2024 10:19
Optimizing Laravel (and Nova) with FastCGI Cache Configuration

Laravel + FastCGI Cache = ❤️

⚠️ Need a more specific guide? See https://medium.com/@murdercode/speed-up-your-laravel-application-up-to-1000x-with-fastcgi-cache-0135b11407e5

Using FastCGI cache allows you to speed up your website up to 1000x. In fact, the FastCGI cache (or Varnish) mechanism consists of putting a server-caching mechanism between a client and your web server. The whole page will be cached as an HTML output, and it will be delivered instead of using the PHP/MySQL/Redis stack, etc. for all users, but only for the first visit (and others after some specified time).

WARNING: This is not a take-away how-to. Please read it carefully and use it at your own risk.

This config is based on the ploi.io stack. We will not cover the FastCGI installation process, so please prepare FastCGI and adapt the next config if you need it.

<div class="tailwind" x-data="{ age: 0, name: '', coppa: false }">
<div class="border rounded-lg my-12 max-w-md">
<div class="p-6">
<h1
class="mt-0"
x-show="$wizard.current().title !== ''"
x-text="$wizard.current().title"
></h1>
<div {{ $attributes }} wire:ignore x-data="{
signaturePadId: $id('signature'),
signaturePad: null,
signature: @entangle($attributes->get('wire:model')),
ratio: null,
init() {
this.resizeCanvas();
this.signaturePad = new SignaturePad(this.$refs.canvas);
if (this.signature) {
this.signaturePad.fromDataURL(this.signature, { ratio: this.ratio });
@x7ryan
x7ryan / ExampleUsage.php
Last active July 29, 2023 00:03
A simple Laravel Livewire trait to include rules and messages from a Laravel FormRequest Class. Simply use this trait and define a protected property useFormRequest as a reference to the FormRequest class you wish to use. This can be used to share validation logic between livewire components and traditonal Laravel controllers, for example when u…
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use App\Http\Livewire\Concerns\FormRequest;
class ExampleUsage extends Component
{
use FormRequest;
@gilbitron
gilbitron / CaddyController.php
Created June 16, 2021 10:55
Enabling HTTPS (SSL) for Laravel Sail using Caddy
<?php
# app/Http/Controllers/CaddyController.php
namespace App\Http\Controllers;
use App\Store;
use Illuminate\Http\Request;
class CaddyController extends Controller
{