Skip to content

Instantly share code, notes, and snippets.

@addyosmani
Last active February 10, 2019 22:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save addyosmani/5926131 to your computer and use it in GitHub Desktop.
Save addyosmani/5926131 to your computer and use it in GitHub Desktop.
Snippet for someone
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-8000}"
open "http://localhost:${port}/"
# Set the default Content-Type to `text/plain` instead of `application/
# And serve everything as UTF-8 (although not technically correct, this
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTP
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment