Skip to content

Instantly share code, notes, and snippets.

@Axel-Erfurt
Axel-Erfurt / ExclusiveRadio.m3u
Last active October 27, 2024 17:32
Exclusive Radio Channels
#EXTM3U
#EXTINF:1,Blues
http://streaming.exclusive.radio/er/blues/icecast.audio
#EXTINF:2,Calm
http://streaming.exclusive.radio/er/calm/icecast.audio
#EXTINF:3,Chart
http://streaming.exclusive.radio/er/chart/icecast.audio
#EXTINF:4,Classical
http://streaming.exclusive.radio/er/classical/icecast.audio
#EXTINF:5,Country
@WillBrubaker
WillBrubaker / file.php
Last active March 23, 2021 22:44
Override default stock message by product id
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
//BTC Donations to: bc1qc2s60yct2aqza4r7ryweheepd8xa8wqpfgdhg3
add_filter( 'woocommerce_get_availability_text', 'handsome_bearded_guy_availability_text', 10, 2 );
function handsome_bearded_guy_availability_text( $availability, $product ) {
$oos_replacement_messages = array(//the product id is the array key and the value is the replacement message
3871 => 'Here on Thursday',
3870 => 'on back order',
);
@saqpsaqp
saqpsaqp / install_cwp_server.md
Created September 4, 2019 03:19
Install CWP Server

Install CWP Server - CentOS 7

Prepare server

sudo su
yum update -y
yun install nano
hostnamectl set-hostname xyz.com
echo 127.0.0.1 xyz.com >> /etc/hosts
swapon -s
dd if=/dev/zero of=/swapfile count=2048 bs=1MiB
@WillBrubaker
WillBrubaker / file.php
Created December 6, 2018 14:19
Remove add to cart button from products that do not have stock
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'woocommerce_loop_add_to_cart_link', 'handsome_bearded_guy_maybe_remove_add_to_cart_button' );
function handsome_bearded_guy_maybe_remove_add_to_cart_button( $html ) {
global $product;
if ( 'simple' === $product->get_type() && ! $product->get_stock_quantity() ) {
return null;
}
return $html;
}
@WillBrubaker
WillBrubaker / file.php
Last active February 6, 2021 07:35
Add UAE Emirates to WooCommerce
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'woocommerce_states', 'add_uae_emirates' );
function add_uae_emirates( $states ) {
$states['AE'] = array(
'AZ' => __( 'Abu Dhabi', 'woocommerce' ),
'AJ' => __( 'Ajman', 'woocommerce' ),
'FU' => __( 'Fujairah', 'woocommerce' ),
'SH' => __( 'Sharjah', 'woocommerce' ),
'DU' => __( 'Dubai', 'woocommerce' ),
@butlerblog
butlerblog / functions.php
Last active September 24, 2024 21:50
SMTP using wp-config.php for settings #smtp #wp_mail
<?php // Don't use this line.
/*
* Add the script below to wherever you store custom code snippets
* in your site, whether that's your child theme's functions.php,
* a custom plugin file, or through a code snippet plugin.
*/
/**
* This function will connect wp_mail to your authenticated
I
a
aa
aaa
aac
aaliyah
aaron
ab
aba
abandon
@fevangelou
fevangelou / default.vcl_PREFACE.md
Last active October 29, 2024 18:39
The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

Updated on December 15th, 2021

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 180 sec (3 minute) cache time for cacheable content that does not have the correct cache-control HTTP headers. You can safely increase this to 300 sec (or more) for less busier sites or drop it to 60 sec or even 30 sec for high traffic sites. It obviously depends on your use case.

@ScottKaye
ScottKaye / Hide URL Parameters.js
Last active August 24, 2024 12:24
Hide URL parameters using Javascript's history.replaceState methods. The server (PHP or whatever) will still see it of course, but this script will quickly 'hide' the parameters. Don't use this to hide anything sensitive - there shouldn't be anything sensitive in GET anyway, but I use this to hide various un-pretty things like ?error=invalidPass…
function getURLParameter(name) {
return decodeURI((RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]);
}
function hideURLParams() {
//Parameters to hide (ie ?success=value, ?error=value, etc)
var hide = ['success','error'];
for(var h in hide) {
if(getURLParameter(h)) {
history.replaceState(null, document.getElementsByTagName("title")[0].innerHTML, window.location.pathname);
}
@tonious
tonious / namecheck.sh
Created July 24, 2012 17:21
A domain name expiry checker.
#!/bin/bash
whoisfile="/tmp/namecheck.whois.$$.txt"
listfile="/tmp/namecheck.list.$$.txt"
trap "cleanup; exit 1" SIGINT SIGTERM
# Clean up temporary files.
function cleanup {
rm -f $whoisfile $listfile