Skip to content

Instantly share code, notes, and snippets.

@lewdev
Last active September 8, 2023 09:48
Show Gist options
  • Select an option

  • Save lewdev/243b1a23b30c26c50bc3d7859ad3af60 to your computer and use it in GitHub Desktop.

Select an option

Save lewdev/243b1a23b30c26c50bc3d7859ad3af60 to your computer and use it in GitHub Desktop.
πŸ“ƒ View Emojis and HTML Entities

πŸ”Ž View Emojis, HTML Entities, 3-hex colors

See all Emojis

data:text/html,<body id=o onload="for(i=0x1f1e6;i<0x1F6FF;i++)if(i<0x1F200||i>0x1F2FF)o.innerHTML+=String.fromCodePoint(i)+' '">

See all HTML entities

data:text/html,<body id=o onload="for(i=0x2190;i<0x25BC;i++)o.innerHTML+=String.fromCodePoint(i)+' '">

See Larger set of HTML Entities

data:text/html,<body id=o onload="for(i=0x2090;i<0x2BF0;i++)o.innerHTML+=String.fromCodePoint(i)+' '+i+'<br>'">

See Emoji as buttons to copy to clipboard

data:text/html,<body id=o onload="for(i=0x1f1e6;i<0x1F6FF;i++)if(i<0x1F200||i>0x1F2FF)o.innerHTML+=`<button onclick='p.value=this.innerHTML;p.select();document.execCommand\`copy\`;return 0'>${String.fromCodePoint(i)}</button> `"><input id=p style=width:0>

See Playing cards

This stores the cards into an array if you want to use it.

data:text/html,<body id=o style=font:1in" onload="d=[];z=127137;for(i=z;i<z+64;i++){e=(i-z)%2516;if(e<14&&e!=11)d.push(String.fromCodePoint(i))}o.innerHTML=d.join``">

🎨 3-hex color chart

<table><tbody id=o></tbody></table>
<script>
s="0123456789ABCDEF";
r=c=>[c+c+c,c+"FF","FF"+c,"F"+c+"F",c+"00","00"+c,"0"+c+"0",
c+c+"F",c+c+"0",c+"0"+c,"F"+c+c,"0"+c+c,];
o.innerHTML = new Array(16).fill().map((_,i)=>`<tr>${r(s[i]).map(f=>`<td bgcolor=#${f}>#${f}</td>`).join``}</tr>`).join``;
</script>

🎨 3-hex color chart Bookmarklet

data:text/html,<body onload="s='0123456789ABCDEF';r=c=>[c+c+c,c+'FF','FF'+c,'F'+c+'F',c+'00','00'+c,'0'+c+'0',c+c+'F',c+c+'0',c+'0'+c,'F'+c+c,'0'+c+c,];o.innerHTML = new Array(16).fill().map((_,i)=>`<tr>${r(s[i]).map(f=>`<td bgcolor=%23${f}>%23${f}</td>`).join``}</tr>`).join``"><table><tbody id=o>

Building a deck of cards

<pre id=o></pre>
<script>
const getDeck = () => {
  const cards = [];
  const CHAR_CODE_START = 127137;
  for (let i = CHAR_CODE_START; i < CHAR_CODE_START + 64; i++) {
    const num = (i - CHAR_CODE_START) % 16;
    const suitNum = ~~((i - CHAR_CODE_START) / 16);
    if (num < 14 && num != 11) {
      cards.push({
        c: String.fromCodePoint(i),
        s: "shdc"[suitNum],
        n: num + (num > 13 ? 0 : 1),
      });
    }
  }
  return cards;
};

o.innerHTML = JSON.stringify(getDeck(), 0, 2);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment