Skip to content

Instantly share code, notes, and snippets.

View kmwalsh's full-sized avatar
🤖

Kate Walsh kmwalsh

🤖
View GitHub Profile
@kmwalsh
kmwalsh / gist:b02acf86d05ccd1767ea9fc4c261bff5
Last active May 12, 2022 17:50
Redirect single post to external link - WordPress
/**
* =============================================================
* Redirect single post to external link
* =============================================================
*/
// this checks to make sure that the function doesn't already exist
// if something else in your WP uses a function named redirect_cpt_to_external_link
// this check to see whether it exists or not will keep your site from crashing
if ( ! function_exists('redirect_cpt_to_external_link') ) {
// fix for keyboard focus states on scroll position or timed based popup implementations
//
// forces the focus back to the element that was focused prior to popup open
// fixes focus bug when faking a click on existing element to bring up a modal window
// fixes accessibility issue where the user's focus was changed when the popup shows
//
/**
* Gets keyboard-focusable elements within a specified element
* @param {HTMLElement} [element=document] element
@kmwalsh
kmwalsh / gist:40728e77d88b7fb2d9a0fd048d564c23
Created August 12, 2022 21:18
self-updating modified plugin
#!/bin/bash
# copy patches and update.sh to temporary directory
cp -r ./patches ~/tmp/wp-security-audit-log
cp -r ./update.sh ~/tmp/wp-security-audit-log
# get latest and unzip
curl -O https://downloads.wordpress.org/plugin/wp-security-audit-log.latest-stable.zip
unzip wp-security-audit-log.latest-stable.zip
https://drewdevault.com/2018/07/02/Email-driven-git.html
Date: Mon, 11 Jun 2018 14:19:22 -0400
From: Drew DeVault <sir@cmpwn.com>
To: Gregory Mullen <omitted>
Subject: Re: [PATCH 2/3 todo] Filter private events from events feed
On 2018-06-11 9:14 AM, Gregory Mullen wrote:
> diff --git a/todosrht/alembic/versions/cb9732f3364c_clear_defaults_from_tickets_to_support_.py b/todosrht/alembic/versions/cb9732f3364c_clear_defaults_from_tickets_to_support_.py
> -%<-
alias install-wp="curl -0 https://wordpress.org/latest.zip > latest.zip && unzip latest.zip && mv wordpress/* ./ && rm latest.zip && rm -r wordpress"
@kmwalsh
kmwalsh / yeet
Last active March 24, 2023 00:27
offload (yeet) "which front end build tool was it again?" from brain forever
#!/bin/bash
buildTools=("gulp", "gulp watch", "grunt", "grunt watch", "npm run build", "npm run watch", "npx webpack")
for t in ${buildTools[@]};
do
$t
echo yeet $t
done
Use this template when reporting a security vulnerability in Slack.
It can be inefficient to have to dig through a thread to figure out
what to do next. Presenting all of the information in the initial
disclosure message is ideal. Additionally, it is harrowing to
receive notification of a security vulnerability and can cause much
strife and chaos and confusion. This prevents some emotional chaos.
---
**Plugin:** (link to plugin repo)
@kmwalsh
kmwalsh / gist:863415ac6b9efa8f9e69ff2557c7cbbf
Last active June 29, 2023 18:21
Official guide to seriously official development slang
yeet = deploy. Use example: let’s yeet this to production.
yolo = do it on live. Use example: I’ma yolo that change – no staging.
yoinked/yoinkerized = pulled repo. Use example: I'ma yoinkerize the latest changes from main.
glow up = redesign. Use example: Their site is from 2010, needs a total glow up.
snack = clever piece of code. Use example: That function you wrote is a lil snack.
/**
*
* Prerequisites:
* (1) All of your Gutenberg block Sass is in its own folder, or somewhere separated from the rest of your Sass. `components/blocks/*` is the location of the Sass in this example.
* (2) Your variables, mixins, functions, etc. are separated from the rest of your sass. Mixin/variables/function files DO NOT CONTAIN any styling whatsoever -- just definitions.
* (3) Do not use the class wp-block anywhere in your custom Gutenblock templates.
*
* Steps:
* 1. Create a new file, editor-style.scss, alongside your style.scss -- do not use an underscore to start filename as this is not a partial
* 2. Import your block Sass, your mixins, variables, and functions, as well as any external libraries, in patterns shown below
@kmwalsh
kmwalsh / automatically prepend ticket number to commit message
Last active December 11, 2023 17:40
automatically prepend ticket number to commit message
* mv .git/hooks/commit-msg.sample .git/hooks/commit-msg
* chmod ug+x .git/hooks/commit-msg
paste the desired script into commit-msg