Skip to content

Instantly share code, notes, and snippets.

@determin1st
determin1st / index.html
Last active September 10, 2020 09:56
+++ operator #jsbench #jsperf (http://jsbench.github.io/#482b62ecdddfeffcea89d30ded47adb6) #jsbench #jsperf
<!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>
@determin1st
determin1st / timeout.ls
Last active March 25, 2020 10:40
setTimeout wrapper (w3ui)
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
@determin1st
determin1st / functions.php
Created September 21, 2019 15:50
ленивая загрузка <iframe> для темы WordPress
# фильтр для ленивой загрузки <iframe>
add_filter('embed_oembed_html', function($html) {
# проверим что это iframe
if (stripos($html, '<iframe') === false) {
return $html;
}
# проверим наличие источника
if (($a = strpos($html, ' src=')) === false) {
return $html;
}