Skip to content

Instantly share code, notes, and snippets.

@leastbad
leastbad / README.md
Created April 16, 2020 08:08
Choices.js Stimulus wrapper preview

Choices.js Stimulus wrapper

https://joshuajohnson.co.uk/Choices/

Soon, this will be published as an NPM package, but there's an absence of documentation right now. It supports almost all functions from the original library; soon it will support 100% of them.

This wrapper adds Ajax pre-fetch search. Happens if controller has a data-search-path attribute.

Stimulus controller targets use new v2 syntax. Controller attaches a reference to itself on the element so that you can access the internal state from external scripts.

@jrevillini
jrevillini / lazy-elementor-background-images.php
Last active June 22, 2022 16:31
lazyload elementor background images
<?php
// NEWS!!! NEWS!!! **** FEBRUARY 2020 //
// I rolled this code into a plugin!
// Download plugin Lazy Load Background Images for Elementor. Link is in comments below.
// Or go to https://james.revillini.com/projects/
// if you don't want another plugin, the code below works (last time I checked)
@rodrigopedra
rodrigopedra / MigrateTenant.php
Last active April 29, 2020 21:58
Laravel Tenant Migration commands
<?php
namespace App\Console\Commands;
use App\Models\Tenants\Tenant;
use Illuminate\Support\Facades\DB;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Database\Console\Migrations\MigrateCommand;
class MigrateTenant extends MigrateCommand
@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";
@nerzhulart
nerzhulart / Windows Defender Exclusions for Developer.ps1
Last active June 13, 2024 17:57 — forked from dknoodle/Windows Defender Exclusions VS 2017.ps1
Adds Windows Defender exclusions for developers (Visual Studio, JetBrains Rider, IntellIJ Idea, Git, MsBuild, dotnet, mono etc.)
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio') > $null
$pathExclusions.Add('C:\ProgramData\Microsoft\VisualStudio\Packages') > $null
$pathExclusions.Add('C:\Program Files (x86)\MSBuild') > $null
$pathExclusions.Add('C:\Program Files (x86)\Microsoft Visual Studio 14.0') > $null
@paulund
paulund / css-purge-webpack-config.js
Last active April 7, 2023 10:02
Using CSS Purge With Laravel Mix. Tutorial on how to use the following can be found https://paulund.co.uk/reduce-css-file-size-with-css-purge reduced a production ready CSS file from 179kb to 7.9kb.
mix.webpackConfig({
plugins: [
new purgeCss({
paths: glob.sync([
path.join(__dirname, 'resources/views/**/*.blade.php'),
path.join(__dirname, 'resources/assets/js/**/*.vue')
]),
extractors: [
{
extractor: class {
@zubaer-ahammed
zubaer-ahammed / RunScheduler.php
Last active December 21, 2020 09:23 — forked from robbydooo/RunScheduler.php
Heroku Laravel Scheduler - Overcoming Heroku Scheduler's 10 minute minimum interval limit
<?php
/**
* This Scheduler will run once every minute unlike the Heroku scheduler which only runs every 10 mintues.
* To use this scheduler with Laravel 5.4+ add this file to /app/Console/Commands/RunScheduler.php
* Register this file in app/Console/Kernel.php
* protected $commands = [
* ...
@james2doyle
james2doyle / test-was-called.php
Last active February 21, 2022 21:52
Testing that an event listener was called in Laravel without additional frameworks
<?php
// overall test answer
$was_called = false;
$this->app->resolving(function ($object, $app) use (&$was_called) {
if ($object instanceof MyEventListener) {
// the object was resolved at one point
$was_called = true;
}
@zulhfreelancer
zulhfreelancer / upgrade.md
Last active February 17, 2023 00:42
How to upgrade Heroku Postgres database plan?
  1. Assuming you have multiple Heroku apps and Git remote like so:
development https://git.heroku.com/xxx.git (fetch)
development https://git.heroku.com/xxx.git (push)
origin      git@bitbucket.org:xxx/xxx.git  (fetch)
origin      git@bitbucket.org:xxx/xxx.git  (push)
production  https://git.heroku.com/xxx.git (fetch)
production  https://git.heroku.com/xxx.git (push)
staging https://git.heroku.com/xxx.git (fetch)
@robbydooo
robbydooo / RunScheduler.php
Last active October 23, 2021 14:14
Heroku Laravel Scheduler
<?php
/**
This Scheduler will run once every minute unlike the Heroku scheduler which only runs every 10 mintues.
To use this scheduler with Laravel 5.4+ add this file to /app/Console/Commands/RunScheduler.php
Register this file in app/Console/Kernel.php