Rubymine: Code folding
Code folding is a very useful feature to me. It gives me a quick overview over a file and keeps me from scolling like a hamster in its wheel.
Keyboard shortcuts:
Collapse/expand current code block
strg -/+
Collapse/expand the whole file
strg ctrl -/+
When diving into Cucumber features or huge Ruby classes, I usually collapse all and the gradually expand what I need.
Related cards:
Disable automatic code suggestions in RubyMine
To disable the mostly useless automatic suggestion popups in RubyMine, go to File / Settings, then to Editor / General / Code Completion and uncheck Auto-display code completion.
You can still open the popup by pressing CTRL + Space
. And ...
Prevent RubyMine from reformatting pasted code
When you paste copied code with CTRL+V
, RubyMine will change the indentation of the pasted code. You can prevent this by pasting with CTRL+ALT+Shift+V
instead ("Paste Simple").
To change this behavior entirely, you can open your settings and ...
The Codeless Code
The Codeless Code is a charming series of stories about monks and nuns at a programming monastery.
Some stories to get started:
- Laziness
- [The Falling and the Rising Rain](http://t...
RubyMine: Fixing "Rubocop returned exit code -1. See the logs for details"
When RubyMine reports Rubocop returning "exit code -1", upgrading Rubocop can be the fix:
gem install rubocop
"The logs" can be accessed with Ctrl + Shift + A > Show log in (Files). This opens your file manager at the IDEA log location; t...
List of Helpful RubyMine Shortcuts
Navigation
CTRL + SHIFT + ALT + N
: Search for any symbol in your application, like CSS classes, Ruby classes, methods, helpers etc.
CTRL + SHIFT + N
: Search for filename in your application (also dependencies)
CTRL + E
: Open...
Debug Ruby code
This is an awesome gadget in your toolbox, even if your test coverage is great.
-
gem install ruby-debug
(Ruby 1.8) orgem install debugger
(Ruby 1.9) - Start your server with
script/server --debugger
- Set a breakpoint by invoking `debugge...
Why you can't use timezone codes like "PST" or "BST" for Time objects
Rails' ActiveSupport::TimeWithZone
objects have both a timezone code and offset, e.g. Thu, 28 Mar 2019 16:00:00 CET +01:00
. Ruby's stdlib TZInfo
also has time zones, but with different identifiers.
Unfortunately, not all timezone codes can b...
RubyMine / IntelliJ: How to increase UI and fonts for presentations
When giving a presentation where you do some coding, the font size you usually use is probably a bit too small and makes code hard to read for users on smaller screens or low-bandwidth connections when the image quality is lower.
Here are two sol...
Modern HTTP Status codes for redirecting
Formerly 301 (Moved Permanently) and 302 (Found) were used for redirecting. Browsers did implement them in different ways, so since HTTP 1.1 there are some new status codes which allow for finer distinctions.
**The interesting part is how non-GET...
Ruby: Converting UTF-8 codepoints to characters
Converting string characters to or from their integer value (7-bit ASCII value or UTF-8 codepoint) can be done in different ways in Ruby:
-
String#ord
orString#unpack
to get character values -
Integer#chr
orArray#pack
to convert charact...