Test your next web based idea with RawGit
All too often I find myself wanting to test something web based quickly without starting a local web server (this is how my procedural castle generator started for example).
While a quick Github Gist or a Github Repository would be a great place to host things like this Github serves your code with the mime type
text/plain, and the
X-Content-Type-Options: nosniff header. Without the extra header your browser will inspect the content that is being sent by the server and automatically determine the actual content type - but the above header disables this functionality, rendering both Github Gist and a Github Repository useless for anything other than sharing code.
Thankfully all is not lost. Some time ago ago I discovered RawGit. RawGit is a service that lets you enter the raw view url of either a Github gist or a file in a Github repository, and it will serve it with the correct content type, allowing you to use gist and Github repositories to house your latest and greatest experiment.
It has a different url for development and production use, too. The development url doesn't cache anything and updates instantly, whereas the production url is cached indefinitely and is delivered via a CDN (content delivery network).
Because different files in the same folder or gist generate a similar url, you can include them in your HTML page in the same way as if you were doing it locally:
<!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <title>Test page</title> </head> <body> <p>Page content here</p> <!----------------> <script src="tomatoes.js"></script> </head> </html>