X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fseekat;a=blobdiff_plain;f=examples%2Fgistlog.php;fp=examples%2Fgistlog.php;h=455b30d180d6e3a1ca67d5f345a1a1f1b8e82e1f;hp=0000000000000000000000000000000000000000;hb=98264bf4807a1b82ee7d1584ebb73b4bbba58e6e;hpb=c4dee6a78ed1a44f83472b3523bfaa4c53e26161 diff --git a/examples/gistlog.php b/examples/gistlog.php new file mode 100755 index 0000000..455b30d --- /dev/null +++ b/examples/gistlog.php @@ -0,0 +1,30 @@ +#!/usr/bin/env php + "token ".getenv("GUTHUB_TOKEN") +]); + +$api(function($api) { + $gists = yield $api->users->m6w6->gists(); + while ($gists) { + foreach ($gists as $gist) { + foreach ($gist->files as $name => $file) { + if ($name == "blog.md") { + $text = $file->as("raw")->raw();; + $head = $gist->description." ".$gist->created_at; + echo "$head\n"; + echo str_repeat("=", strlen($head))."\n\n"; + echo trim(yield $text); + echo "\n\nThis was my last gistlog, pipe it through \$PAGER if "; + echo "you really want to read it or visit https://gistlog.co/m6w6\n"; + return; + } + } + } + + $gists = yield $gists->next(); + } +});