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
| @echo off | |
| setlocal enabledelayedexpansion | |
| :: Prompt user for the folder name | |
| set /p foldername="Enter the folder name to save files to: " | |
| if not exist "%foldername%" mkdir "%foldername%" | |
| :: Prompt user for the string to remove from filenames | |
| set /p removestring="Enter the string to remove from filenames (e.g., sigma-): " |
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
| function extractYouTubeID($url) { | |
| $pattern = '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)|embed/|v/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i'; | |
| preg_match($pattern, $url, $matches); | |
| return $matches[1] ?? null; | |
| } | |
| /* | |
| Here is a quick test of all supported YouTube URL types. | |
| $urls = [ | |
| 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', |
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
| function formatIndianCurrency($number) { | |
| // Step 0: Check if the number is negative | |
| $isNegativeNumber = false; | |
| if ($number < 0) { | |
| $isNegativeNumber = true; | |
| $number = abs($number); | |
| } | |
| // Step 1: Check for decimal point | |
| if (strpos($number, '.') !== 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
| You can use a variety of special tokens with SendKeys to simulate different keys and key combinations. Here's a list of some commonly used special tokens: | |
| {ENTER}: Enter key. | |
| {TAB}: Tab key. | |
| {ESC}: Escape key. | |
| {BACKSPACE}: Backspace key. | |
| {DELETE}: Delete key. | |
| {INSERT}: Insert key. | |
| {HOME}: Home key. | |
| {END}: End key. |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="button-container"> | |
| <!-- Existing buttons --> | |
| <button id="item1">Item 1</button> | |
| <button id="item2">Item 2</button> |
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
| 'Imports System.Text.RegularExpressions | |
| Private Function IsValidDomainFormat(domainName As String) As Boolean | |
| Dim pattern As String = "^(?![0-9]+$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(?:\.[A-Za-z]{2,})+$" | |
| Dim regex As New Regex(pattern) | |
| Return regex.IsMatch(domainName) | |
| End Function |
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 | |
| // Adds widget: Categories | |
| class RutuCategories_Widget extends WP_Widget { | |
| function __construct() { | |
| parent::__construct( | |
| 'rutu_categories_widget', | |
| esc_html__( 'Rutu Categories', 'mfl' ), | |
| array( 'description' => esc_html__( 'Custom Categories widget.', 'mfl' ), ) // Args |
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 | |
| /* Redirect if there is only one product in the category */ | |
| add_action( 'wp_head', 'woocom_redirect_if_single_product_in_category', 10 ); | |
| function woocom_redirect_if_single_product_in_category() { | |
| global $wp_query; | |
| if (is_product_category()) { | |
| $cat_obj = $wp_query->get_queried_object(); | |
| $catcount = $cat_obj->count; |