Skip to content

Instantly share code, notes, and snippets.

@leymannx
Last active July 27, 2016 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leymannx/3d00bd1ca7e2d27815b6 to your computer and use it in GitHub Desktop.
Save leymannx/3d00bd1ca7e2d27815b6 to your computer and use it in GitHub Desktop.
export PATH="/usr/local/sbin:$PATH"
alias ob='open ~/.bash_profile'
alias sb='source ~/.bash_profile'
alias oc='open ~/.ssh/config'
alias ll='ls -lhA'
alias ls='ls -la'
alias keygen='ssh-keygen -t rsa -b 4096'
alias hg='history | grep'
alias mkdir='mkdir -pv'
alias wget='wget -c'
alias pini='subl /usr/local/etc/php/5.6/php.ini'
alias ip='curl ifconfig.me'
# open arg1 directory under ~/Sites
# arg 1 directory name
cdd() {
cd ~/Sites/$1
}
# bash completion for cdd
_cdd() {
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "$(ls /Users/Shared/www/Documents)" -- $cur) )
# COMPREPLY=( $(compgen -W "$(ls /Users/`whoami`/Sites)" -- $cur) )
}
complete -F _cdd cdd
# create and change into directory
# arg1 directory name
mcd () {
mkdir -p $1
cd $1
}
# create and open empty .info file
# arg1 module machine name
info () {
echo 'name = '$1'
description = '$1'
core = 7.x
package = Custom
version = 7.x-1.0' > $1.info && open $1.info
}
# create and open empty .module file
# arg1 module machine name
module () {
echo '<?php' > $1.module && open $1.module
}
# create Drupal module folder with files
# arg1 module machine name
drum () {
mcd $1
info $1
module $1
}
# create and open empty .install file
# arg1 module machine name
install () {
echo '<?php' > $1.install && open $1.install
}
# create and open empty .inc file
# arg1 module machine name
inc () {
echo '<?php' > $1.inc && open $1.inc
}
# drush disable & uninstall in 1 step
# arg1 module machine name
dust () {
drush dis $1 -y && drush pm-uninstall $1 -y
}
# find and open
# arg1 project folder
# arg2 file name
fopen () {
find ~/Sites/$1/ -name $2 | xargs open
}
# move into all sub of directories of current and drush sql dump
bulkdump () {
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && drush sql-dump > dump.sql" \;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment