Skip to content

Instantly share code, notes, and snippets.

@shgysk8zer0
Created November 3, 2015 05:29
Show Gist options
  • Save shgysk8zer0/7c144a4abebceb3e34c1 to your computer and use it in GitHub Desktop.
Save shgysk8zer0/7c144a4abebceb3e34c1 to your computer and use it in GitHub Desktop.
Sample
<?php
$timer = new \shgysk8zer0\Core\Timer();
$console = new \shgysk8zer0\Core\Console();
$header = new \shgysk8zer0\Core\Headers();
$html = new \shgysk8zer0\DOM\HTML();
$svg = new \shgysk8zer0\DOM\SVG();
$unicode = new \shgysk8zer0\Core\Unicode();
$chars = new \shgysk8zer0\Core\ArrayObject([
'BLACK_SUN_WITH_RAYS',
'WHITE_STAR',
'CLOUD',
'THUNDERSTORM',
'FALLING_DIAGONAL_IN_WHITE_CIRCLE_IN_BLACK_SQUARE'
]);
$files = new \shgysk8zer0\Core\ArrayObject(get_included_files());
$circle = $svg->createElement('circle');
$console->asErrorHandler(E_ALL);
$console->asExceptionHandler();
$svg->viewport('0 0 100 100')->width(100)->height(100);
$circle->cx(50)->cy(50)->r(40)->stroke('black')->fill('green')->stroke_width(3);
$svg->documentElement->appendChild($circle);
$html->head->append('title', 'Emoji Test');
$html->head->append('link', null, [
'rel' => 'icon',
'href' => 'data:image/svg+xml;base64,' . base64_encode("$svg"),
'type' => 'image/svg+xml',
'sizes' => 'any'
]);
$html->body->append('h3', 'Unicode chars.');
$chars->reduce(function(\DOMElement $list, $char) use ($unicode)
{
$list->append('li', "{$char}: {$unicode->$char}");
return $list;
},
$html->body->append('ul')
);
$html->body->append('h3', 'Included files.');
$files->reduce(
function(\DOMElement $list, $item)
{
$list->append('li', $item);
return $list;
},
$html->body->append('ol')
);
$html->body->append('h3', sprintf('Code used in %s', __FILE__));
$html->body->append('pre')->importHTML(highlight_file(__FILE__, true));
$html->body->append('samp', "Generated in $timer seconds.");
exit($html);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment