Refactor reading from stdin so --type option works

When reading from stdin, a filename must be set with an extension since the GitHub gist API infers file type from filename and not extension. Thanks to @ottomata for the original implementation. Fixes Issue #101.