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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>+++ operator #jsbench #jsperf</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
timeout: do -> | |
# helpers | |
tick = (promise, ms, callback) -> !-> # {{{ | |
# invoke and check the result | |
if callback and callback! | |
# continue | |
# re-create a timer | |
promise.timer = setTimeout (tick promise, ms, callback), ms | |
else | |
# finish |
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
# фильтр для ленивой загрузки <iframe> | |
add_filter('embed_oembed_html', function($html) { | |
# проверим что это iframe | |
if (stripos($html, '<iframe') === false) { | |
return $html; | |
} | |
# проверим наличие источника | |
if (($a = strpos($html, ' src=')) === false) { | |
return $html; | |
} |