Skip to content

Instantly share code, notes, and snippets.

View taylorgorman's full-sized avatar

Taylor Gorman taylorgorman

View GitHub Profile
@taylorgorman
taylorgorman / extend-example-1.css
Last active July 2, 2022 16:30
Code examples made for https://cnpagency.com/blog/trim-hidden-bulk-in-your-sass-extend-directives/. Don't delete this if that's still up (and it is as of 2022 Jul 2).
.button, .big-button {
display: inline-block;
padding: 1em;
}
.big-button {
font-size: 1.4em;
}
@taylorgorman
taylorgorman / Context.js
Last active June 1, 2019 19:25
Optimistic vendor inclusion. After all, YOU are writing the files inside /vendor. Upside: cleaner Context.js. Downside: not evident in Context if missing functions.
import zillow_functions from 'vendor/zillow';
import auth0_functions from 'vendor/auth0';
import packageJson from '../package.json';
export class Provider extends Component {
state = {
app_title = 'Houses',
zip_code = 0,
version = packageJson.version
@taylorgorman
taylorgorman / create-placeholder-users
Last active July 2, 2022 16:44
WP-CLI commands to aid in local development
# Create placeholder users with each role for testing
# Assumes your user is administrator
# Should go without saying, but: These passwords are obviously insecure. This is only intended for local development.
#
wp user create editor me+editor@taylorpatrickgorman.com --user_pass=editor --role=editor --first_name=Editor --last_name=User
wp user create author me+author@taylorpatrickgorman.com --user_pass=author --role=author --first_name=Author --last_name=User
wp user create contributor me+contributor@taylorpatrickgorman.com --user_pass=contributor --role=contributor --first_name=Contributor --last_name=User
wp user create subscriber me+subscriber@taylorpatrickgorman.com --user_pass=subscriber --role=subscriber --first_name=Subscriber --last_name=User
@taylorgorman
taylorgorman / safeDataLayerPush.md
Last active March 19, 2024 07:51
A safer dataLayer.push for Google Tag Manager

A safer dataLayer.push for Google Tag Manager

Goals

  1. Enforce a timeout of 2 seconds if one is not provided. See https://www.simoahava.com/gtm-tips/use-eventtimeout-eventcallback.
  2. Guarantee the callback, if provided, will execute even if Tag Manager fails or is blocked by the browser. See https://stackoverflow.com/questions/60489452/should-i-use-eventcallback-for-gtm-before-redirecting.

Minified

Plop this function right after your Tag Manager embed code to make it available to your entire app. Minified with https://www.toptal.com/developers/javascript-minifier.

@taylorgorman
taylorgorman / session-source-group.txt
Created May 14, 2024 20:53
Google Looker Studio field formula to group Session Sources typically split up by subdomain. Pairs well with Session Channel Group.
IF( CONTAINS_TEXT( Session source, "facebook" ), "Facebook",
IF( CONTAINS_TEXT( Session source, "fb" ), "Facebook",
IF( CONTAINS_TEXT( Session source, "ig" ), "Instagram",
IF( CONTAINS_TEXT( Session source, "instagram" ), "Instagram",
IF( CONTAINS_TEXT( Session source, "Instagram" ), "Instagram",
IF( CONTAINS_TEXT( Session source, "linkedin" ), "LinkedIn",
IF( CONTAINS_TEXT( Session source, "lnkd.in" ), "LinkedIn",
IF( CONTAINS_TEXT( Session source, "t.co" ), "Twitter",
IF( CONTAINS_TEXT( Session source, "pinterest" ), "Pinterest",
IF( CONTAINS_TEXT( Session source, "reddit" ), "Reddit",