Skip to content

Instantly share code, notes, and snippets.

View jkarttunen's full-sized avatar

Juha Karttunen jkarttunen

View GitHub Profile
@jkarttunen
jkarttunen / visualize-stacking-contexts.js
Created February 7, 2021 08:07 — forked from tlrobinson/visualize-stacking-contexts.js
Some console output to help you visualise stacking contexts on a page (no jquery)
/*
Usage:
* Paste this into your dev tools console (or even better as a snippet)
* It will parse the page and find all the things that create a new stacking context
and dump some info about them to the console. It will also outline them on the page.
* This is pretty rough and probably misses heaps of bugs and edge cases.
*/
function highlight(el) {
@jkarttunen
jkarttunen / base64.js
Last active August 29, 2015 14:19 — forked from chrisveness/base64.js
/**
* Encode string into Base64, as defined by RFC 4648 [http://tools.ietf.org/html/rfc4648].
* As per RFC 4648, no newlines are added.
*
* Characters in str must be within ISO-8859-1 with Unicode code point <= 256.
*
* Can be achieved JavaScript with btoa(), but this approach may be useful in other languages.
*
* @param {string} str ASCII/ISO-8859-1 string to be encoded as base-64.
* @returns {string} Base64-encoded string.