Skip to content

Instantly share code, notes, and snippets.

View BenSampo's full-sized avatar

Ben Sampson BenSampo

View GitHub Profile
@JeffreyWay
JeffreyWay / recaptcha.blade.php
Last active August 1, 2023 15:52
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>
@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
@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";
@BenSampo
BenSampo / deploy.sh
Last active April 30, 2024 03:41
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
@mpijierro
mpijierro / download_csv.php
Last active January 15, 2024 10:46
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
*
@ocean90
ocean90 / fbcbfwss.php
Last active February 11, 2023 22:03
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