Skip to content

Instantly share code, notes, and snippets.

View davecurrierseo's full-sized avatar

Dave Currier davecurrierseo

View GitHub Profile
@davecurrierseo
davecurrierseo / gtm.js
Created September 21, 2023 20:34
Google Tag Manager CSV
// Just paste this into the console when viewing gtm tags
// Find the table element
var table = document.querySelector('table.gtm-multiselect-table');
if (!table) {
console.error('Table not found on this page.');
} else {
// Extract data from the table
var data = [];
// Disable AJAX page navigation w/wp pagenavi
<script>jQuery(function($) {$('div.wp-pagenavi a').on('click', function(e) {e.stopImmediatePropagation();});});</script>
# Apache Server Configs v2.15.0 | MIT License
# https://github.com/h5bp/server-configs-apache
# (!) Using `.htaccess` files slows down Apache, therefore, if you have
# access to the main server configuration file (which is usually called
# `httpd.conf`), you should add this logic there.
#
# https://httpd.apache.org/docs/current/howto/htaccess.html
# ######################################################################
@davecurrierseo
davecurrierseo / .htaccess
Last active January 13, 2023 16:19
.htaccess Redirects
# Force HTTPS
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com [NC]
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
# Sub-Domain Only To A Specific URL
RewriteCond %{HTTP_HOST} ^sub\.old-domain\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ http://www.domain.com/url/ [R=301,L]
@davecurrierseo
davecurrierseo / Add Space
Created August 21, 2019 21:06
Add Spaces To The Dock On Mac
# first this
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
# then this
killall Dock
@davecurrierseo
davecurrierseo / dev-tools
Created July 30, 2019 20:05
Google Sheets - Extract Rich Text Links
# step 1 - make sure the rich text links are in column (a)
# step 2 - export sheet as a webpage (.html)
# step 3 - open sheet in chrome, open dev tools and paste this in the console:
let cells = document.getElementsByTagName('td');
for (let i = 0; i < cells.length; i++) {
let links = cells[i].getElementsByTagName('a');
for (let k = 0; k < links.length; k++) {
if (typeof links[k] !== 'undefined') {
@davecurrierseo
davecurrierseo / add-tracking-code.php
Last active February 7, 2018 16:54
Add Tracking Code With Dynamic Variable
<?php
/**
* Random Tracking Code
*/
/**
* Adds Tracking script to footer of thank-you page
*/
function coa_add_trackingCode($order_id) {
@davecurrierseo
davecurrierseo / gravity-data.php
Created November 7, 2017 21:46
Add Form Name as a Data Attribute to Gravity Forms Form Element
/**
* Adds form title to a data attribute on the form element
* @param [string] $form_tag The string containing the <form> tag
* @param [object] $form The current form
* @return [string] The new <form> tag string
*/
function gravity_form_tag($form_tag, $form) {
$form_title = $form['title'];
$form_tag = str_replace('<form', "<form data-formtitle='{$form_title}'", $form_tag);
return $form_tag;
@davecurrierseo
davecurrierseo / Compare Columns
Last active July 7, 2022 17:46
Google Sheets Cheat Sheet
# Compares Columns A and B by outputting values that are found in column A but NOT B.
Useful for checking a full site crawl against a sitemap.
=FILTER(A2:A,ISNA(MATCH(A2:A,B2:B,0)))