Explaining the inject method

The inject method takes a collection and reduces it to a single value, such as a sum of values. Here are the basic workings when iterating through an array and adding the elements together:

What’s happening [1, 2, 3, 4, 5] .inject  takes the first element and does something to the second element; in this case adds it. [1, 2] equals to [3] (our new first…

Read More

Generate lorem text from within Sublime using Emmet plugin

While in development, I’m constantly using lorem text to fill in forms. Did you know that you can generate lorem text and set how many words to generate, right inside Sublime?? Try it out: While on any page that accepts html (.html, .html.erb, .css, etc.) just type  lorem20 then hit tab. You can put whatever number you want after lorem and it will generate that amount of text. If…

Read More