What I did this weekend 12/7/13 – 12/18/13

Codecademy

  • Completed the Ruby course

Team Treehouse

  • Oh boy… I’ll try to make this as short as possible. Treehouse has a course that teaches you how to build a simple Rails app. I started it last week, but got sidetracked and didn’t touch it for a few days. When I came back I couldn’t remember where I was so I just trashed it and started over. THEN I learned that the demo app in the tutorial was built in Rails 3, and I have Rails 4, and that a very critical authentication scheme has been changed that the tutorial (obviously) doesn’t cover. Decided to suspend my effort in completing this app.

Michael Hartl’s Rails Tutorial

  • Completed Chapter 1. This was really easy since I’ve been screwing around on my own generating rails apps, so the initial process is no mystery.

Railscasts

  • Watched a few videos that went completely over my head

Heroku

  • Signed up and deployed app from Hartl tutorial

Hiccup starting with Rails

I’ve complete Codecademy’s ruby course, Team Treehouse’s ruby foundations and two-thirds of “Learn Ruby the Hard Way”; I feel I have a handle on Ruby. So now it’s time to put in the hard effort to learn Rails.

I’ve been using Treehouse for the “lecture” portion of my learning because the videos are well-produced with lots of information presented to you in a fraction of the time it would take to read/digest text. The only problem is that the beginner Rails app tutorial was built in Ruby 3 and I’m running Ruby 4, and the authentication gem “Devise” works differently in the two versions.

At the same time I’m building the treehouse app I was following the tutorial on RailsGuides, so I had two apps in development at the same time. Instead of being difficult or interfering with one another they actually worked synergistically to help me understand Rails. The only problem with the tutorial is that it’s very dry and it doesn’t keep my attention.

And then of course Michael Hartl’s guide is out there which I was going to tackle after I built the app on Treehouse. I really don’t want to have 3 apps in development at the same time, so I’m going to suspend building the app on RailsGuides and Treehouse, and just go full steam ahead on Hartl’s book.

What I’ve Done Today

I feel like I’m coming down with something; I have a scratchy throat and headache. Thus I couldn’t stay focused when coding, so instead of just giving up I looked for videos to watch…

Codecademy

  • Virtual Computer (Ex 1-8)
  • Earned Virtual Computer Badge
  • Object Oriented Programming (Ex 1-4)

 

*  Getting Started With Rails (up to 5.3 “Creating Posts”)
* Railscast Episodes 1 – 4
* Ruby on Rails – Part 1: Hello World

What I did today 12/5/13

Team Treehouse

  • Migrating Statuses
  • Earned the “Creating an Authentication System” Badge

Codecademy

  • Object Oriented Programming 1 (ex 1-20)
  • Earned Object Oriented Programming Badge

Learn Ruby The Hard Way

  • Exercise 32 (arrays, already familiar with this)
  • Exercise 33
  • Exercise 34
  • So far there has been little challenge in most of these exercises. I feel like I’m doing exercises just to do them. The positive takeaway from this is more “real” coding.

* What Is a Web App? Here’s Our Definition
* Ruby Arrays
* A Wealth Of Ruby Loops And Iterators
* Active Record Migrations

What I’ve done today 12/4/13

Team Treehouse

  • Border Images (CSS Foundations)
  • Advanced Backgrounds (CSS Foundations)
  • Sudo (Console Foundations)
  • Earned Users and Permissions Badge
  • Processes (Console Foundations)
  • Pausing and Resuming (Console Foundations)
  • Killing Processes (Console Foundations)
  • Earned Processes Badge
  • Installing Devise (Creating an Authentication system)

Codecademy

  • Blocks, Procs, and Lambdas (exercises 12-21)
  • Earned Blocks, Procs and Lambdas badge. These exercises were genuinely enjoyable and fun!

Learn Ruby The Hard Way

*Completed my 2014 World Cup Draw Simulator

World Cup Draw script

The 2014 World Cup draw is on Friday. ESPN.com has a draw simulator. I thought it would be cool to make one of my own!

This took me about an hour to do. I’m sure there’s an easier way to do this, but I’m working with what I know.

Breakdown
The World Cup features 32 teams organized into 8 groups of 4. The teams are separated into 4 pots (32/8 = 4) The top 8 teams in the FIFA world rankings are assigned to different groups so that they don’t play each other until the 2nd round. The top 8 teams are assigned to POT 1.

The teams assigned to POTS 2, 3, 4 are based on geographical region. The African and South American teams are in POT 2. The North American and Asian teams are in POT 3. The European teams are in POT 4.

FIFA will select one team from each pot (1, 2, 3, 4) and these 4 teams will be Group A. The process will continue until there are no more teams remaining.

