Skip to content

Instantly share code, notes, and snippets.

View mustardBees's full-sized avatar

Phil Wylie mustardBees

View GitHub Profile
# Send 429 status for rate limit violations.
limit_req_status 429;
# Apply to product pages only.
location ~ ^/(product|product-category|product-tag)(/|$) {
limit_req zone=perip burst=20 nodelay;
# Use the same backend hand-off as the default location /
proxy_pass $backend_protocol://$backend_host:$backend_port;
}
# Shared per-IP rate limit zone (global).
limit_req_zone $binary_remote_addr zone=perip:10m rate=5r/s;
for i in {1..40}; do
curl -s -o /dev/null -w "%{http_code}\n" \
https://www.yourapp.com/product/sample-product-slug/ &
done
wait
$ sudo nginx-sp -t
$ sudo service nginx-sp restart
wp user generate --format=ids --count=10 | xargs -d ' ' -I % bash -c 'wp user update % --user_registered="2020-04-02 14:35:02" && wp user meta add % verification_token randomstring1234'
wp user generate --format=ids --count=10 | xargs -d ' ' -I % wp user meta add % verification_token randomstring1234
wp user generate --count=10
@mustardBees
mustardBees / functions.php
Last active January 14, 2024 21:52
Add text with a link after the LearnDash login modal heading.
<?php
/**
* Add text with a link after the LearnDash login modal heading.
*/
function kanuka_add_text_after_login_modal_heading() {
?>
<div class="my-custom-text">
<p>This is some additional text. <a href="https://example.com">Click here</a> for more information.</p>
</div>
<?php
<?php
/**
* Write a log entry.
*
* Helper function to write a log entry with a given title, category, and any
* log data. Relies on the Maintenance Functionality mu-plugin being present.
*
* Usage:
*
* kanuka_log( 'Data Import', 'import', array(
@mustardBees
mustardBees / functions.php
Last active September 5, 2025 23:29
Generate a phone link with an aria-label for accessibility.
<?php
/**
* Generate a phone link with an aria-label for accessibility.
*
* @link https://link.from.pw/3HElEp9
*
* @param string $phone The phone number to format.
* @param string $class Optional. The CSS class name to add to the link.
*
* @return string The formatted telephone link.