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 | |
//поиск строки, где нет title= | |
<a (?![^>]*title=".+?").*?\/> | |
// preg_replace("#(</?\w+)(?:\s(?:[^<>/]|/[^<>])*)?(/?>)#ui", '$1$2', $html); | |
// \w+(?<!href|title|alt|height|width|src)=".+?" | |
// <([a-z][a-z0-9]*)(?:[^>]*(\shref=['\"][^'\"]*['\"]))?[^>]*?(\/?)> <$1$2$3> |
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 | |
preg_replace("/http:\/\/.*?\//", "", $string); | |
preg_replace("@^https?://[^/]+/@", "", $string); | |
//delete all attribute html | |
preg_replace("#(</?\w+)(?:\s(?:[^<>/]|/[^<>])*)?(/?>)#ui", '$1$2', $html); | |
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
<div class="slider"> | |
<div class="slide">your content</div> | |
<div class="slide">your content</div> | |
<div class="slide">your content</div> | |
<div> | |
<h1>ignore me</h1> | |
</div> | |
</div> | |
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
CREATE TABLE `offer`( | |
`_ID` INT NOT NULL, | |
`_IDoffers` INT NOT NULL, | |
`available` VARCHAR(255) NOT NULL, | |
`barcode` VARCHAR(255) NULL, | |
`categoryId` INT NULL, | |
`currencyId` INT NULL, | |
`delivery` INT NULL, | |
`description` TEXT NULL, | |
`id` INT NOT NULL, |
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 | |
function rus2translit($string) { | |
$converter = array( | |
'а' => 'a', 'б' => 'b', 'в' => 'v', | |
'г' => 'g', 'д' => 'd', 'е' => 'e', | |
'ё' => 'e', 'ж' => 'zh', 'з' => 'z', | |
'и' => 'i', 'й' => 'y', 'к' => 'k', | |
'л' => 'l', 'м' => 'm', 'н' => 'n', | |
'о' => 'o', 'п' => 'p', 'р' => 'r', | |
'с' => 's', 'т' => 't', 'у' => 'u', |
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 | |
$regex = '#(https?://[a-z0-9.?=+_-]*)#i'; | |
$res = preg_split($regex, $string, -1, PREG_SPLIT_NO_EMPTY); |
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
if (element.firstChild) { | |
// It has at least one | |
} | |
if (element.hasChildNodes()) { | |
// It has at least one | |
} | |
if (element.childNodes.length > 0) { // Or just `if (element.childNodes.length)` | |
// It has at least one |
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
import React, { useLayoutEffect, useState } from 'react'; | |
function useWindowSize() { | |
const [size, setSize] = useState([0, 0]); | |
useLayoutEffect(() => { | |
function updateSize() { | |
setSize([window.innerWidth, window.innerHeight]); | |
} | |
window.addEventListener('resize', updateSize); | |
updateSize(); |
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
MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
var observer = new MutationObserver(function(mutations, observer) { | |
// fired when a mutation occurs | |
console.log(mutations, observer); | |
// ... | |
}); | |
// define what element should be observed by the observer | |
// and what types of mutations trigger the callback |