Find the directory specified by the first argument (or the home directory if no argument is given) and execute the command "chmod 777" on all files and directories within it, including subdirectories.
find ${1:-~} -depth -exec chmod 777 {} \;