Skip to content

Instantly share code, notes, and snippets.

View notabene's full-sized avatar
🦄
Everywhere at once

Stephane Deschamps notabene

🦄
Everywhere at once
View GitHub Profile
@enwin
enwin / sticky-focus.js
Last active May 17, 2022 13:11
Detect and change the scroll position when a focused element is under a sticky element
// sticky element
var stickyHeader = document.querySelector( '.intro-banner' );
function handleFocus( e ){
// don't try to change the scroll if the focused element is in the sticky element
if( stickyHeader.contains( e.target )){
return;
}
// quick & dirty client height on each focus
@adactio
adactio / webmention.php
Last active July 9, 2025 04:28
Minimum viable webmention in PHP.
<?php
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
# http://creativecommons.org/publicdomain/zero/1.0/
if (!isset($_POST['source']) || !isset($_POST['target'])) {
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
exit;
}