Skip to content

Instantly share code, notes, and snippets.

@ramsey
Last active March 19, 2023 01:52
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 ramsey/d4eae402adde5492a29c6e4c8ced4835 to your computer and use it in GitHub Desktop.
Save ramsey/d4eae402adde5492a29c6e4c8ced4835 to your computer and use it in GitHub Desktop.
List the GitHub Emojis
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/emojis \
> github-emojis.json
php generate-page.php
open github-emojis.html
<?php
$e = htmlentities(...);
$emojis = json_decode(file_get_contents('github-emojis.json'), true);
$emojiTable = '';
foreach ($emojis as $code => $image) {
$emojiTable .= <<<EOD
<tr>
<td width="25%"><img src="{$e($image)}" alt="{$e($code)}" height="50" width="50"></td>
<td><code>:{$e($code)}:</code></td>
</tr>
EOD;
}
$page = <<<EOD
<html>
<head>
<title>GitHub Emojis</title>
</head>
<body>
<h1>GitHub Emojis</h1>
<table width="50%">
{$emojiTable}
</table>
</body>
</html>
EOD;
file_put_contents('github-emojis.html', $page);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment