Great tutorial on Regular Expressions

12/10/14  Public, Ruby General

RubyLearning.com tutorial on Regular Expressions

1 vote - harrylevine

Gem to help with Rails Errors

05/10/15  Public, Rails Errors, Gems

When dealing with a particularly complex bug, logging and raising errors can become tedious or imprecise. The better_errors gem is there to help. The gem transforms your in-browser error page, add...

0 votes - harrylevine

Viewing the available methods for a given object

12/10/14  Public, Ruby General

As soon as an object comes into existence, it already responds to a number of messages. Every object is "born" with certain innate abilities. For example, if you have a class called Dog, and you create a new object like this, from the command ...

1 vote - harrylevine

How to remove any non-alpha characters (a to z) from a string using gsub and RegEx

12/05/14  Public, Tricks, Ruby General

For example, let's say that you have a method that determines if a particular word (string) is a palindrome or not. As a fringe case, what if the string happens to contain characters like . or...

1 vote - harrylevine

Command to create a new controller in Rails

12/01/14  Public, Command Line, Rails General

Here's the command to create a new controller in rails, from the command line.

$ rails g controller welcome index about

This example will be for a controller called welcome. In addition to the controller file, it will create two defau...

1 vote - harrylevine

How to require and re-load a Ruby file during an IRB session

11/24/14  Public, Command Line, Ruby General

This is so you can upload some existing classes and/or methods that you have written in a file, during an IRB session.

  1. Make sure you are in the same directory as the file in question, then start the IRB session, i.e. $ irb
  2. Enter into...

1 vote - harrylevine

Way to test a specific section in a file without using Focus

11/24/14  Public, Tricks, Testing / TDD

Adding a focus to a spec file is good way to just test that specific area. The one drawback is you have to remember to remove the...

1 vote - harrylevine

Skorks

01/01/15  Public, Online Resources

http://www.skorks.com/2010/05/ruby-procs-and-lambdas-and-the-difference-between-them/

What's the difference between procs/lambdas.

http://weblog.jamisbuck.org/2007/2/23/method-visibility-in-ruby

Method visibility in ruby

Here's an...

1 vote - e47my54uc3

Summary of rake database migration commands in development

11/16/14  Public, Command Line, Databases

$ rake db:migrate
$ rake db:migrate VERSION=0 --> Removes all migrations, resetting back to ground zero
$ rake db:migrate VERSION=20141013165213 --> Migrates back down to the specific named migration
$ rake db:migrate:status --> *P...

3 votes - plawler

Very common recurring workflow with Git

11/15/14  Public, Workflows, Git

$ git branch --> Should be on your master branch
$ git checkout -b welcome-controller --> This creates a new branch called welcome-controller. Replace "welcome-controller" with name of your new branch
$ git branch --> *Should be o...

3 votes - harrylevine