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
//Output with default params: 1 14 15 [16] 17 18 25 | |
function generatePagination(url = "#", totalPages = 25, limitPerSide = 2, current = 16, showFirst = true, showLast = true) { | |
var output = ""; | |
var hasFirst = false; | |
var hasLast = false; | |
if ( current === 1 ) { | |
hasFirst = true; | |
} |
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
<?php | |
$month_ru = array('Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'); | |
$month_tj = array('Январ', 'Феврал', 'Март', 'Апрел', 'Май', 'Июн', 'Июл', 'Август', 'Сентябр', 'Октябр', 'Ноябр', 'Декабр'); | |
$month_en = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); | |
?> |
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
lvl1: boJ9jbbUNNfktd78OOpsqOltutMc3MY1 | |
lvl2: CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9 | |
lvl3: UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK | |
lvl4: pIwrPrtPN36QITSp3EQaw936yaFoFgAB | |
lvl5: koReBOKuIDDepwhWk7jZC0RTdopnAYKh | |
lvl6: DXjZPULLxYr17uwoI01bNLQbtFemEgo7 | |
lvl7: HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs | |
lvl8: cvX2JJa4CFALtqS87jk27qwqGhBM9plV | |
lvl9: UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR | |
lvl10: truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk |
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/systemctl status mariadb || systemctl restart mariadb |
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
<?php | |
/* post type: mytype (custom) */ | |
/* | |
*change limit of 100 per page | |
*изменения лимита | |
*/ | |
add_filter( 'rest_mytype_collection_params', 'limit_change_ph_gos_per_page', 10, 1 ); | |
function limit_change_ph_gos_per_page( $params ) { |
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
String dateString = null; | |
String dtStart = "2018-06-23T16:52:13"; // before/до | |
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH); // pattern/шаблон English locale/Английская локализация | |
try { | |
Date c_date = format.parse(dtStart); | |
Long newDate = c_date.getTime() + 18000000; // add 5 hours in ms / добавить 5 часов в мс --> (GMT+5) | |
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm dd MMMM, yyyy", new Locale("ru")); // new pattern/новый шаблон new Russian locale/новая русская локализация | |
dateString = formatter.format(new Date(newDate)); | |
} catch(ParseException e) { |
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
<?php | |
function getNumberEnding($number, $variations) { | |
$cases = array(2, 0, 1, 1, 1, 2); | |
return $variations[($number % 100 > 4 && $number % 100 < 20) ? 2 : $cases[min($number % 10, 5)]]; | |
} | |
echo getNumberEnding(733, array('рубль', 'рубля', 'рублей')); | |
?> |
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
<?php | |
include("wp-load.php"); | |
$val_to_search = 2824; | |
$args = array( | |
'post_type' => 'projects', | |
'posts_per_page' => 5, | |
'meta_key' => 'field_name', // post object | |
'meta_value' => $val_to_search |
NewerOlder