aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSindre Sorhus <sindresorhus@gmail.com>2012-08-07 11:13:45 +0200
committerMathias Bynens <mathias@qiwi.be>2012-08-07 11:14:15 +0200
commit378fa5bec44d3b93b3b170e6f27f5e89c277e2e2 (patch)
tree7ef1441be1c2cb1fd6d6dc5c8538d9fe08b4fab0
parent5d76fc286fe921cddf9a73c404ada924c856df24 (diff)
downloaddotfiles-378fa5bec44d3b93b3b170e6f27f5e89c277e2e2.tar.gz
dotfiles-378fa5bec44d3b93b3b170e6f27f5e89c277e2e2.tar.bz2
dotfiles-378fa5bec44d3b93b3b170e6f27f5e89c277e2e2.zip
.functions: Add `phpserver`
Ref. #116.
-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): "