diff options
-rw-r--r-- | .functions | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -29,6 +29,15 @@ function server() { python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" } +# Start a PHP server from a directory, optionally specifying the port +# (Requires PHP 5.4.0+.) +function phpserver() { + local port="${1:-4000}" + local ip=$(ipconfig getifaddr en1) + sleep 1 && open "http://${ip}:${port}" & + php -S "${ip}:${port}" +} + # Get gzipped file size function gz() { echo "orig size (bytes): " |