Command Line

The command line opens the door to a whole new world. I just hope I don’t screw up my computer.
This stack is for interacting with this new interface called the command line. How do you navigate? What are the valuable commands you are learning? What do you want to remember about bash profiles? What about IRB and simple prompt? Accessing and using the consoles and editors? What about the terminal, and iTerm2, and Vagrant? How can you customize the experience to fit your tastes?

Rollback or forward just one migration file

01/17/17  Public, Command Line, Rails General

You can rollback, or forward, just one migration file, regardless of where it is in the stack. Thereby putting it in either the down, or up, status.

Here is the syntax:

rake db:migrate:down VERSION=20160506010740
rake db:migrate:up V...

1 vote - harrylevine

Creating a local copy of the routes.rb file to speed up your grepping of the routes

10/08/16  Public, Command Line, Rails General

Grepping your routes.rb file, for decent size projects, can take a long time. One solution to speed up this process is to create a local copy of the current state of your routes.rb ...

1 vote - harrylevine

Encode an SVG file using base64 encoding

09/22/16  Public, Command Line, Tricks, Other Languages

Here is how to encode an SVG file, using base64 encoding, and then leverage the encoded string to set an element's background-image property to the SVG file in question.

1 - Open up an irb session
2 - Read the file into a variable, using...

1 vote - harrylevine

Shortcut for pretty printing Active Record data in the rails console

03/28/16  Public, Command Line, Shortcuts, Tricks

In the rails console, when you run something like Post.all it returns all of the posts in one big continuous paragraph. A quick, low-rent shortcut to get these records to pretty print is to:

  • lead with a y

For example:


1 vote - harrylevine

Test one specific file or spec with spring, without running guard

03/21/16  Public, Command Line, Shortcuts, Testing / TDD

This syntax will allow you to take advantage of the speed that spring offers, when running just one spec file, or just one spec within the file (or context), without running [guard](

1 vote - harrylevine