Skip to content

Instantly share code, notes, and snippets.

@pfgithub
Created November 20, 2021 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfgithub/4d035ff8ce719b4008b3b538fca00486 to your computer and use it in GitHub Desktop.
Save pfgithub/4d035ff8ce719b4008b3b538fca00486 to your computer and use it in GitHub Desktop.
\///\/\ /\//\\/\//\ /\\/\//\\ \\// /// //\/\\
{
// /\ / \ \/\ /\/\ /\/ \/ \/\/
//
// / i, /\ a, /\/ n, /\/\ m
// \ i, \/ v, \/\ h, \/\/ w
const swslash = {
a: "/\\", i: "/", m: "/\\/\\", n: "/\\/",
};
const swback = {
i: "\\", h: "\\/\\", v: "\\/", w: "\\/\\/",
};
const matches = (w) => {
mflp: for(const schar of ["/", "\\"]) {
let res = schar;
for(const char of [...w.toLowerCase()]) {
const sl = res.slice(-1) === "/" ? swslash : swback;
if(!sl[char]) continue mflp;
res += sl[char];
}
return res.substr(1);
}
}
console.log(document.body.textContent.split("\n").filter(matches).join("\n"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment