If you execute IRB with the command line flag –noprompt you will enter in to an IRB session with none of the extra characters showing up on the left side of the terminal. This is great if you want to experiment with code and then use the mouse to copy & paste from it. Like, for example, in a code blog like the one you’re reading…
(Thanks to 6ftdan for this cool tip.)
Showing posts with label tricks. Show all posts
Showing posts with label tricks. Show all posts
Monday, February 22, 2016
Monday, February 1, 2016
Don't wrap specific CSS elements
Another quickie quickie CSS tricky:
Let’s say you’re trying to make a site responsive to many different screen sizes, like you have to these days. You have a block of text that needs to wrap, but you also have a word or number you don’t want to get wrapped. The best example for this I can think of is a phone number – you don’t want it display weird like this:
Wrap that word or number or whatever in a
Let’s say you’re trying to make a site responsive to many different screen sizes, like you have to these days. You have a block of text that needs to wrap, but you also have a word or number you don’t want to get wrapped. The best example for this I can think of is a phone number – you don’t want it display weird like this:
Call Jenny today! 800-867-
5309
Wrap that word or number or whatever in a
span and style it with "white-space: nowrap;". Then, that particular element will wrap as one piece: Call Jenny today!
800-867-5309
Monday, January 11, 2016
No return value in rails console
A quick tip when working in rails console. If you're testing commands to run and don't want the console to output the return value, just append a semicolon to your ruby code.
OK, so that's a contrived example, but this really comes in handy
User.all
# => [#<user:0x007fd72a408630> {:id => 1, :name => "Mr. T", ...}, tons and tons of other records]
User.all;
# => nothing!
OK, so that's a contrived example, but this really comes in handy
- when creating records, or
- if you need to update several records in one shot and don't want to see the return values, or
- POSTing to an external API and avoiding all the cruft that comes in the response
Labels:
command line,
console,
rails,
ruby,
tricks
Subscribe to:
Posts (Atom)