Skip to content

Instantly share code, notes, and snippets.

@iczero
Created June 28, 2023 20:35
Show Gist options
  • Save iczero/30cb9930bff92ff5cf55d492ada69d77 to your computer and use it in GitHub Desktop.
Save iczero/30cb9930bff92ff5cf55d492ada69d77 to your computer and use it in GitHub Desktop.
// fix encoding (utf-8 misinterpreted as latin1)
derp=(s,...n)=>n.map(v=>v.wholeText?v.data=s(v.data):derp(s,...v.childNodes));derp(s => (new TextDecoder).decode(new Uint8Array(s.split('').map(c => c.charCodeAt(0)))), document.body)
// rewrite entire page to derp
derp=(s,...n)=>n.map(v=>v.wholeText?v.data=s(v.data):derp(s,...v.childNodes));derp(s=>s.replace(/\w+/g,'derp'),document.body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment