See if this helps:
http://bobsguides.com/modx-snippets.html
In this case, I think what you want to do will start with this file:
https://github.com/coryetzkorn/php-store-hours/blob/master/index.php.
Put the php code between the opening and closing php tags (not including the php tags) into a new snippet. Change any 'include' or 'require' lines in the snippet to the actual path of the file. You can use the constants (MODX_ASSETS_PATH, MODX_CORE_PATH, etc.) in the path.
Change *all* echo and print statements to add to the $output variable and return $output at the end of the snippet -- like this:
$output = "";
// echo 'Some output'
$output .= 'Some output';
// echo 'Some More Output';
$output .= 'Some More output';
return $output;
Move any CSS to your template, a CSS file, or the content section of the resource. Do the same with any necessary HTML code.
Put a snippet tag for the snippet you created at the place in the page where you want the output to appear. Normally, you would use snippet properties to control the snippet's behavior, but in your case, I think all the configuration is done by modifying the snippet code.