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?

How to edit the /etc/hosts file

09/06/17  Public, Command Line, Online Resources

https://www.tekrevue.com/tip/edit-hosts-file-mac-os-x/

For example, adding:

127.0.0.1    operationcode-psql 

to your /etc/hosts file enables you to run Rails app that uses Docker, without Docker.

As long as postres app i...

1 vote - harrylevine

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