Skip to content

Instantly share code, notes, and snippets.

View kepawni's full-sized avatar

Ailis Kepawni kepawni

  • European Union
View GitHub Profile
@kepawni
kepawni / accessible-navigation-css-only.html
Created March 11, 2022 01:43
An accessible, responsive burger menu navigation with skip links and only HTML and CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* { margin: 0; padding: 0 }
body { margin: 0 1rem }
header, main, footer { margin: 1rem 0 }
blockquote, dl, figure, hr, menu, ol, p, pre, table, ul { margin: 1rem 0 }
@kepawni
kepawni / SimpleJWT.php
Created February 9, 2022 09:08
Simple, dependency-free, HS256-based JWT implementation for PHP 8.1 and below.
/**
* Create and validate JWT tokens based on HS256 (HMAC with SHA-256) without requiring any particular PHP extensions or
* 3rd party libraries. Works with PHP 8.1 and below. Supports issuer and timestamp validation, result memoization and
* access to the payload. Have a look at the other great libraries out there, but if you need to validate self-issued
* access tokens and want to keep it simple, this one might be just right.
*/
class SimpleJWT
{
private array $data = [];
private string $header;
@kepawni
kepawni / fibonacci-binet.js
Last active March 5, 2022 19:59
A non-recursive, ultra-fast and “code-golf”ily condensed Fibonacci implementation based on Binet's formula, which uses currification to avoid any internal variable declarations.
const fib=(a=>(b=>n=>(c=>(c+(n%2||-1)/c)/a)(b**n))((1+a)/2))(5**.5);
// works up to fib(1474) before only returning Infinity
@kepawni
kepawni / bookmarklet-random-pronounceable.js
Last active October 15, 2021 07:19
A bookmarklet that pops up a browser prompt with a random pronounceable word until you hit Esc or Cancel.
javascript:void((m=>{while(prompt('',[,,,,,,].fill(0).map(a=>((a,b,c,d)=>d(b).replace('q','qu')+d(a)+d(c))(...['aeiouyaeioueo','bcdghjkpqtvwzbcdgkpt','flmnrsxflmnrslmnrs'].map(s=>s.split('')),a=>a[m.floor(m.random()*a.length)])).join('')));})(Math))