• Posted on

    Devember Day 8

    Started working through the micro reddit client, working through things Test Driven and trying to implement as many best practices as I could from Blindside to try and make the app more standardized compared to how I’ve been writing things in the past. Doing things test first has definitely slowed me down but I know that it is really useful for me to learn like this for the future.

  • Posted on

    Devember Day 7

    Back to the Odin Project today, I spent a lot of time working through association data problems in the lead up to the next big project which is creating a micro reddit client. Worked through a lot of different data modelling exercises.

  • Posted on

    Devember Day 6

    Finished up Blindside today, building form_for with Rails helpers and test driving the views.

  • Posted on

    Devember Day 5

    The next two videos in Blindside today, rolling out some TDD while building custom Rails models as Ruby classes.

  • Posted on

    Devember Day 4

    Today was my birthday! I spent the whole day at disneyland so instead of being able to be on my computer and work I watched the start of a video series that made friend made called Blindside. It basically is walking through making a project in Rails from scratch from the perspective of an epxerienced dev talking through all of the things that he does. I watched the first two videos today, which started at registrations.

  • Posted on

    Devember Day 3

    More time spent with ActiveRecord today and working through associations and validations.

  • Posted on

    Devember Day 2

    Back at The Odin Project again today but I moved on past the SQL I was doing yesterday and spent all moring working on ActiveRecord. I made it through the ActiveRecord rails guide, Migrations, and Validations over the course of about 3 hours. I still have one more section on associations left on this learning module and I wanted to approach it with a clear mind so I decided to stop for the day and start fresh with associations tomorrow since it is something that is a little more challenging for me to wrap my head around.

  • Posted on

    Devember Day 1

    After a long time away I’ve decided to pick back up on the programming journey with The Odin Project. This is being motivated by the Devember movement that I found on r/learnprogramming. The goal of Devember is to spend at least one hour a day programming and then a short amount of time after that writing up the progress that was made everyday for the month of December. My goals are relatively simple for this month: Work through as much of the rails section of The Odin Project as I possibly can.

    Today I was working through the SQL section as a review and to get myself back up to speed so I can dive in to the meaty sections of The Odin Project over the next month. First up was SQL Teaching which was relatively easy until I got to multiple joins. After scratching my head with incorrect output for a while I started getting the general idea of multiple joins linking 3 tables together. After that I worked through SQL Bolt which was much more in depth and significantly slicker. I felt like SQL bolt was a great second resource because I wasn’t so focused on learning the initial concepts but could spend more time on each lesson focusing on the things that it added as well as having a second chance to drill through everything from SQL Teaching. Overall I think it was a very solid first day and while I didn’t spend any time in my editor I feel like it was the right amount of knowledge to get me started and hungry for more. See you tomorrow for day 2.

  • Posted on

    Ruby Retrospective Part 2

    Part 2 of my Ruby retrospective discussing my progress through The Odin Project!

    Link to part 1.

    Stock Picker

    Another relatively simple project, this time my first project to make my own method calls within another method. Looking back this solution doesn’t particularly scale very well over a larger amount of data points, each new value in the array causes the program to iterate through the rest of the array. I’m not sure how to optimize this to be less intensive so any ideas would be very helpful here.

    Original code:

    def stock_picker(price_array)
    i = 0
    lowest_day = 0
    greatest_difference = 0
    while i < price_array.length - 1
    difference = find_highest_difference(price_array, i)
    if difference > greatest_difference
    greatest_difference = difference
    end
    i += 1
    end
    puts greatest_difference

    end

    def find_highest_difference(previous_array, place_in_array)
    highest_difference = 0
    while place_in_array < previous_array.length
    i = place_in_array + 1
    while i < previous_array.length
    if previous_array[i] - previous_array[place_in_array] > highest_difference
    highest_difference = previous_array[i] - previous_array[place_in_array]
    end
    i += 1
    end
    place_in_array += 1
    end
    return highest_difference
    end

    With some easy ruby fixes:

    def stock_picker(price_array)
    i = 0
    greatest_difference = 0
    while i < price_array.length - 1
    difference = find_highest_difference(price_array, i)
    if difference > greatest_difference
    greatest_difference = difference
    end
    i += 1
    end
    greatest_difference
    end

    def find_highest_difference(previous_array, place_in_array)
    highest_difference = 0
    while place_in_array < previous_array.length
    i = place_in_array + 1
    while i < previous_array.length
    if previous_array[i] - previous_array[place_in_array] > highest_difference
    highest_difference = previous_array[i] - previous_array[place_in_array]
    end
    i += 1
    end
    place_in_array += 1
    end
    highest_difference
    end
  • Posted on

    Ruby Retrospective Part 1

    This will be a long multipart series looking back at the work I did during the Ruby section of The Odin Project. None of this is particularly correct, but I figure that documenting my progress will be a hilarious time capsule of what I struggled with and how much more I can improve things in the future.

    Caesar Cypher

    The first project was Caesar Cypher.

    This is my original solution:

    def caesar_cipher(input_string, number_shift)
    output_array = []
    input_string.scan(/./) do |match|
    if match >= "A" && match <= "Z"
    shift_character = match.ord + number_shift
    if shift_character > 90
    shift_character = (shift_character % 90) + 64
    end
    output_array.push(shift_character.chr)
    elsif match >= "a" && match <= "z"
    shift_character = match.ord + number_shift
    if shift_character > 122
    shift_character = (shift_character % 122) + 96
    end
    output_array.push(shift_character.chr)
    else
    output_array.push(match)
    end
    end
    output_string = output_array.join("")
    puts output_string
    end

    The biggest takeaway from this project was ord which was a big sticking point for me initially because odin doesn’t teach it. I also learned match and basic regex in this project. Other than that it is relatively simple, I loop around the edges of the alphabet ordinal ranges to shift the letters depending on the input shift.

    Looking at it now I can definitely simplify some of this logic and make the method return a value instead of putting it on the console. I can also update some of the method calls for a more easily readable chunk of code.

    Updated Solution:

    def caesar_cipher(input_string, number_shift)
    output_array = []
    input_string.scan(/./) do |match|
    if match >= "A" && match <= "Z"
    shift_character = match.ord + number_shift
    if shift_character > 90
    shift_character = (shift_character % 90) + 64
    end
    output_array << (shift_character.chr)
    elsif match >= "a" && match <= "z"
    shift_character = match.ord + number_shift
    if shift_character > 122
    shift_character = (shift_character % 122) + 96
    end
    output_array << (shift_character.chr)
    else
    output_array << (match)
    end
    end
    output_array.join("")
    end

subscribe via RSS