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

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

After log in should redirect to a page other than default root

11/16/14  Public, Rails General, Gems

When using Devise, when a registered user logs in, they are, by default, directed to the root.

Here is the code to change this to being directed to a page of your choosing

In `app/controllers/appl...

1 vote - harrylevine

Ruby and jQuery cheat sheets

11/09/14  Public, Cheat Sheets



Great site. Also contains cheat sheets for Git, HTML, MySQL, JavaScript and more.

1 vote - harrylevine

Using jQuery to return which item is selected in a group of radio buttons, in a form

11/10/14  Public, Other Languages

Here is a snippet of code from a form for a group of radio buttons:

<p>Age group:</p>
<label><input type="radio" id="age0" name="age" value="-30" /> under 30</label>
<label><input type="radio" id="age1" name="age" value="30-50" check...

1 vote - harrylevine

Using jQuery to determine if a checkbox from a form is or is not checked

11/08/14  Public, Other Languages

Here is a snippet of code from a form for a checkbox with a label:

<label><input type="checkbox" id="like" name="like" checked="checked" /> I like jQuery</label>

This line of jQuery will determine if the box is checked, and log...

1 vote - harrylevine

Using jQuery to determine if an item from a form's drop-down menu is or is not selected

11/08/14  Public, Other Languages

Here is a snippet of code from a form for a drop-down menu containing choices:

<select id="skills" name="skills">
  <option value="none">please select&hellip;</option>
  <option value="html">HTML</option>
  <option value="css">CSS</...

1 vote - harrylevine

Tool to help learn and understand CSS selectors

11/08/14  Public, Online Resources, Other Languages

This tool will tell you the CSS selectors you will need in order to target an area or areas of your page. This applies directly to writing CSS and to writing jQuery.

Can be installed as a Chrome extension, or a bo...

1 vote - harrylevine