Skip to content

Instantly share code, notes, and snippets.

View alanmcginnis's full-sized avatar
🦏
GH Status

Alan J McGinnis alanmcginnis

🦏
GH Status
View GitHub Profile
@alanmcginnis
alanmcginnis / fsOptIn.js
Last active July 7, 2022 21:57
This is a rough outline of how you could start/stop FullStory based on user consent.
// For example purposes only
// Set up all of your variables here
// buttons, defaults, etc.
function loadFullStory(){
// Put Your FullStory Script Here
}
// Determine if FS should start recording based on an input value from a 🍪 bar or modal, really any user input
@alanmcginnis
alanmcginnis / Makefile
Created June 22, 2021 05:49 — forked from rsperl/Makefile #snippet
self-documenting makefile with colors
SHELL=/bin/bash
# to see all colors, run
# bash -c 'for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; echo =$c; done'
# the first 15 entries are the 8-bit colors
# define standard colors
ifneq (,$(findstring xterm,${TERM}))
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
@alanmcginnis
alanmcginnis / gist:b9e52ec2b8fdb787afa9419222b37125
Created November 28, 2020 17:40 — forked from danielestevez/gist:2044589
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
@alanmcginnis
alanmcginnis / gist:f18d1b80b17cbb6e83f79f71c3fc73ec
Created March 16, 2020 23:49 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path
@alanmcginnis
alanmcginnis / wp-plugin-classes.php
Created January 14, 2020 01:49 — forked from chrisguitarguy/wp-plugin-classes.php
Using classes in WordPress plugins. Please comment!
<?php
/* Using Classes in WordPress Plugins */
/**
* The "normal" way. Actions are added in a constructor. Create a new instance
* of the class to "bootstrap" the plugin.
*
* Two ways to instantiate:
* 1. anonymous:
@alanmcginnis
alanmcginnis / iframe.html
Created December 21, 2019 01:45 — forked from cirocosta/iframe.html
Sending messages from child iframe to parent webpage
<!DOCTYPE html>
<html>
<head>
<title>My Iframe</title>
</head>
<body>
<button>Botão</button>
<script type="text/javascript">
@alanmcginnis
alanmcginnis / gist:e09e8ee046b0f7c16431ec8966e30ee3
Created December 18, 2019 21:46 — forked from mannieschumpert/gist:8334811
Filter the submit button in Gravity Forms to change the <input type="submit> element to a <button> element. There's an example in the Gravity Forms documentation, but it lacks the proper code to show your custom button text, AND removes important attributes like the onclick that prevents multiple clicks. I was trying to solve that.
<?php
// filter the Gravity Forms button type
add_filter("gform_submit_button", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
// The following line is from the Gravity Forms documentation - it doesn't include your custom button text
// return "<button class='button' id='gform_submit_button_{$form["id"]}'>'Submit'</button>";
// This includes your custom button text:
return "<button class='button' id='gform_submit_button_{$form["id"]}'>{$form['button']['text']}</button>";
}
// Oops this strips important stuff
@alanmcginnis
alanmcginnis / browsersync-webpack.md
Created November 27, 2019 05:46 — forked from robinrendle/browsersync-webpack.md
Getting set up with Browsersync and Webpack

Fixing our local environment with Browsersync

Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server and BrowserSync we can fix this:

npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server

BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.

@alanmcginnis
alanmcginnis / acf-custom-metabox-on-options-page.php
Created October 15, 2019 22:31 — forked from RadGH/acf-custom-metabox-on-options-page.php
ACF: Display custom metabox on an ACF (sub-) options page
<?php
/**
* Add sub options page with a custom post id
*/
if( function_exists('acf_add_options_page') ) {
acf_add_options_sub_page(array(
'page_title' => 'CSV Sync',
'menu_title' => 'CSV Sync',
'parent_slug' => 'users.php',
@alanmcginnis
alanmcginnis / yoast_seo_prev_next_change.php
Created June 20, 2019 21:06 — forked from amboutwe/yoast_seo_prev_next_change.php
Remove or modify the Yoast SEO prev or next URLs. Only copy the section of code you need.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change Yoast SEO Prev/Next URL on some pages
* Credit: Yoast Team
* Last Tested: Jun 10 2017 using Yoast SEO 4.9 on WordPress 4.8
*/
add_filter( 'wpseo_next_rel_link', 'custom_change_wpseo_next' );