This file contains 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
// Sets reply-to if it doesn't exist already. | |
add_filter( 'wp_mail', 'wp_mail_filter_set_reply_to' ); | |
function wp_mail_filter_set_reply_to( $args ) { | |
if (!isset($args['headers'])) { | |
$args['headers'] = array(); | |
} | |
$headers_ser = serialize($args['headers']); | |
This file contains 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
# Commonly ignored files and directories | |
.DS_Store | |
Thumbs.db | |
desktop.ini | |
# Temporary files | |
*.tmp | |
*.temp | |
*.swp |
This file contains 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
/* | |
* MultipleWiFiWithBackupHotspot.c | |
* | |
* Connect to Multiple Wi-Fi Networks and Set Up a Hotspot as a Backup with ESP8266 | |
* | |
* This is a code example that demonstrates how to connect to multiple Wi-Fi networks and set up a hotspot using an ESP8266 microcontroller. | |
* The code uses the ESP8266WiFi and ESP8266WiFiMulti libraries to add two Wi-Fi networks and attempt to connect to them. | |
* If both networks are unavailable, the code creates a hotspot with the SSID "nodemcu-hotspot" and password "password". | |
* The code is useful for applications where the ESP8266 needs to connect to multiple Wi-Fi networks and have a backup hotspot as a fail-safe mechanism. | |
* |
This file contains 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 | |
HOSTNAME=dynamicdns.tld # Your Dynamic DNS Hostname | |
PORT=22 # SSH Port | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
new_ip=$(host $HOSTNAME | head -n1 | cut -f4 -d ' ') |
This file contains 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 is a sample .env file for use in local development. | |
# Duplicate this file as .env in the root of the project | |
# and update the environment variables to match your | |
# desired config | |
# | |
# See the README for full descriptions of each of the | |
# available configurations. |
This file contains 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
const express = require('express') | |
const app = express() | |
const sessions = require('express-session'); | |
const crypto = require('crypto'); | |
if (app.get('env') === 'production') { | |
session.cookie.secure = true // serve secure cookies | |
} |
This file contains 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
// JavaScript get the file extension | |
function getExtension(filename){ | |
const ext = filename.split('.').pop(); | |
return ext; | |
} |
This file contains 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
// To Only Retrun the Product Count By Category | |
//[woocommerce_product_category_count category="rings"] | |
// Special thanks to CHADREX | |
add_shortcode( 'products-counter', 'products_counter' ); | |
function products_counter( $atts ) { | |
$atts = shortcode_atts( [ | |
'category' => '', | |
], $atts ); | |
$taxonomy = 'product_cat'; |
This file contains 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
function buddy_exclude_users_by_role( $args ) { | |
// do not exclude in admin. | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { | |
return $args; | |
} | |
$excluded = isset( $args['exclude'] ) ? $args['exclude'] : array(); | |
if ( ! is_array( $excluded ) ) { | |
$excluded = explode( ',', $excluded ); |
This file contains 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
// hide admin's activities from all activity feeds | |
function ( $a, $activities ) { | |
// ... but allow admin to see his activities! | |
if ( is_super_admin() ) | |
return $activities; | |
foreach ( $activities->activities as $key => $activity ) { | |
// ID's to exclude, separated by commas. ID 1 is always the superadmin | |
if ( $activity->user_id == 1 ) { |
NewerOlder