How to add a new path to my PATH

06/20/18  Public, Command Line

http://osxdaily.com/2014/08/14/add-new-path-to-path-command-line/

Here was my use case.

My starting PATH

➜  echo $PATH
/Users/harrylevine/.rbenv/shims:/usr/local/heroku/bin:/Users/harrylevine/.rbenv/shims:/Users/harrylevine/.rbe...

1 vote - harrylevine

Explanation of the Singleton Pattern in ruby

06/18/18  Public, Ruby General

https://ieftimov.com/singleton-pattern

1 vote - harrylevine

How to look at an older version of the rails API docs

05/07/18  Public, Rails General

You add in /v4.2.1/ into the URL, for the version in question. For example:

Before URL:

After URL:

1 vote - harrylevine

To run sidekiq

07/25/18  Public, Rails General

For perform_later

And in a separate tab:

bundle exec sidekiq

To view the local dev page of queues and jobs running, failed, etc., visit:

http://localhost:3000/sidekiq

1 vote - harrylevine

Difference between include vs extend

03/05/18  Public, Ruby General

Great article by https://twitter.com/feministy that explains the difference between using include vs extend andself, when using modules:

http://lizabinante.com/blog/modules-and-self-in-ruby/

1 vote - harrylevine

Require and load a gem in IRB for testing purposes while developing the gem

01/20/18  Public, Ruby General, Gems

  • cd into the root of the gem
  • run bin/console

Done.

Or,

  • cd into the root of the gem
  • run bundle console

Or,

  • cd into the root of the gem
  • run irb -I lib
  • run require "name_of_gem"

For example:

$ i...

1 vote - harrylevine

Workflow for upgrading Rails versions

12/25/17  Public, Rails General

First, read through the Rails "A Guide for Upgrading Ruby on Rails".

In general, you can follow the steps in this [Ruby on Rails Upgrade Guide blog post](http://nithinbekal.com/post...

1 vote - harrylevine

Benchmarking in the Rails Console

01/01/18  Public, Rails Errors, Ruby General

timing = Benchmark.measure { Post.all }

The various attributes of the object returned (Benchmark::Tms) are provided here.

Here is a sample applicati...

1 vote - harrylevine

Can call multiple `expects` in an `it` block without stopping on failure

11/30/17  Public, Testing / TDD

By adding :aggregate_failures to the end of anit statement, you can call multiple expects in that it block, and if any of them fail, the tests keep testing.

For example, in the this spec, if expect(Post.count).to eq 4 fails, the test ...

1 vote - harrylevine