A Pen by Jack Billstrom on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Jack Billström (jackbillstrom) | |
# Description: Backup and restore MS SQL databases running in docker containers with a "GUI" using gum.sh | |
# Dependencies: gum.sh, docker, dialog | |
# Usage: ./ms_backup_docker.sh | |
# Version: 1.1.0 | |
# Intro | |
gum style --border normal --margin "1" --padding "1 2" --border-foreground 212 "🐋 $(gum style --foreground 212 'ms sql') manager" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.DependencyInjection; | |
using Umbraco.Cms.Core.Composing; | |
using Umbraco.Cms.Core.DependencyInjection; | |
using Vendr.Core.Generators; | |
namespace My.Ecommerce.Web.Compositions; | |
public class CustomComposer : IComposer | |
{ | |
public void Compose(IUmbracoBuilder builder) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE=$(printf '%(%Y-%m-%d)T\n') | |
CONTAINER_NAME="mssql" | |
SA_PASSWORD="PASSWORD" | |
DB_NAMES=("DB1" "DB1") | |
HOME_DIR="/home/ubuntu" | |
backup_database() { | |
for DB_NAME in "${DB_NAMES[@]}"; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code notifies Google Tag Manager when a wpForm is submitted | |
document.addEventListener("DOMContentLoaded", function() { | |
var elementsArray = document.querySelectorAll('[id^="wpforms-form-"]'); | |
elementsArray.forEach(function(elem) { | |
elem.addEventListener("submit", function(e) { | |
window.dataLayer = window.dataLayer || []; | |
window.dataLayer.push({ | |
event: "wpFormSubmit", | |
wpFormElement: event.target | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//AJAX ADD TO CART BUTTON | |
$product_id = 143; | |
if( !my_custom_cart_contains( $product_id ) ) { | |
?> | |
<button class="my-custom-add-to-cart-button" data-product-id="<?php echo $product_id; ?>">add to cart</button> | |
<?php | |
} else { | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple product add to cart | |
* | |
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/simple.php. | |
* | |
* HOWEVER, on occasion WooCommerce will need to update template files and you | |
* (the theme developer) will need to copy the new files to your theme to | |
* maintain compatibility. We try to do this as little as possible, but it does | |
* happen. When this occurs the version of the template file will be bumped and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_customize_rest_cors() { | |
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); | |
add_filter( 'rest_pre_serve_request', function( $value ) { | |
header( 'Access-Control-Allow-Origin: *' ); | |
header( 'Access-Control-Allow-Methods: GET' ); | |
header( 'Access-Control-Allow-Credentials: true' ); | |
header( 'Access-Control-Expose-Headers: Link', false ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This command will be generating a TXT-string you'll need to enter into your "_acme-challenge.example.se" | |
# When the new DNS post is live, you'll want to press ENTER in your shell to complete setup. | |
# My setup is a Debian machine with Apache as Web Server with virtualhosts. | |
sudo certbot-auto --server https://acme-v02.api.letsencrypt.org/directory -d "*.example.se" --preferred-challenges dns-01 certonly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// /product-options-for-woocommerce/Model/Option.php | |
public function saveOptions($productId, $options) { | |
$productId = (int)$productId; | |
// Här kommer alla värden samlas upp efter loopen | |
// tänk på att loopen svarar RAD FÖR RAD | |
$lens_options = array(); |
NewerOlder