Skip to content

Instantly share code, notes, and snippets.

View BenSampo's full-sized avatar

Ben Sampson BenSampo

View GitHub Profile
@ocean90
ocean90 / fbcbfwss.php
Last active September 5, 2024 01:29
WordPress Plugin: Filename-based cache busting for scripts/styles.
<?php
/**
* Plugin Name: Filename-based cache busting
* Version: 0.3
* Description: Filename-based cache busting for WordPress scripts/styles.
* Author: Dominik Schilling
* Author URI: https://dominikschilling.de/
* Plugin URI: https://gist.github.com/ocean90/1966227/
*
* License: GPLv2 or later
@mpijierro
mpijierro / download_csv.php
Last active November 25, 2024 23:52
Example streaming large CSV files with Laravel and thousands of queries
<?php
namespace Src\Csv;
use Illuminate\Http\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
/**
* Class DownloadLargeCsv
*
@BenSampo
BenSampo / deploy.sh
Last active November 13, 2024 14:47
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@sirthxalot
sirthxalot / Countries.php
Last active July 6, 2021 12:09
Country List for Laravel's Enum
<?php namespace App\Enums;
use BenSampo\Enum\Enum;
use BenSampo\Enum\Contracts\LocalizedEnum;
final class Countries extends Enum
{
const AF = "Afghanistan";
const AL = "Albania";
const DZ = "Algeria";
@freekmurze
freekmurze / FuzzyFilter.php
Created February 19, 2020 08:38
FuzzyFilter
<?php
namespace Spatie\Mailcoach\Http\App\Queries\Filters;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Spatie\QueryBuilder\Filters\Filter;
class FuzzyFilter implements Filter
@JeffreyWay
JeffreyWay / recaptcha.blade.php
Last active June 28, 2024 11:00
Recaptcha Example using Laravel, Blade Components, and Alpine
<div
x-data="recaptcha()"
x-init="init"
@recaptcha.window="execute"
></div>
@push('scripts')
<script src="https://www.google.com/recaptcha/api.js?render=explicit"></script>
<script>