Below are 5 blog posts tagged programming

Learning Ruby on Rails: Part I - The Language

Most of my programming experience has been in PHP, JavaScript/JQuery, and VB.NET. When I worked in Support at Code Climate, it became obvious to me that I had picked the wrong languages, and that Ruby was the better choice. With its super simple and legible syntax, Gem support, and stellar framework, I was excited to dig in!

A few years back I dabbled in trying to learn Ruby on Rails, but I made the mistake of trying to teach myself both the language and the framework at the same time. That led to mostly confusion and frustration. I've heard many different opinions on this subject, but I now strongly believe that you should have a firm grasp of the language before trying to learn one of its frameworks.

For the past year or so I've been focusing solely on Ruby, primarily by consuming Team Treehouse's Learn Ruby track. It's a 20-hour course in all and I'm stoked to have finally completed it! Next up: Rails!

While moving through the Ruby course I took copious notes. I thought it would be helpful to share those notes here. Enjoy!

Continue reading...

Having Rubocop tell me that my Ruby code is stylistically flawless makes me feel very good. No, really.

Below is a good example of someone brand new to Ruby (me!) and someone with Ruby experience (not me!) solving the exact same problem. These two methods have the same goal: accept a string, reverse and return it.
def solution(sentence)

  sentence_as_array = sentence.split(" ").reverse!

  reversed_string = ""
  sentence_as_array.each do |x|

    reversed_string = reversed_string + x + " "


  return reversed_string.chop


def better_solution(sentence)

  sentence.split(" ").reverse.join(" ")


It's crazy how much more elegant the second method is.

I'm constantly re-using the same exact code snippets, for which I never remember the exact syntax. Today I found the free and awesome Snippet Bar, which lives in my macOS menu bar and will prevent me from having to re-look up each code snippet's syntax every time that I need to use it. Win!

Deck of Cards API is a series of public and authentication-less endpoints that simulate a deck of cards. Commands include `shuffle` and `draw`. I sometimes need a dummy API that I can test against -- this one is definitely more fun than the others I've used.