Skip to content

Instantly share code, notes, and snippets.

@Supernats
Created December 6, 2014 02:32
Show Gist options
  • Select an option

  • Save Supernats/39909cc2633ffe32f772 to your computer and use it in GitHub Desktop.

Select an option

Save Supernats/39909cc2633ffe32f772 to your computer and use it in GitHub Desktop.
  • Embiggen your bash history: Tired of forgetting important commands because they've dropped out of you history? DON'T BE ANYMORE. You can set your history to follow as many commands as you'd like. I like a million, because it is big and has lots of 0s.

    Put this in your bashrc/bash_profile

    MILLION=1000000
    export HISTFILESIZE=$MILLION
    export HISTSIZE=$MILLION
  • Zeus: Zeus preloads your app for you. This makes it start up in less than a second. This is helpful for a lot of things. Even better, it doens't have to live in your Gemfile.

Install it!

gem install zeus

Use it! 0. Start the zeus process 0. zeus start in a dedicated tab 0. The zeus project site has a great list of how to make your favorite commands be awesome. tl;dr 0. rails s == zeus s 0. rails c == zeus c 0. rspec == zeus test 0. rails db == zeus dbconsole 0. All these and more are always available in the tab where you started zeus.

  • Pry: Pry is awesome. You should really be using it. Knocks IRB out of the water. You can also totally use it for your Rails app. It does everything IRB does and more.

Use it! 0. Put this in your irbrc (touch ~/.irbrc first if you don't have one)

begin
  require "pry"
  Pry.start
  exit
rescue LoadError => e
  warn "=> Unable to load pry"
end
  1. Put this in your pryrc (touch ~/.pryrc first if you don't have one) Just because you've been so good, I decided to give you FactoryGirl factories in the console. Call them just like you would in your specs!
if Kernel.const_defined?(:Rails) && Rails.env
  require File.join(Rails.root,"config","environment")
  require 'rails/console/app'
  require 'rails/console/helpers'

  extend Rails::ConsoleMethods

  require 'factory_girl'
  FactoryGirl.find_definitions
  include FactoryGirl::Syntax::Methods
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment