Skip to content

Instantly share code, notes, and snippets.

mattstauffer / example.html
Created Mar 3, 2020
Example of logging Laravel Livewiure component state
View example.html
<script src="{{ asset('js/app.js') }}"></script>
let logComponentsData = function () {
window.livewire.components.components().forEach(component => {
document.addEventListener("livewire:load", function(event) {
mattstauffer /
Created Sep 14, 2020
Tighten Handbook Class Order

Extracted for the benefit of non-Tightenites.

Class "things" should be ordered as follows:

  1. Traits
  2. Statics properties
  3. Constants
  4. Instance properties
mattstauffer /
Last active May 26, 2021
Introduction to GistLog

So, you might be asking yourself, what is GistLog?

GistLog is a blogging "platform" for people who want to quickly write and publish content, in Markdown, and don't want to bother with yet another platform and yet another login and yet another group hoarding their content. With GistLog, you use your pre-existing GitHub login, you store the data in your own GitHub account, and you can publish with a single click.

Using GistLog

  1. Create a public gist with a single file using Markdown. Set the gist description to be the title of your blog post
  2. Copy the gist URL, and paste it into the text box on the GistLog create page
  3. Copy your resulting URL and share it as your blog post—note that it will be in the form of
  4. If you want to have your own GistLog landing page (e.g., [read all about it](
mattstauffer / env.helper.php
Created Nov 22, 2015
Laravel's env() helper
View env.helper.php
* Gets the value of an environment variable. Supports boolean, empty and null.
* @param string $key
* @param mixed $default
* @return mixed
function env($key, $default = null)
mattstauffer /
Last active Oct 14, 2020
Trying to buy an affordable XLR mic for podcasting

I'm trying to upgrade from my Blue Yeti (link), because I got a Onyx Blackjack (link) for Christmas and want to move to an XLR-based microphone.

I was hoping to sell my Blue Yeti & shock mount, and maybe throw a little bit more money at it, which means I'm definitely looking at under $200. Trying to find the best fit for a sub-$200 podcasting mic, XLR-based. I would love any new recommendations or votes for against any of these mics. Thanks!

MXL V67G - $88.95 - Amazon

Shure SM58 -

mattstauffer /
Last active Oct 12, 2020
Introducing Gistlog landing pages

It's great that Gistlog makes it easy to write Gist-powered, Markdown-formatted, blog posts. But what if you want to use it as your entire blogging platform? We're working on it, and here's a first step: user landing pages.

Any Github user that has any public gists that contain a file named gistlog.yml now have a landing page on Gistlog at So, since I have (more than) one, you can view my landing page at It's very simple right now, but we have a ton of ideas to improve it over time. So go check it out.

How do you get your own Gistlog landing page?

  1. Create a new Gistlog Gist (or edit an old one)
  2. Create two files: one for the markdown (I recommend for the name) and one for the Gistlog settings (which must be named gistlog.yml)
  3. Write your blog post in
  4. Since there are no actual settings being parsed from gistlog.yml yet, just create it with the fol
mattstauffer /
Created Jul 6, 2020
Simple BASH Xdebug toggler

Written by Matt Stauffer

Note: This expects that you've enabled Xdebug in a specific file: /usr/local/php/X.x/conf.d/ext-xdebug.ini.


Add this function to your .zshrc or similar file.


On the command line, type xdebug and hit enter. This will toggle whether or not Xdebug is running.


mattstauffer / Kids Books with Black
Last active Jun 11, 2020
Kids' books with Black protagonists
View Kids Books with Black

Note: Most of these are applicable to the ages older than I have listed, but I've put them where they were when my kids first started really enjoying them.

Infants (0-2ish?)

  • Shades of People
  • Peekaboo Morning and Peekaboo Bedtime

Really, anything in the "toddlers" section will be fine for these kids. But there aren't a ton of baby-focused books I know.

Toddlers (3-4 or 3-5ish?)

  • Sulwe
mattstauffer / gist:a2376484ea2e19325e3c
Last active Mar 5, 2020 — forked from rtablada/gist:dcf0f82d8ca4c914fd9b
Something something node modules something
View gist:a2376484ea2e19325e3c

(just a test, this is written by @rtablada not me)

After working with a lot of node modules I'm a bit angered by the fact that for a lot of these packages you have to pass around and keep track of a single shared instance throughout your application.

This works fine for small proxy servers and apps where the whole thing fits into a single app.js or maybe a handful of route files. But as things start to grow this model really breaks down and becomes cumbersome.

Just think about a resource file for app/resources/users.js which needs the current Redis or RabbitMQ connection to publish events like user registration, a database connection to persist things, and probably a instance because it's Real Time: it's so hot right now! If you export a function that allows these to be injected, your resource has boilerplate.

mattstauffer /
Last active Mar 5, 2020
Serving Statamic data from in-memory cache

Ed Finkler (Funkatron) asked me, in response to my recent article introducing Statamic, whether you could change Statamic's settings to serve from something other than the local disk.

I checked with Jason & Jack at Statamic, and they told me three things:

  1. Statamic already has the ability (if configured a certain way) to compile all the files down to HTML. It's possible (I don't know how yet, but I know it is) to configure Nginx to serve those files directly.
  2. Statamic v1 has a static site generator built-in, and v2 will get one soon.
  3. Since Statamic's .env file effects the behavior of its Laravel core, you can change the cache driver that your Statamic app is using just like you would in any Laravel app. Just add a CACHE_DRIVER key in .env file and set it to any of the options: 'file', the default; 'database'; 'memcached'; 'redis';