#The power of z
Do you spend lots of time doing things like this?
cd this/is/the/path/that/i/want/so/i/type/it/all/out/to/get/whereiwantWith z, you could just do this:
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| #301 Redirects for .htaccess | |
| #Redirect a single page: | |
| Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
| #Redirect an entire site: | |
| Redirect 301 / http://www.domain.com/ | |
| #Redirect an entire site to a sub folder | |
| Redirect 301 / http://www.domain.com/subfolder/ |
| sudo apt-get install unzip; | |
| wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/; |
| <!--[if mso]> | |
| <center> | |
| <table><tr><td width="580"> | |
| <![endif]--> | |
| <div style="max-width:580px; margin:0 auto;"> | |
| <p>This text will be centered and constrained to 580 pixels even on Outlook which does not support max-width CSS</p> | |
| </div> | |
| <!--[if mso]> |
| # | |
| # MIGRATE MySQL4 DATABASES TO MySQL5 - Steps for dumping and converting | |
| # | |
| # Uses mysqldump and patches output to be compatible with MySQL 5.5+ (? - no sure | |
| # at which specific release of MySQL 5 the old style syntax support ended). | |
| # | |
| # Conversion is most likely incomplete. This script provides replacement routines | |
| # based on what I stumbled upon when migrating a couple of databases. | |
| # | |
| # Use on own risk, always try with test databases first. No warranty at all! |
#The power of z
Do you spend lots of time doing things like this?
cd this/is/the/path/that/i/want/so/i/type/it/all/out/to/get/whereiwantWith z, you could just do this:
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
| cd $HOME | |
| ln -s `which php54` ~/bin/php | |
| export PATH=$HOME/bin:$PATH | |
| curl -sS https://getcomposer.org/installer | php54 | |
| echo -e "\n# Composer\nalias composer=\"php54 \$HOME/composer.phar\"" >> $HOME/.bash_profile | |
| source $HOME/.bash_profile |
| # based on http://www.commandlinefu.com/commands/view/2916/backup-all-mysql-databases-to-individual-files | |
| # but modified for the MAMP path and to include default root/root as username and password | |
| for I in $(/Applications/MAMP/Library/bin/mysql -u root -proot -e 'show databases' -s --skip-column-names); do /Applications/MAMP/Library/bin/mysqldump -u root -proot $I | gzip > "$I.sql.gz"; done |
| <?php | |
| # http://jeffreysambells.com/2012/10/25/human-readable-filesize-php | |
| function human_filesize($bytes, $decimals = 2) { | |
| $size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
| $factor = floor((strlen($bytes) - 1) / 3); | |
| return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
| } | |
| echo human_filesize(filesize('example.zip')); |