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 | |
$someValue = isset( $_REQUEST[ 'VALUE' ] ) ? htmlspecialchars( $_REQUEST[ 'VALUE' ], ENT_QUOTES, 'utf-8' ) : ''; | |
?> |
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
# Put '); before EOL | |
# CTRL+H, Regular Expression is checked | |
Find what: (\r\n) | |
Replace with: '\);\1 | |
# Put INSERT INTO table VALUES( before every digits at the beginning of the line | |
Find what: ^(\d+) | |
Replace with: INSERT INTO table VALUES\(\1 |
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
SELECT | |
iar_d AS date_5_num, /* numbers like: 40479, 40298, 39038, 41075 */ | |
DATE('1899-12-30') + INTERVAL iar_d DAY AS normal_date /* converted dates */ | |
FROM registry_private_clinics | |
WHERE iar_d REGEXP '^[0-9]{5}$' /* only rows with NNNNN format, where N is [0-9] */ |
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
INSERT INTO other_table (num, c_date) | |
SELECT lic_num, STR_TO_DATE(lic_date,'%d.%m.%Y') /* converts date from %d.%m.%Y to %Y-%m-%d format */ | |
FROM my_table |
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
SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2); /* 'www.mysql' */ | |
SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2); /* 'mysql.com' */ | |
/* split by 'ва' case-insensetively, and convert last date value to mysql date */ | |
SELECT STR_TO_DATE(SUBSTRING_INDEX(LOWER('30.11.2010 ва 01.11.2011'),'ва',-1),'%d.%m.%Y'); /* '2011-11-01' */ |
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 | |
// By default navigation bar looks like this: | |
// Начало | Пред. | 1 2 3 4 5 6 7 8 9 10 | След. | Конец | Все | |
$result->nPageWindow = 5; // CDBResult object | |
// Now navigation bar looks like this: | |
// Начало | Пред. | 1 2 3 4 5 | След. | Конец | Все |
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
<? | |
// выводит текущую дату в формате текущего сайта | |
echo date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), time()); | |
// Возвращает формат времени, указанный в настройках сайта. | |
echo $GLOBALS["DB"]->DateFormatToPHP( CSite::GetTimeFormat() ); | |
?> |
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
<? | |
CUtil::InitJSCore( array( 'window' ) ); // load Bitrix's window library | |
$APPLICATION->AddHeadScript( '/js/jquery.min.js' ); // load jQuery | |
?> | |
<? ob_start(); // start capturing HTML output ?> | |
<p>Some HTML content...</p> | |
<? | |
$content = ob_get_contents(); // save output info variable | |
$content = str_replace( array( "\n", "\r" ), '', $content ); // remove EOL-s - content: attribute of the BX.CDialog() requires that! |
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
jQuery(document).ready(function(){ | |
var path = window.location.pathname; | |
var pathName = path.substring(0, path.lastIndexOf('/') + 1); | |
console.log(path); // get current path, for ex: '/index.php', '/docs/pdf/detail.php' | |
console.log(pathName); // for ex: '/index.php'=>'/', '/docs/pdf/detail.php'=>'/docs/pdf/' | |
}); |
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
jQuery(document).ready(function () { | |
var myElem = $('a.myClass'), | |
txt="hello", | |
longText="some very very long text with /hello/world/, wow", | |
pattern = '\/' + txt + '\/',// build regexp pettern on the fly, pattern=/\/hello\// | |
rx = new RegExp(pattern, 'i'); // create regexp object | |
if (rx.test(longText)) { // test - is there /hello/ in longText? | |
myElem.trigger('hover'); // if there is, change state of the <a class"myClass"> to <a class"myClass:hover"> | |
} | |
}); |