Skip to content

Instantly share code, notes, and snippets.

View justingivens's full-sized avatar

Justin D. Givens justingivens

View GitHub Profile
@justingivens
justingivens / custom-html.html
Last active August 14, 2024 13:29
HubSpot <> Google Tag Manager Custom Event
//Trigger on pages and customize as needed.
<script>
window.addEventListener('message', function(event) {
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
dataLayer.push({'event':'hubspot-form-ready','hubspot-form-id':event.data.id});
}
//Form Submission #1
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
dataLayer.push({'event':'hubspot-form-submission','hubspot-form-id':event.data.id});
@justingivens
justingivens / .htaccess
Created October 21, 2021 19:15
cpanel - lsws - geoip - wp standard htaccess with country code blocking
<IfModule mod_geoip.c>
<FilesMatch "wp-login.php|xmlrpc.php">
RewriteEngine On
#RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(US)$ # If using MOD_GEOIP with Litespeed Web Server
#RewriteCond %{HTTP:CF-IPCOUNTRY} !^(US)$ # If using CloudFlare
RewriteRule ^(.*)$ - [F,L]
</FilesMatch>
</IfModule>
# BEGIN WordPress
@justingivens
justingivens / gist:c56b6c18fa5f36e0bead096208af6e11
Created March 9, 2021 05:58
WP CLI Search-Replace to launch Production
#Export a SQL to use to move into Production
wp search-replace '{{DEVELOP_URL}}' '{{PRODUCTION_URL}}' --all-tables --export=production.sql
@justingivens
justingivens / gtm-vimeo.js
Created May 11, 2020 21:20
Vimeo GTM events
//Reference: https://developer.vimeo.com/player/sdk/basics
var iframe = document.querySelector('iframe'); //Update to whatever holds your player
var player = new Vimeo.Player(iframe);
var title = '';
var sendToGTM = function(event_name) {
dataLayer.push({
'event':'vimeo-event',
'action': event_name,
'video_title': title
@justingivens
justingivens / create-posts.txt
Created June 26, 2017 15:43
WP-CLI - Generate Posts with different post dates and different content
for i in {10..1}; do custom_date=$(date -v-${i}d "+%Y-%m-%d") && curl http://loripsum.net/api/5/headers/ul/bq | wp post generate --post_content --count=1 --post_date=$custom_date; done
@justingivens
justingivens / class-box-builder-cache.php
Last active May 10, 2017 18:56
Unique file name caching system for beaverbeaver. This is perfect if you use a CDN or strip out url parameters. This class clones the layout files and generates assets.
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( class_exists( 'FLBuilder' ) ) {
/**
* Caching Solutions for _box-Builder