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
{ Created it because I found that defining the columns at design time isn't much productive. | |
Usage: | |
Consider CustomersBindingScope is a TBindScope and CustomersGrid is a TStringGrid, and | |
CustomerBindingScope.DataObject points to a TList<TCustomer> and TCustomer is declared as | |
follow: | |
type | |
TCustomer = class | |
public | |
property Name: String read FName write FName; | |
property Age: Integer read FAge write FAge; |
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 //r3code::Не допускать индексации страниц 2,3 и т.д. где содержимое группы разделено на несколько страниц (SEO) | |
$objectPresent = is_object(Core_Page::instance()->object); | |
$objClassName = get_class(Core_Page::instance()->object); | |
$isPagedSource = ($objClassName == 'Shop_Controller_Show' || $objClassName == 'Informationsystem_Controller_Show'); | |
$notFirstPage= Core_Page::instance()->object->page > 0; // // Первая страница - 0 | |
if ( $objectPresent && $isPagedSource && $notFirstPage ) | |
{ | |
// Запретить индексацию страниц с url /page-N/, но разрешить обход для сбора ссылок | |
?> <meta name="robots" content="noindex, follow"><?php | |
echo PHP_EOL; |
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
# Блокировка XSS | |
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] | |
# Блокируем выставление переменной PHP GLOBALS через URL | |
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] | |
# Блокируем возможность изменять переменную _REQUEST через URL | |
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) | |
# Блокировка MySQL инъекций, RFI, base64, и др. | |
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR] | |
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR] |
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 | |
// report blocked requests | |
// @ https://perishablepress.com/detect-attacks-php-htaccess/ | |
// | |
// redirect bad requests with htaccess rule | |
// RewriteRule (.*) /path/to/notify-bad-requests.php?6g_1=%1&6g_2=%2&6g_3=%3 [R=302,L] | |
$email = '[email protected]'; | |
$subject = 'Blocked Request Report'; |
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 | |
/* | |
See original source at https://habrahabr.ru/post/332580/ | |
Create bomb file in Linux with: dd if=/dev/zero bs=1M count=10240 | gzip > 10G.gzip | |
Bomb must be GZIP compressed | |
*/ | |
$bomb_file_path = '10G.gzip'; // path to a HUGE file, same folder as it's script | |
/* // Uncomment to enable |
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 // Горячие предложения / расчет (вставить сверху шаблона) | |
if (class_exists('shop')) | |
{ | |
$shop = & singleton('shop'); | |
$shop_id = 1; | |
$param_offer = array(); | |
// Товары выбираем из всех групп | |
$param_offer['current_group_id'] = false; | |
// Выводим по 4 товара в блока | |
$param_offer['items_on_page'] = 4; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE xsl:stylesheet> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/> | |
<!-- МагазинКаталогТоваровНаГлавнойСпецПред --> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="/shop"/> | |
</xsl:template> | |
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
# Password protect for site.ru while in DEV | |
SetEnvIf host ^site\.ru$ noauth=1 | |
SetEnvIf host ^www\.site\.ru$ noauth=1 | |
# Put your password auth stuff here | |
AuthName 'Restricted Area site.ru' | |
AuthType Basic | |
AuthUserFile /path/to/.authfile | |
Require valid-user |
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
// # Making our JS code more clear | |
// Based on https://codepen.io/dongguangming/pen/bNjzzw | |
// -------------------------------------------------------------- | |
// | |
// ## 1. Initial code. Bad practice. | |
// | |
// * Mixed IO and data processing all in one place. | |
// * It is not self-documenting, as it is not clear at-a-glance what is happening inside it. | |
// * It can not be easily unit tested as it has side-effects (e.g. API calls) mixed in with its output logic. | |
// |
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
// https://codepen.io/anon/pen/mjJMOy | |
<div id="graph"></div> | |
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
document.addEventListener('DOMContentLoaded', function() { | |
var container = document.querySelector('#graph'); | |
var data = { | |
nodes: [ |
OlderNewer