Skip to content

Instantly share code, notes, and snippets.

@SashkoWooTeam
SashkoWooTeam / jet-woo-builder-and-wcbm-compatibility.php
Created August 22, 2019 12:24
JetWooBuilder and Yith Shop Badges compatibility
if ( !function_exists( 'yith_wcbm_shop_badge_container_start' ) && !function_exists( 'yith_wcbm_shop_badge_container_end' ) ) {
add_action( 'jet-woo-builder/templates/products/before-item-thumbnail', 'yith_wcbm_shop_badge_container_start', 1 );
add_action( 'jet-woo-builder/templates/products/before-item-thumbnail', 'yith_wcbm_shop_badge_container_end', 2 );
function yith_wcbm_shop_badge_container_start() {
do_action( 'yith_wcbm_theme_badge_container_start' );
}
function yith_wcbm_shop_badge_container_end() {
do_action( 'yith_wcbm_theme_badge_container_end' );
}
}
@Jeiwan
Jeiwan / lightsail-docker.sh
Last active October 24, 2025 16:01 — forked from davidkryzaniak/lightsail-docker.sh
Auto-Install Docker and Docker Compose on AWS Lightsail
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install -y docker-engine
sudo curl -L "https://github.com/docker/compose/releases/download/1.9.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo groupadd docker
@generatepress
generatepress / gist:282078076cd8631c17717d5b8640c043
Last active May 15, 2023 22:00
Initiate the mobile header at your desired width. Change 768px to whatever you like.
@media( max-width: 768px ) {
.site-header,
#site-navigation,
#sticky-navigation {
display: none !important;
opacity: 0;
}
#mobile-header {
display: block !important;
@speedguy
speedguy / wp_forms_calculator
Last active February 6, 2023 23:13
WP Forms Calculator Demo
add_filter ('wpforms_frontend_confirmation_message', 'restrict_form_formula', 10, 2);
function restrict_form_formula($confirmation_message, $form_data) {
if ($form_data['id'] == 642) { /* This number is form id - so that we only process the results for this form */
$monthly_recurring = $_POST['wpforms']['fields'][1]; /* The id for the field you want to use in calculation */
$ad_spent_month = $_POST['wpforms']['fields'][2]; /* The id for the field you want to use in calculation */
$total_budget = $_POST['wpforms']['fields'][3]; /* The id for the field you want to use in calculation */
$calculation = ($monthly_recurring * $ad_spent_month) / $total_budget;
return $calculation;
}
else {
@danharper
danharper / background.js
Last active February 13, 2026 12:47
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});