Craig Rodrigues!


Learning to Code: Week 30

December 01, 2016

In the job search, a huge part of success is doing well on "technical interviews," which is where companies put you in front of a whiteboard (or an online code editor for first-round phone screens) and ask you questions about data structures and algorithms. I studied these types of questions prior to entering the course. How to arrive at the solution, how to best implement them in JavaScript, how to sketch them out in diagrams, etc.

A good site for beginner-level questions is since they let you see other people's solutions. You'll learn a lot of good language tips this way.

As for JS, it really helped me to have a solid understanding of the following concepts:

  • The this keyword/execution contexts
  • Function prototype methods: call, apply, bind
  • Closures and when to use them
  • Pass-by-reference vs. pass-by-value
  • ES6 stuff: Arrow functions, rest parameters, spread operator, destructuring, const and let
  • And be fluent enough with the language to do Underbar parts 1 and 2 (part of Precourse) in under 40 minutes.


    • Just contingent on me passing the assisted pre-course work without a problem.
    • Pre-course work is the same, just if I had 100% passed I would have to do it solo (6 weeks time) versus two weeks of focus guided work.
    • Very few people pass the first interview, but I did.
    • I made a pro/con list of what to do. There is very little reason for me to interview a second time except to boost my ego and do better.
    • I START FEB 6TH, 2017

December 02, 2016

  • Reality is setting in - I see the massive wall I’m up against. I know I can learn anything with the right mindset and perseverance though! (Also with some good teaching/support)
  • Wonder if I can see these recorded panels:
  • Need to make a timeline of what my next moves should be and what to spend the next 6 weeks really trying to learn. Tentative list below:
    • HTML & CSS
    • Git & Github
      • jQuery
        • Code School
        • Watch and Code
        • A framework (Angular/React)
        • TDD
          • Watch and Code
          • Algorithms
            • Grokking Algorithms
            • Coursera
            • Frontend Masters
            • Google devtools
            • Classes
            • Command Line
            • Advanced JS

December 03, 2016

  • Had a dream about the CodeWars problem from last night and rewrote it, and solved in 5 minutes this morning using a simple WHILE loops instead of trying recursion. Also came up with a simpler way to check for one digit numbers. Sleep does wonders.
  • Adding more weekly reports to my blog.
  • Ran through this CodeWars Problem: Array Helpers
    • It reinforced how to add functionality to built-in prototypes. Forgot about using “this”
    • I completely forgot about map and filter. WTF!
    • Finally got caught up adding my blog posts to my website here.
    • Started my timeline on some printed out calendars.
    • Made a Trello board on the topics I need to cover and 3 resources for each.
      • I will only have one intro course per list. Always forward.

December 04, 2016

  • More planning out my courses to take.
  • Started Code School: HTML & CSS  - Front-end Foundations
    • Level 1: HTML completed
    • Level 2: CSS completed
      • Pseduo-selectors and first-child selectors
      • The box model.
      • Content, padding, border, margin.
Box Model
Box Model

December 05, 2016

  • Code School: HTML & CSS
    • Level 3 COMPLETED:
      • Write class and type selectors in the right order. General tags go up top. Classes below it.
      • Move the css info a main .css file.
      • You can link it in your HTML with the <link> tag. It doesn't have a closing tag!
      • <link rel="stylesheet" type="text/css" href="theme.css">
      • There are a shit-ton of CSS properties that can be used!
      • Trying toggl to track my time. It has pomodoro capabilities, but it can also track what sites I'm on and keep track of what "project" (subject) that I am currently working on. Very nice.
      • Also starting to take hand-written notes while watching these lectures. A lot of research shows the hand-writting is much better than using typing/text. Also it's very difficult to switch from the video to google docs/notes to write stuff down. It makes no practical sense.
      • Code School: HTML & CSS
        • Level 4 - Images COMPLETED
          • 3 types of images: content, layout, user interface
          • <img> tage is an empty tag. No closing tag.
          • Makes sense to put all your images in folders.
          • Alt attribute for images is for accessibility!
          • You can replace h1 with a logo and set it to display as a block in the CSS.
          • Background images are added in css NOT html.
          • Set a background-color property just in case the background image fails to load.
          • You can shorten the background property to one line.
          • Float is a cool CSS property that allows images to be inline with text.
          • Level 5 - Fonts & Forms COMPLETED
            • Font-family property.
            • Can deault settings with font-size to 100% and font: inherit.
            • line-height property is useful.
            • Quotes around fonts with multiple words ("Times New Roman").
            • Submit button is an input tag.
            • Do input tags need to be closed?
            • Build a Portfolio Web Page With HTML and CSS (25 minutes in so far)
            • Listened to JavaScript Jabber #180 - "Finding a Job"
              • The Passionate Programmer.
              • You want to be working with top people and Senior Developers.
              • Be tenacious.
              • Dan's internet is down so we have to push our mentor meeting back a few days. Not sure when just yet.

