Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
113 lines (90 sloc) 2.71 KB
# Switch PHP versions
phpv() {
valet stop
brew unlink php@7.0 php@7.1 php@7.2 php@7.3
brew link --force --overwrite $1
brew services start $1
composer global update
valet install
}
alias php70="phpv php@7.0"
alias php71="phpv php@7.1"
alias php72="phpv php@7.2"
alias php73="phpv php"
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$@"
}
# Open a valet project in the browser
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-9000}"
sleep 2 && open "http://localhost:${port}/" &
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
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 en0)
sleep 2 && open "http://${ip}:${port}/" &
php -S "${ip}:${port}"
}
# All the dig info
function digga() {
dig +nocmd "$1" any +multiline +noall +answer
}
#shortcut voor zhs quick-look command
function ql() {
quick-look "$1"
}
archive () {
zip -r "$1".zip -i "$1" ;
}
function removehost() {
ssh-keygen -R "$1"
}
function weather() {
city="$1"
if [ -z "$city" ]; then
city="Antwerp"
fi
eval "curl http://wttr.in/${city}"
}
alias mysqladm='mysql -u root'
# Scrape a single webpage with all assets
function scrapeUrl() {
wget --adjust-extension --convert-links --page-requisites --span-hosts --no-host-directories "$1"
}
# Commit everything
function commit() {
commitMessage="$1"
if [ "$commitMessage" = "" ]; then
commitMessage="wip"
fi
git add .
eval "git commit -a -m '${commitMessage}'"
}
xdebug() {
iniFileLocation="/usr/local/etc/php/7.3/conf.d/ext-xdebug.ini";
currentLine=`cat $iniFileLocation | grep xdebug.so`
if [[ $currentLine =~ ^#zend_extension ]];
then
sed -i -e 's/^#zend_extension/zend_extension/g' $iniFileLocation
echo "xdebug is now active";
else
sed -i -e 's/^zend_extension/#zend_extension/g' $iniFileLocation
echo "xdebug is now inactive";
fi
}
function db {
if [ "$1" = "refresh" ]; then
mysql -uroot -e "drop database $2; create database $2"
elif [ "$1" = "create" ]; then
mysql -uroot -e "create database $2"
elif [ "$1" = "drop" ]; then
mysql -uroot -e "drop database $2"
fi
}