$ cp todo.txt !#:1.bak
cp todo.txt todo.txt.bak
NOTE: Actually you can use !#:1 in every command 'cause that's last argument passed to a command.
UPDATED: Now it works with zsh
User 1 - 0..1 Laptop
a/m/laptop.rb belongs_to :user, optional: true ```
Go to your project root and cd into app/models (using CLI obviously) then run wc -lw * | sort -u
$ wc -lw * | sort -u
103 186 deal_broker.rb
116 313 physical_sim_report.rb
126 229 coupon_code.rb
126 260 subscription_mission.rb
129 284 payment.rb
145 290 deal_value.rb
147 255 single_use_coupon.rb
166 344 sim_card.rb
166 406 coupon_campaign.rb
225 451 order_summary.rb
260 534 deal.rb
308 783 package.rb
443 1031 user.rb
728 1744 subscription.rb
7262 15841 total
So now you can see Rocky is all about User ,Subscription and Package.
Note: First column number of lines and the second column number of words.
Generating a rails 6 app with ruby 2.6+ when you have bundler v2 installed creates unusable binstubs. If you are seeing this error You must use Bundler 2 or greater with this lockfile. you can remove the bundler that comes bundled with ruby 2.6 and rely on the manually installed v2 bundler.
If you are using rbenv you can use this command (adjust for your ruby version e.g. 2.6.{0, 1} etc), other installation systems will use different locations
rm -rf ~/.rbenv/versions/2.6.1/lib/ruby/2.6.0/bundler*
Sometimes I want to go back to the last page I viewed while still keeping the same one open. You can very easily achieve this with shortcuts
I often move lines around in vim so I have created mappings to make this easier.
These map to ⌘-j for move down and ⌘-k for move up. Works in normal, insert, and visual modes.
vim
nnoremap
$ git branch --merged | egrep -v 'master|develop' | xargs -n 1 git branch -d
You can safelist more branches in egrep -v 'master|develop|foo|bar'
Easily run the below command and get a diff version from the remote
$ git diff origin/master -- [local-path]
$ RUBYOPT=W0 ./bin/rspec spec/
...
$ RUBYOPT=W0 bundle exec rspec spec/
...
$ RUBYOPT=W0 rspec
...
$ RUBYOPT=W0 ...
...