Skip to content

Instantly share code, notes, and snippets.

View YavorK's full-sized avatar
🥥

Yavor Kirov YavorK

🥥
View GitHub Profile
@YavorK
YavorK / index.html
Created May 9, 2023 18:58 — forked from edofic/index.html
htmx with a "backend" in service worker
<!DOCTYPE html>
<html>
<head>
<title>Hello Page</title>
<script src="https://unpkg.com/htmx.org@1.9.2"></script>
</head>
<body>
<h1>Hello</h1>
@YavorK
YavorK / sse.html
Last active November 24, 2022 05:45 — forked from Deele/sse.html
Server-Sent Events example, Javascript client-side, PHP server-side
<html>
<body>
<div id="result"></div>
<script>
if (typeof(EventSource) !== 'undefined') {
console.info('Starting connection...');
var source = new EventSource('/stream.php');
source.addEventListener('open', function(e) {
console.info('Connection was opened.');
}, false);
@YavorK
YavorK / service-workers.md
Created October 3, 2018 14:52 — forked from Rich-Harris/service-workers.md
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@YavorK
YavorK / debug.php
Created August 31, 2016 13:46 — forked from eddieajau/debug.php
Printing a clean debug backtrace in PHP.
// PHP < 5.3.6
foreach (debug_backtrace() as $trace)
{
echo sprintf("\n%s:%s %s::%s", $trace['file'], $trace['line'], $trace['class'], $trace['function']);
}
die;
// PHP >= 5.3.6
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
die;