Skip to content

Instantly share code, notes, and snippets.

View bgoewert's full-sized avatar
📈
stonks

Brennan Goewert bgoewert

📈
stonks
View GitHub Profile
@bgoewert
bgoewert / README_GravityForms-Floating-Labels.md
Last active February 14, 2025 15:38
Gravity Forms Floating Labels

Gravity Forms Floating Labels

I had a need to reduce the overall height of the form (at least on load). A mockup had all the input labels as placeholders. In material design, there is a thing called "floating labels", which just means that the labels display as placeholders and move above/below when focused. This allows you to keep the <label> functionality.

The following code applies floating labels to normal and complex (e.g., address) fields.

@bgoewert
bgoewert / README_Gravity-Forms-Grouped-Sections-and-Columns.md
Last active February 14, 2025 15:08
Gravity Forms grouped sections and columns

Gravity Forms Grouped Sections and Columns

By default, GF sections and respective sub-fields are not structured or identified in the HTML as you would expect. This helps group all the sections into <section> fields as well as allow you to create columns based on these sections.

You may need modify the CSS to your needs.

Enabling Sections

Simply add the gform_sections class to the form's "CSS Class Name".

@bgoewert
bgoewert / .aliases
Last active February 17, 2025 18:40
#if [ -f ~/.aliases ] ; then
# . ~/.aliases
#fi
alias update='sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y; sudo snap refresh; flatpak update -y;'
alias filedatetime='date +"%Y-%m-%dT%H%M%S%z"'
alias lst='ls -tlh'
alias ds='find ${1:-.} -type f -exec ls -lnq {} \+ | awk '\''BEGIN{sum=0} {sum+=$5} END{u="+Ki+Mi+Gi+Ti+Pi+Ei";split(u,unit,"+");v=sum;for(i=1;i<7;i++){if(v<1024)break;v/=1024}printf("%.3f %sB\n",v,unit[i])}'\'''
alias mkvenv='python3 -m venv .venv && source .venv/bin/activate && which python'
alias envenv='source .venv/bin/activate'
@bgoewert
bgoewert / install_phpstorm.sh
Created October 30, 2023 03:39
Install the latest PhpStorm
#!/bin/sh
# Adapted from https://www.linuxbabe.com/ubuntu/install-phpstorm-ubuntu-18-04-18-10
# Get the latest version number
re='PhpStorm\s\K[0-9]{4}\.[0-9]+(\.[0-9]+)?(?!\sEAP)'
jb=https://www.jetbrains.com/updates/updates.xml
latest=$(curl $jb 2>/dev/null | grep -Pom 1 $re)
dl="https://download.jetbrains.com/webide/PhpStorm-$latest.tar.gz"
@bgoewert
bgoewert / phpcs.xml
Created August 15, 2023 15:44
Brennan's WordPress PHPCS Standard. A customized PHPCS Standard that prefers PSR-12 over WPCS. Any WPCS conflicts with PSR-12 are added as exclusions.
<?xml version="1.0"?>
<ruleset name="Brennan's WordPress PHPCS Standard" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<description>Customized WordPress Coding Standard that prefers PSR-12 over WPCS.</description>
<!-- Standards to use -->
<config name="default_standard" value="PSR12" />
<config name="installed_paths" value="vendor/wp-coding-standards/wpcs,vendor/phpcompatibility/php-compatibility,vendor/phpcompatibility/phpcompatibility-paragonie,vendor/phpcompatibility/phpcompatibility-wp" />
<!-- What to scan -->
<file>.</file>
@bgoewert
bgoewert / CreateScreenshotDateFolders.sh
Created July 10, 2023 23:04
Linux Create Date Organized Screenshot Sub-Folders
# https://unix.stackexchange.com/a/24955/528905
# Requires inotify-tools and libnotify-bin
inotifywait -m ~/Pictures/Screenshots -e create |
while read dir action file; do
if [ -f "$dir$file" ]; then
sspath="$dir$(date -I)"
if [ ! -d $sspath ]; then
mkdir $sspath
notify-send "New Screenshot Folder Created" "\"$sspath\""
fi
@bgoewert
bgoewert / WordPress Trac Triage Responses.md
Created December 26, 2022 17:06
Canned reponses for WordPress Trac

WordPress Core Trac Triage Canned Responses

These are response templates to use on https://core.trac.wordpress.org/ for triaging.

Invalid Support Request

Hello <user> and welcome to WordPress Trac!

I'm sorry to hear you are having issues with . Please note that Core Trac is used for bug reports and enhancements for the WordPress core software, not individual support issues or questions.
@bgoewert
bgoewert / Update git fork with tags.sh
Last active December 17, 2022 14:20 — forked from Saissaken/Update git fork with tags.sh
Update git fork with tags
# Repo: superteam/myframework
# Fork: someuser/myframework
# Track:
git clone https://github.com/someuser/myframework.git
cd myframework
git remote add upstream https://github.com/superteam/myframework.git
# Update:
git fetch upstream
@bgoewert
bgoewert / isWebKit.js
Created November 30, 2022 15:21
JS function to check if browser is using WebKit.
function isWebKit() { return /^iP/.test(navigator.platform || navigator.userAgent) || (/^Mac/.test(navigator.platform || navigator.userAgent) && navigator.maxTouchPoints > 2); || /Safari/.test(navigator.userAgent) }
@bgoewert
bgoewert / iptables-resolve.sh
Last active February 9, 2023 18:04
Domain/hostname DNS resolution for iptables
#!/bin/bash
##### Domain/Hostname Resolution for iptables #####
# This script performs a DNS query to get a list of IPs associated with a domain.
# You can then create a cron as root to be run however often your needs require.
#
# Usage: $HOME/.local/bin/iptables-resolve [-a|--add] [-t|--test-run] [-j|--jump=<target>] <hostname>
# Example: $HOME/.local/bin/iptables-resolve -atj DROP www.example.com
#
# If no options are given, the default action is to add all resolved IPs as ACCEPT.