Skip to content

Instantly share code, notes, and snippets.

View cdsaenz's full-sized avatar

charly cdsaenz

View GitHub Profile
@GAS85
GAS85 / http2_apache2_ubuntu20.04.md
Last active April 2, 2025 16:19
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 20.04

Based on https://gist.github.com/GAS85/8dadbcb3c9a7ecbcb6705530c1252831

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 20.04 running Apache 2.4.xx.
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.

Step 1: Install Apache2

Per default it will be apache2 version 2.4.41 what is enought for http2 support.

@cartpauj
cartpauj / mepr-stop-23-59-59-utc-expires-at.php
Last active July 30, 2024 22:50
Stop MemberPress from setting transaction expires dates to 23:59:59 UTC+0
<?php
// This will set the expires at hour, minute, second to the same hour, minute, second when the user joined.
function update_txn_expires_at($txn, $old_txn = false) {
global $wpdb;
if(!isset($txn->id) || (int)$txn->id <=0 || $txn->expires_at == '0000-00-00 00:00:00') { return; }
$expires_at_ts = strtotime($txn->expires_at);
$created_at_ts = strtotime($txn->created_at);
@AmmarCodes
AmmarCodes / README.md
Last active March 20, 2024 21:04
WordPress: link to specific elementor tab on a specific page

It's a quick ad-hoc solution to allow you to link to your page to a specific tab from elementor tabs widget.

Here's the catch, you need to replace the id of the specific tab you want to use to not contain the title- part.

Use https://your-website/#elementor-tab-1515

instead of: https://your-website/#elementor-tab-title-1515

@helgatheviking
helgatheviking / class-wc-kia-class-email.php
Last active August 6, 2024 03:08
Send a WooCommerce Customer email from the Order Admin Actions
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! class_exists( 'WC_KIA_Class_Email', false ) ) :
/**
* A custom Order WooCommerce Email class
*
* @since 0.1
* @extends \WC_Email
@danieldogeanu
danieldogeanu / MakePowerShellRememberSSHPassphrase.md
Last active May 2, 2025 14:52
How to make Powershell remember the SSH key passphrase.

You should not use the Open SSH client that comes with Git for Windows. Instead, Windows 10 has its own implementation of Open SSH that is integrated with the system. To achieve this:

  1. Start the ssh-agent from Windows Services:
  • Type Services in the Start Menu or Win+R and then type services.msc to launch the Services window;
  • Find the OpenSSH Authentication Agent in the list and double click on it;
  • In the OpenSSH Authentication Agent Properties window that appears, choose Automatic from the Startup type: dropdown and click Start from Service status:. Make sure it now says Service status: Running.
  1. Configure Git to use the Windows 10 implementation of OpenSSH by issuing the following command in Powershell:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
@jonathanbossenger
jonathanbossenger / sitesetup.sh
Last active April 25, 2024 23:13
Bash script to automatically provision LAMP sites
#!/bin/bash
# Bash script to set up local site using LAMP on Ubuntu
# Requires Apache2, MySQL, mkcert (https://github.com/FiloSottile/mkcert)
# See also sitedrop.sh https://gist.github.com/jonathanbossenger/4950e107b0004a8ee82aae8b123cce58
HOME_USER=jonathan
SSL_CERTS_DIRECTORY=/home/jonathan/ssl-certs
SITES_DIRECTORY=/home/jonathan/development/websites
@zutigrm
zutigrm / cra-sitemap1.js
Last active November 25, 2024 08:09
Sitemap With Create React App
import { sitemapBuilder as buildSitemap } from 'react-router-sitemap';
import routes from '../routes';
import path from 'path'; // add path which will be needed for file write
import fs from 'fs'; // import file system object
// use your website root address here. Optimally you can
// include dev and production enviorenments with variable
const hostname = 'http://localhost:3000';
// define our destination folder and sitemap file name
<?php
add_filter( 'jet-engine/listing/grid/posts-query-args', 'je_custom_listing_order', 10, 2 );
/**
* Add multiple order by paramters to listing grid widget.
*
* What you need t replace:
* - speakers_list - replace this with your custom ID added to Listing widget
* - is-featured, speaker-name - meta fields names we need to sort by.
@carasmo
carasmo / dequeue-woocommerce-js-css-on-non-woo-pages.php
Last active November 26, 2024 15:58
Dequeue WooCommerce CSS and JS on non-WooCommerce pages for 3.6.4
<?php
//don't add above twice if it already exists
/**
* Check if WooCommerce Page of all kinds (not just cart and shop)
* @thanks: https://faish.al/2014/01/06/check-if-it-is-woocommerce-page/
* Checked IDS with WooCommerce Repo 1 June 2019
*/
function ca_is_really_woocommerce_page() {
@cathyxz
cathyxz / srcset-and-sizes.md
Created April 29, 2019 20:52
Srcset and Sizes

Srcset and Sizes

Did some experimentation to figure out how different browsers behave with regards to the srcset and sizes attribute in various browsers. Documented below.

srcset + sizes behavior

Vanilla No AMP No CSS Example: https://codepen.io/cathyxz/pen/vbLrrE

<img srcset="https://placekitten.com/200/200 200w,
 https://placekitten.com/300/300 300w,