Skip to content

Instantly share code, notes, and snippets.

View peterjaffray's full-sized avatar
♨️
:batman: https://meet.google.com/qcj-xvov-oqv

Peter Jaffray peterjaffray

♨️
:batman: https://meet.google.com/qcj-xvov-oqv
View GitHub Profile
@peterjaffray
peterjaffray / wp.fish
Created May 2, 2023 16:44
wp-cli completions for fish cli //~/.config/fish/completions/wp.fish
function __wp_complete
set -l old_ifs $IFS
set -l cur (commandline -ct)
set IFS \n
set -l opts (wp cli completions --line=(commandline) --point=(commandline -C))
if string match -q --regex "\<file\>\s*" $opts
return (commandline -f)
@peterjaffray
peterjaffray / snippet.js
Created September 12, 2022 21:56
# Track Elementor Form Submission Field Data in Tag Manager
jQuery(document).ready(function($) {
$(document).on('submit_success', function(evt) {
dataLayer = window.dataLayer || []
var elements = evt.target.elements
var serialized = jQuery(elements).serializeArray()
console.log(serialized)
var obj = {}
serialized.forEach((i) => {
var key = i.name;
@peterjaffray
peterjaffray / install.sh
Last active November 7, 2021 17:02
Ubuntu Impis Bootstrap Recipie
sudo do-release-upgrade
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
gpg --dry-run --quiet --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" | sudo tee /etc/apt/preferences.d/99nginx
sudo apt update
@peterjaffray
peterjaffray / header.html
Created September 4, 2021 18:39
GA Connector for Elementor Pro Forms
<script data-cfasync="false" type="text/javascript" src="https://tracker.gaconnector.com/gaconnector.js"></script>
<script>
function setGaconnectorHiddenFields() {
const gaFields = gaconnector.getCookieValues()
const field_names = Object.keys(gaFields) || []
const form_name = document.forms["ga_connector"]
const number_of_fields = field_names.length;
//****************************************************************
@peterjaffray
peterjaffray / settings.json
Created December 26, 2020 22:01 — forked from thomasmaurer/settings.json
My Windows Terminal Settings settings.json June 2020
// This file was initially generated by Windows Terminal 0.11.1121.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@peterjaffray
peterjaffray / README.md
Created December 6, 2020 17:57 — forked from gibatronic/README.md
Tab completion for the npx command

complete_npx

Bash tab completion for the npx command

Usage

Save complete_npx in your home folder and then source it on your .bash_profile with:

. ~/complete_npx.sh
@peterjaffray
peterjaffray / wp-cli.bash
Created November 27, 2020 17:54
What I am using for tab completion on wordpress cli
# bash completion for the `wp` command
_wp_complete() {
local OLD_IFS="$IFS"
local cur=${COMP_WORDS[COMP_CWORD]}
IFS=$'\n'; # want to preserve spaces at the end
local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"
if [[ "$opts" =~ \<file\>\s* ]]
@peterjaffray
peterjaffray / elementor-form-tracker.js
Last active February 6, 2024 14:47
Here is the Elementor form tracker we used on this lead generating accountant website. Learn more about it here: https://www.choice.marketing/web-design/portfolio/blair-henderson-cpa
jQuery( document ).ready(function( $ ){
$( document ).on('submit_success', function(){
gtag("event", "Successful Contact Form Submission", {
event_category: "Form",
event_label: "sendSuccess",
value: 20
});
});
});
//Pete's tracker
function petesTracker(action,category,label) {
window.uetq = window.uetq || [];
window.gtag = window.gtag || [];
window.fbq = window.fbq || [];
window._paq = window._paq || [];
if (typeof gtag != "undefined") {
gtag('event', action, {event_category: category, event_label: label});
@peterjaffray
peterjaffray / r53-wipe.sh
Last active May 3, 2020 18:32
r53 wipe zone
#!/bin/bash
# ./r53-wipe domain.com
# chmod +x r53-wipe.sh
# sudo apt install jq
# Description: This is a basic script to remove hosted zones from r53. It's a real pain in the ass when you have to do it manually.
for domain in "$@"; do
echo "removing $domain and it's records ... "
hosted_zone_id=$(aws route53 list-hosted-zones --output text --query 'HostedZones[?Name==`'$domain'.`].Id')