update to PHP-8.1
[m6w6/seekat] / examples / gistlog.php
1 #!/usr/bin/env php
2 <?php
3 $api = include "examples.inc";
4
5 $api(function($api) {
6 $gists = yield $api->users->m6w6->gists();
7 while ($gists) {
8 $next = \seekat\API\Links\next($gists);
9
10 foreach ($gists as $gist) {
11 foreach ($gist->files as $name => $file) {
12 if ($name == "blog.md") {
13 $text = $file->raw();
14 $head = $gist->description." ".$gist->created_at;
15 echo "$head\n";
16 echo str_repeat("=", strlen($head))."\n\n";
17 echo trim(yield $text);
18 echo "\n\nThis was my last gistlog, pipe it through \$PAGER if ";
19 echo "you really want to read it or visit https://gistlog.co/m6w6\n";
20 return;
21 }
22 }
23 }
24
25 $gists = yield $next;
26 }
27 });