December 06, 2016

  • Build a Portfolio Web Page With HTML and CSS -COMPLETED
  • Front-end Formations
    • Level 1 - COMPLETED
    • I paid my $2,000 deposit for Hack Reactor.
      • I must assume that I will not get the scholarship, so I have started looking at lenders to get some rates.
      • I will also check with some local big banks (Wells Fargo, BoA, etc).
      • If I cannot solve or figure out a CodeWars problem within 15-20 minutes I will look at the solutions then go over it in detail to understand it deeply.
        • Once I do that I will go back and try to redo the problem from memory.
        • Explaining solution to CodeWars problem: Simple Events (I should be able to do this in my sleep, but I can't.)


Your goal is to write an Event constructor function, which can be used to make event objects.

An event object should work like this:

  • it has a .subscribe() method, which takes a function and stores it as its handler
  • it has an .unsubscribe() method, which takes a function and removes it from its handlers
  • it has an .emit() method, which takes an arbitrary number of arguments and calls all the stored functions with these arguments

As this is an elementary example of events, there are some simplifications:

  • all functions are called with correct arguments (e.g. only functions will be passed to unsubscribe)
  • you should not worry about the order of handlers' execution
  • the handlers will not attempt to modify an event object (e.g. add or remove handlers)
  • the context of handlers' execution is not important
  • each handler will be subscribed at most once at any given moment of time. It can still be unsubscribed and then subscribed again
function Event() { 
  // constructor property that all events will have that creates an empty array to 
  // hold all the handler functions. 
  this.handlers = []; 

Event.prototype.subscribe = function(handler) { 
  // simple method to push the handler to the handlers array.
Event.prototype.unsubscribe = function(handler) { 
  // need to find the location of the handler in the handlers array and store it
  var index = this.handlers.indexOf(handler);
  // if index is -1 that means it's not in the array
  if (-1 !== index) {
  // remove one element at the index we found. 
    this.handlers.splice(index, 1); 
Event.prototype.emit = function () {
  // get the arguments passed (arbitrary number)
  var args = arguments;
  // iterate over all handler functions 
  this.handlers.forEach(function(handler) {
    // call the functions with apply using null since context doesn't matter?
    handler.apply(null, args); 


  • Started working on Underbar library, except I don't know what the exact specifications are so I pulled from from Github and will call it Underscore Jr.

December 07, 2016

  • Worked on getting Underscore Jr onto github, but can't seem to get it to push correctly.
  • Okay, finally got it to work. Note to self: do not init repo with a Readme file.
  • Underscore Jr
    • Worked on uniq method.
    • I feel there must be faster algorithms to do uniq rather than checking every element in the array?
    • Worked on map method.
    • Working on pluck method.
      • If I forget to return my results one more time!!! 😒
      • Couldn't immediately see my error. When in doubt use the debugger. Problem was I forgot to pass in a second argument.
      • Problem solved in 2 minutes. Yay debugger!
      • I really need to learn how to do testing. Going into repl to test each and every method is a pain in my ass.
      • I got my first email today from someone who found my blog asking how much Hack Reactor interview went. They too were freaking out like I did. 😰
      • Very tempted to enroll in this Codementor class!
        • Did it. Starts tomorrow!
        • Front-End Formations
          • Level 2 - COMPLETED: New HTML 5 elements
          • Level 3 - COMPLETED: HTML5 Forms
Code Certificate


The Hack Reactor Technical Interview