Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Mortier ryanmortier

View GitHub Profile
@Zhendryk
Zhendryk / The Ultimate Windows Development Environment.md
Last active Sep 8, 2022
How to set up the ultimate Windows development environment
View The Ultimate Windows Development Environment.md
@ShahinSorkh
ShahinSorkh / .php_cs
Last active Sep 17, 2020
php-cs-fixer config to follow laravel style guides
View .php_cs
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->name('*.php')
->notName('_ide_helper.php')
->notName('*.blade.php')
->notPath('bootstrap')
->notPath('node_modules')
->notPath('storage')
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active Nov 23, 2022
PHP CS Fixer - Laravel Coding Style Ruleset
View .php-cs-fixer.php
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@calebporzio
calebporzio / tinker_helper.php
Created Jan 30, 2019
A quick, memorable way to initiate an "artisan tinker" session and play with variables.
View tinker_helper.php
<?php
function tinker(...$args) {
// Because there is no way of knowing what variable names
// the caller of this function used with the php run-time,
// we have to get clever. My solution is to peek at the
// stack trace, open up the file that called "tinker()"
// and parse out any variable names, so I can load
// them in the tinker shell and preserve their names.
@jakub-g
jakub-g / async-defer-module.md
Last active Nov 20, 2022
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas
View async-defer-module.md

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@calebporzio
calebporzio / HasUuid.php
Created Jul 5, 2018
A little trait to add to models that will have Uuids
View HasUuid.php
<?php
// Example usage in a model:
class ExampleModel extends Model
{
use HasUuid;
protected $primaryKey = 'uuid';
@BenSampo
BenSampo / deploy.sh
Last active Nov 18, 2022
Laravel deploy script
View deploy.sh
# 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
View AuthServiceProvider.php
<?php
namespace App\Providers;
use App\Permission;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{