When you want to recursively copy files from one directory to another, use find and pipe its output to cpio. find . -name ‘*.jpg’ | cpio -pdm /path/to/<dest_dir> This will find all files with extension ‘jpg’ and copy them to <dest_dir> directory. cpio -pdm copies files to destination directory and also creates the directory structure. […]Read more "Linux – Copy files recursively preserving directory structure"
rbenv is a great tool which enables you to install and pick a ruby version for your application. It is light weight and works by inserting a directory of shims at the front of the PATH Install Homebrew – a great package manager: ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” Install rbenv – manage different versions on […]Read more "Install rbenv and ruby"
I recently used this to backup and restore all the databases in one single file. This works for small sized databases very well and is a quick and easy way to backup and restore all local databases. Very useful for testing and quick restore. Issue this command at the command prompt. mysqldump -u <username> -p […]Read more "MySQL – Backup and Restore All Databases"
Do this on rails console to list models with their structure .. Rails.application.eager_load! (required on development environment) ActiveRecord::Base.descendantsRead more "Rails console – List all models"