Learning to Code


Remote Bound

Sinatra Project Blog

I’m Vegan, there I said it. Now you’re probably thinking, “I can’t live off of tofu,” or “what does this guy even eat?”


CLI Project Blog

Leading up to the CLI project deadline, my wife and I found ourselves checking the CDC website daily as we had just decided to cancel our Tokyo vacation and were trying to collect refunds from all of our bookings. Some of our refunds were contingent on Japan reaching level 3 status. Each day, we were monitoring the Corona virus as it spread across the world. I noticed, from my prior Nokogiri scraping sessions, that the bulk of the data being presented to me on the webpage was nothing short of a list of travel health advisories with links to read more information regarding each issue. A quick right-click and inspect validated such. I was going to make my first application a practical one. I was going to scrape the Centers for Disease Control and Prevention and provide a CLI for users to navigate the traveler’s health advisories. I realized that each listed advisory followed the same format by providing an issue, destination, last update, a brief summary and an option to read more information. Those were going to be the attributes for my advisory or Notice object to be instantiated with. After creating a Scraper class, I needed to add nokogiri as a dependency in my gem spec file and require both nokogiri and open-uri in my environment. In my Scraper class, I created the class method “self.get_notices” and used Nokogiri to read or parse the CDC website with

doc = Nokogiri::HTML(open("https://wwwnc.cdc.gov/travel/notices"))

After mousing over the website with the selector, I found that each advisory had an “li” tag inside of class named “list-block.” Using the querySelector function within the inspection console, EACH “li” contained all the attributes that I was scraping for, so I used the each method in my Scraper class to instantiate a new Notice object.

scraped_notices = doc.css(".list-block li")
scraped_notices.each do |node|
                     
notice = CdcTravelAdvisory::Notice.new(@issue, @last_update, @summary, @more_info_url, @key_points)

First Mile

“Why did you decide to study Software Engineering?”


Pushing Through

Leading up to Thanksgiving, I felt as if I had hit a wall. By plowing through lessons with haste, I was failing to actually learn the material which set me up to struggle with each subsequent lesson. In focusing more on velocity, I was shooting myself in the foot. After taking some time off to focus on family, I have returned refreshed and revitalized.


'For the things we have to learn before we can do them,

we learn by doing them.’ -Aristotle