**But there’s a twist this year. Pot 2 has 7 teams and Pot 4 has 9 teams. FIFA wanted to avoid too many Euro teams in one group. My code doesn’t use their methodology exactly. I took the last team from Pot 4 and assigned it to Group B.

I then eyeballed the values in the array and did a puts to print the result. Code is below. Some sample group pairings are also included.

RANDOM RESULT #1

Group A
——-
Brazil
Ghana
USA
Netherlands

Group B
——-
Colombia
Algeria
Japan
France

Group C
——-
Belgium
Ecuador
Honduras
Italy

Group D
——-
Spain
Chile
Australia
Russia

Group E
——-
Germany
Nigeria
Korea Republic
Bosnia-Herzeg.

Group F
——-
Uruguay
Cote d’ Ivoire
Iran
Croatia

Group G
——-
Switzerland
Cameroon
Mexico
Portugal

Group H
——-
Argentina
Greece
Costa Rica
England

RANDOM RESULT#2

Group A
——-
Brazil
Algeria
Mexico
Bosnia-Herzeg.

Group B
——-
Uruguay
Ghana
Iran
Italy

Group C
——-
Argentina
Ecuador
Japan
Greece

Group D
——-
Belgium
Chile
Australia
Croatia

Group E
——-
Switzerland
Nigeria
Costa Rica
England

Group F
——-
Germany
Cote d’ Ivoire
Honduras
Russia

Group G
——-
Colombia
Cameroon
Korea Republic
Portugal

Group H
——-
Spain
France
USA
Netherlands

RANDOM RESULT #3

Group A
——-
Brazil
Cameroon
Korea Republic
England

Group B
——-
Belgium
Chile
USA
Russia

Group C
——-
Spain
Cote d’ Ivoire
Honduras
Italy

Group D
——-
Argentina
Ghana
Iran
Bosnia-Herzeg.

Group E
——-
Switzerland
Nigeria
Costa Rica
Croatia

Group F
——-
Uruguay
Ecuador
Japan
France

Group G
——-
Colombia
Algeria
Mexico
Netherlands

Group H
——-
Germany
Greece
Australia
Portugal

What I did today 12/3

Team Treehouse

  • UI Element States Pseudo-Classes (CSS Foundations)
  • Pseudo-Elements – ::first-line and ::first-letter (CSS Foundations)
  • Psuedo-Elements – ::before and ::after (CSS Foundations)
  • Selectors Review (CSS Foundations)
  • Earned Advanced Selectors Badge (CSS Foundations)
  • Evaluating Responses (Career Foundations)
  • Preparation (Career Foundations)

Codecademy

  • Blocks, Procs, and Lambdas (exercises 1-11)

Learn Ruby The Hard Way

  • Exercise 25
  • I started Exercise 26, but I really disliked Exercise 25 and immediately balked at the idea of having to refactor the code on this. I made the most obvious corrections and MAY come back to this later. Considering I’m simultaneously doing Codecademy’s Ruby course and have already completed Team Treehouse’s Ruby course I don’t think I’m setting myself up for failure if I don’t complete this exercise.
  • Exercise 27…I’m already familiar with boolean logic and the operators listed in this exercise, so I don’t need to memorize them.

Wikipedia

 

*Randomly browsed the Ruby Style Guide on Github
*Good explanation of Boolean Logic (makes sense now!) from Natasha the Robot’s blog

Finally! Ternary Operators

On Thanksgiving I wrote a silly little script that mimicked the popular “What does the fox say?” video. It asked the user for input and returned the animal sound if the name was in the database (a hash).

I wrote an if else statement for the output because that’s what I had been taught at the time. Then I learned about ternary operators and had a devil of a time trying to figure out how to rewrite the if else statement.

Before:
if animals[response].nil?
- puts "That animal is not in my database!"
-else
- puts ''
- puts animals[response]
-end

After:
animals.include?(response) ? (puts arr_animals[response]) :
(puts "That animal is not in my database!")

For the first few tries I was trying to write the ternary operator using .nil?. I finally figured out that instead of asking if the hash didn’t include (.nil?) I should ask if it INCLUDES (.include?)

PROBLEM SOLVED!

Work done today…

Team Treehouse

  • Editing Files (Console Foundations)
  • Moving and Deleting Files (Console Foundations)   /*Earned Console Badge*/
  • Users and Permissions (Console Foundations)

Codecademy

  • The Refactor Factory (exercises 2, 3, 4, 5, 6, 7)   /*Earned “The Refactor Factory” badge */

Learn Ruby The Hard Way

  • Exercise 20, 21, 22, 24

Wikipedia

 

*Randomly browsed the Ruby Style Guide on Github