Last active
March 19, 2023 01:52
-
-
Save ramsey/d4eae402adde5492a29c6e4c8ced4835 to your computer and use it in GitHub Desktop.
List the GitHub Emojis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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