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 numberToPersian(number) { | |
let numberToString = number.toString(); | |
let result = ""; | |
const farsiDigits = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"]; | |
if (numberToString.length >= 4) { | |
let toPersian = numberToString | |
.split("") | |
.map((x) => farsiDigits[x]) | |
.join(""); |
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
// with thousand separator | |
const convertToPersianDigits = (number) => number.toLocaleString('fa-IR') | |
// without thousand separator | |
const convertToPersianDigitsNoDec = (string) => string.toLocaleString('fa-IR', {useGrouping: false}) | |
// Keep non numeric characters intact and convert english digits to persian | |
function convertToPersianDigits(input) { | |
// Convert input to a string | |
input = input.toString(); |
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
const url = new URL(window.location); | |
url.searchParams.set('someQueryParameter', 'someValue'); | |
window.history.pushState(null, '', url.toString()); |
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 | |
require __DIR__ . '/vendor/autoload.php'; | |
use Automattic\WooCommerce\Client; | |
$woocommerce = new Client( | |
'https://example.com', | |
'ck_xxxxxxxxxxxxxxxxxxxx', | |
'cs_xxxxxxxxxxxxxxxxxxxx', | |
[ |
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
[opcache] | |
; Determines if Zend OPCache is enabled | |
opcache.enable=1 | |
; Determines if Zend OPCache is enabled for the CLI version of PHP | |
;opcache.enable_cli=1 | |
; The OPcache shared memory storage size. | |
opcache.memory_consumption=768 |
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 | |
/** | |
* get files in folders and subfolders with $extensions extensions in $path. | |
* @param array $extentios | |
* @param string $path optinal. default is path of execution directory | |
*/ | |
//default path is current directory and sub directories | |
function listFolderFiles($extensions ,$path = '.') | |
{ | |
//files to count line numbers sort in $files |