Parsing HTML with Nokogiri

Parsing with Nokogiri is a breeze, especially if you’re super familiar with CSS selectors and you’re good at traversing the DOM. 1. First, you need to install the Nokogiri gem: gem install nokogiri   If you are parsing something that lives remotely, you might want to include the open-uri module, which will make it even...
Read More

CSS – Media Queries

I came across media queries, a CSS functionality that helps to create a more responsive site, while going through General Assembly’s Dash Tutorial.  It allows you to specify attributes based on the width of the screen.  You construct a media query as follows: @media (max-width: 500px) { body { background: red; } } Essentially  once the statement...
Read More

Polymorphism in 6 steps

A slightly advanced association in ActiveRecord is called polymorphic association. This usually happens when a model can belong to more than one model, even if it behaves the same way, but it’s easier to understand with an example. Suppose you have a blog that has articles, photos, and events. You want to add comments on...
Read More

Four rules for developers

… according to Sandi Metz, author of POODR. She mentioned these in a Ruby Rougues podcast and I thought they were interesting! 1. Classes can be no longer than one hundred lines of code. 2. Methods can be no longer than five lines of code. 3. Pass no more than four parameters into a method...
Read More