aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.functions9
1 files changed, 9 insertions, 0 deletions
diff --git a/.functions b/.functions
index 71f95cc..f35f483 100644
--- a/.functions
+++ b/.functions
@@ -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): "