As a student in Jason Noble’s 3 months course at DaVinci, I learn an really important skill: Speed up in anyway you could to follow up. And here’s a big part of how to speed up: use your shortcuts! PS, These following shortcuts are only for Ruby on Rails, Mac Developers.
First of all, how to do a screen shot? Command + Shift + 4; ‘click and drag’ the area you need, it would be on your desktop once you let go. Now you can use in whatever way you need 😉 PS, this work on any Mac Book.
Search on computer: Command + <Space> opens Spotlight, working on any Mac.
Switch Windows: Command + Tap, any Mac can do it.
When you need to bring up HTML from your Browser: Chrome @ Command + Option + U; FireFox @ Command + U
These following are shortcuts for Terminal/ I Term:
cd ==> go to : ~ home; . current directory; .. one directory up; / root
mv = move eg. >>usage > mv <path>/<file name> <path>/<file name>
rm = remove eg. >>rm -rf
OR eg.>>rm <file name>
cp = copy eg.>>cp ~/<directory/file> ~/<directory/file>
ls = list ==> list all the files in the current directory you are in.
open ==> open file
ps, you can see which directory you are in currently on the left side of >>
touch <file>.rb ==> create new ruby file name <file>
mine . ==> open ruby mine in current directory
mine <file>.rb ==> open ruby mine <file>
chmod 755 <file> ==> make files executable
git status ==> shows the current status of your local git repo
git add ==> stages files locally
git commit -m ‘<message>’ ==> commit files with message you want to say in <message>, commits all the currently staged files.; OR gitx; Command A on the right will select all files, you can then drag
them to the left, thus “staging” them for commit. The commit message goes in the middle box. push ‘commit’ bottom; close gitx
git push ==> push files to your GitHub account.
echo ==> command to output which version or what types of gem-sets to the terminal.
eg.>>echo ‘2.1.4’ > .ruby-version OR eg.>>echo > .ruby-gemset
eg.>>echo ‘Hello’
Prints hello to the terminal
We use > to redirect that output to a file
bundle ==> is part of the bundler gem. Running the bundle command will
look at the gems you requested in your Gemfile and install them.
rails new <name_of_rails_app> -B -T ==> create a new rails app; -B skips the bundling step;
-T skips the unit_test generation step
rails s = rails servers ==> run rails server. By default it will run
the server on port 3000, which you can access in a browser by going to
http://localhost:3000/
rrails g scaffold <name_of_scaffold> field1:<type> field2:<type> #note: keep going with all your fieldss:<types> ==> generate a scaffold for your rails app
If you have any typo on your scaffold, do rails d scaffold <name_of_scaffold> field1:<type> field2:<type> … ==> delete your scaffold, and now re-do generate scaffold
rake db:migrate ==> applies any migrations (stored in db/migrate/*) that
have not already been applied. You usually want to run this after
generating some rails code (migration, scaffold, model, etc)
rake routes ==> provides a list of URLs that are available in your Rails App.
Control + A ==> Go to beginning of the line, can be
used in IRB, rails console and the terminal.
Control + E ==> Go to end of the line, can be
used in IRB, rails console and the terminal.
Control + C ==> Cancel , can be
used in IRB, rails console and the terminal.
Control-u ==> Deletes the current line in the terminal
Command + N ==> opens a new iTerm/Terminal window
Command + T ==>opens a new tab in iTerm/Terminal
guard init ==>Initialize rubocop, If you have guard-rubocop installed, it
will add Rubocop settings to the Guardfile.
guard ==> Runs Guard, which waits for files to change. Once files change,
it will run one or more guards (Rubocop, RSpec, etc).
Command + K ==> Clears the terminal screen (clears the scroll buffer)
q = quit ==> exits Guard…
exit ==> Close/exit current Terminal
These following are shortcuts for Ruby Mind:
PS, if your shortcut in Ruby mine not working, do this to fix it: Go to the left top click on RubyMine/ Preference/ Key Map/ selective Pivotal/ hit Apply & OK
If you want to fix the colors on your Ruby Mine: Go to the left top click on RubyMine/ Preference/ Editor/ Colors & Fonts/ pick the colors and fonts you like on the right side.
Run the specific file you currently have open inside of Ruby Mine: Command + Shift + F8
Create new files in the directory you have highlighted: Command + N
Gives you an easy way to open files by filename: Command + Shift + N
Duplicates the line that the cursor is on: Command + D
Undo: Command + Z
Show/hide the list of directories in your project: Command + 1
Type/Edit multiple lines at the same time: Option + ‘click’ on the lines where we want to add/edit at the same time
#{} ==> Control + L
<%= %> ==> Shift + Command + .
You welcome to add any more that I don’t know yet 😉 Hope this help and have fun with them!