Skip to content

Instantly share code, notes, and snippets.

@stidges
stidges / spinner.css
Last active August 29, 2015 14:01
Simple single-element spinner using CSS3 animations
body {
background-color: #d6e0e6;
}
.spinner {
position: absolute;
top: 50%;
left: 50%;
margin-left: -21.5px;
margin-top: -21.5px;
@stidges
stidges / example.php
Created December 19, 2016 12:17
Using when() in the Laravel query builder
<?php
namespace App\Http\Controllers;
use App\Post;
use Illuminate\Http\Request;
class PostsController extends Controller
{
public function index(Request $request)
@stidges
stidges / TestCase.php
Last active September 16, 2017 20:33
Easily test your Laravel middleware classes. Blog post: http://blog.stidges.com/post/testing-your-laravel-middleware
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestResponse;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use PHPUnit\Framework\Assert;
abstract class TestCase extends BaseTestCase
{

Keybase proof

I hereby claim:

  • I am stidges on github.
  • I am stidges (https://keybase.io/stidges) on keybase.
  • I have a public key ASCfoJPTZueL1UgrbhO7O8vSDv5UEqmtxxAdhaQpnOeorAo

To claim this, I am signing this object:

@stidges
stidges / CacheBustingLaravelValetDriver.php
Last active August 21, 2018 02:20
Rewrite filename-based cache busting URIs (e.g. jquery.1476809927.js) to the correct filename in Laravel Valet
<?php
class CacheBustingLaravelValetDriver extends LaravelValetDriver
{
public function isStaticFile($sitePath, $siteName, $uri)
{
$result = parent::isStaticFile($sitePath, $siteName, $uri);
if ($result !== false) {
return $result;
@stidges
stidges / AllowedUsernameValidator.php
Created March 10, 2017 18:21
Code to accompany the 'Writing an Allowed Username Validator in Laravel' (http://blog.stidges.com/post/writing-an-allowed-username-validator-in-laravel)
<?php
# app/Validation/AllowedUsernameValidator.php
namespace App\Validation;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Routing\Router;
use Illuminate\Config\Repository;
@stidges
stidges / Request.php
Created January 1, 2018 16:33
Code to accompany the 'Reusable Validation Rules with Laravel Form Requests' post (https://stidges.com/reusable-validation-rules-with-laravel-form-requests)
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
abstract class Request extends FormRequest
{
/**
<?php
namespace Acme\Html;
use Illuminate\Html\FormBuilder as IlluminateFormBuilder;
class FormBuilder extends IlluminateFormBuilder {
/**
* An array containing the currently opened form groups.
@stidges
stidges / tailwind.itermcolors
Last active November 30, 2023 21:00
An iTerm2 color scheme based on the Tailwind CSS color scheme (https://tailwindcss.com/docs/colors)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.17254902422428131</real>