Skip to content

Instantly share code, notes, and snippets.

Avatar

Evan Mattson aaemnnosttv

View GitHub Profile
@aaemnnosttv
aaemnnosttv / jest.test.js
Created May 26, 2020
Jest order of operations
View jest.test.js
describe( 'level 0', () => {
beforeAll( () => console.log( 'beforeAll', 'Level 0' ) );
afterAll( () => console.log( 'afterAll', 'Level 0' ) );
beforeEach( () => console.log( 'beforeEach', 'Level 0' ) );
afterEach( () => console.log( 'afterEach', 'Level 0' ) );
describe( 'level 1A', () => {
beforeAll( () => console.log( 'beforeAll', 'Level 1A' ) );
afterAll( () => console.log( 'afterAll', 'Level 1A' ) );
beforeEach( () => console.log( 'beforeEach', 'Level 1A' ) );
@aaemnnosttv
aaemnnosttv / env.php
Created Jan 27, 2020
WordPress Environment Configuration
View env.php
<?php
/**
* Plugin Name: Environment Configuration
* Description: Enforces environment-specific settings for the current environment.
*/
namespace App\Environment;
function disable_plugins( $disable_plugins ) {
add_filter(
@aaemnnosttv
aaemnnosttv / details.md
Last active Sep 28, 2019 — forked from ericclemmons/example.md
HTML5 <details> in GitHub
View details.md

Using <details> in GitHub

Suppose you're opening an issue, pull request, or just leaving a comment and you have a lot of supporting content to provide, such as:

  • Log excerpts
  • Code snippets
  • Large screenshots
  • Any other form of content spanning a large vertical space

To optimize readability, wrap it in a <details> tag!

@aaemnnosttv
aaemnnosttv / gravity-forms-select-optgroupify.php
Created Oct 5, 2018
GravityForms filter to allow for grouping select choices into labelled groups using special choice options.
View gravity-forms-select-optgroupify.php
<?php
/**
* Filter for GravityForms to group select field choices by a special "optgroup" choice.
*
* Simply add a new choice with a value of 'optgroup' to the dropdown to start a group of options.
* All following choices will be grouped under it using its label for the group.
* Any number of groups can be created, as each optgroup choice will start a new group.
* Supports field placeholder & ungrouped options, but must be before the first group.
*
* This snippet can be added to your theme's functions.php, or a custom plugin.
View revslider-query-fix.php
<?php
/**
* Prevent revslider from adding a query on every request.
*
* Calling `update_option('rs_tables_created', true)` causes
* a database query to run since it's get_option value ("1")
* does not match the value it is called to set it to.
*
* Since the query casts `true` to "1" the update query is run on every request as true !== '1'.
@aaemnnosttv
aaemnnosttv / wp-offload-s3-config.php
Created Mar 24, 2017
Offload S3 Environment-Based Configuration
View wp-offload-s3-config.php
<?php
/**
* There are many possible ways to set this, but it can only be defined once.
*
* Using an environment variable by the same name
* define( 'WP_ENV', getenv( 'WP_ENV' ) );
*
* Matching the hostname
* define( 'WP_ENV', 'example.com' == $_SERVER['SERVER_NAME'] ? 'production' : 'staging' );
*/
@aaemnnosttv
aaemnnosttv / my-solution.html
Created Jan 16, 2017
JavaScript 30 // #10 - Hold Shift to Check Multiple Checkboxes
View my-solution.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<style>
html {
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

View mamp-to-valet.md

MAMP to Valet

One-time Dependency Setup/Configuration

Install Composer

wget https://getcomposer.org/download/1.1.0/composer.phar && chmod +x composer.phar && sudo mv /usr/local/bin/composer && composer self-update
@aaemnnosttv
aaemnnosttv / aws-iam-s3-single-bucket-policy.json
Created Feb 12, 2016
AWS IAM S3 Single Bucket Policy Template (Full Access)
View aws-iam-s3-single-bucket-policy.json
{
"Statement": [
{
"Action": [
"s3:ListAllMyBuckets"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::*"
},
{
You can’t perform that action at this time.