Code Challenge: What’s Wrong With This Game?

Photo of someone typing code

Since the start of 2015, I’ve been working on some JavaScript courses on Treehouse and elsewhere. In an effort to improve, I’m going to do a JavaScript code challenge every Monday for at least 10 weeks. Here’s the first one. I would love feedback in the comments!

Here is a link to the original problem on Interview Cake. In short, you have the following code. The syntax is correct, but the behavior is off.

<button id="btn-0">Button 1!</button>
<button id="btn-1">Button 2!</button>
<button id="btn-2">Button 3!</button>

<script type="text/javascript">
    var prizes = ['A Unicorn!', 'A Hug!', 'Fresh Laundry!'];
    for (var btnNum = 0; btnNum < prizes.length; btnNum++) {
        // for each of our buttons, when the user clicks it...
        document.getElementById('btn-' + btnNum).onclick = function() {
            // tell her what she's won!
            alert(prizes[btnNum]);
        };
    }
</script>

It didn’t take me long to figure out the actual issue, but the solution was a different story. It eluded me for several minutes. Here’s my solution minimized.

[Read more…]

How to Take a Successful Vacation

beach

Confession time: I’m not great at taking time away from work.

In April of this year, my wife and I took a vacation, our honeymoon actually. We spent two weeks in Greece eating whatever we wanted, drinking far too much, and sightseeing whenever we felt like it.

We had an absolutely amazing time, and I certainly wouldn’t trade it for anything. But, it was hard.

My initial goal was to disconnect 100%. I didn’t bring my laptop. We didn’t have a cellular signal. I turned off email on my phone. Coworkers knew that I was completely out of touch.

That’s how it started at least.

[Read more…]

Take a Regular Learning Vacation

Darwin Quote

For the past three months, I’ve focused on one thing – learning JavaScript. I put aside all freelance work and committed to at least 30 minutes per day. I called it my “learning vacation”. I might have started at (just above) ground zero knowledge-wise, but by golly, I was going to make some progress.

How did I do? I completed the Treehouse Front End Web Development course, which covered JavaScript and jQuery. I hacked away on a GitHub project and managed to get everything working (still some improvements I want to make). I’m not ready to lead a development team, but I have a better idea of how JavaScript works and can fumble my way around a project.

There were some frustrating nights and mornings spent staring at a computer screen hoping an answer would pop out at me. I read more StackOverflow threads than I would care to admit, and my Google searches grew more and more desperate. I wanted to quit more than a handful of times.

[Read more…]

Closing The Expert Gap

Don't Just Stand There

Since it’s just you and me here, I’ll admit a secret: I really hate being terrible at something.

When I try to pick-up a new skill, I take a look around at people that have been doing that “thing” for years, and I immediately want to be on their level. I want the instant gratification of being excellent instead of slogging through years of being terrible.

For the better part of the past three months, I’ve focused all of my free time on one thing – learning front-end web development, specifically JavaScript. I enrolled in a front-end course on Treehouse. I subbed out fiction before bed for Eloquent JavaScript so I could dream in for loops and if statements.I stopped writing blog posts and told all of my freelance clients I was busy.

Here we are at the end of three months of full immersion and guess what? I’m nowhere near where I thought I would be.

[Read more…]

The Importance of Self-Learning and 5 Key Steps to Put Into Practice

photo-1416339684178-3a239570f315

Genius is the ability to independently arrive at and understand concepts that would normally have to be taught by another person.

― Immanuel Kant

We’re born as self-learners. As children, we rely heavily on our ability to learn from our surroundings and the actions of others. As adults, however, it’s easier to pass the buck onto others and ask for help rather than to spend the frustrating hours, days, or weeks learning ourselves. Our innate ability to learn and adapt becomes dull.

When I posted my “Day in the Life of a Happiness Engineer” post, I had quite a few friends reach out asking how they could score the same type of job. Many of these individuals came from a completely non-technical background so landing a job in the tech industry seemed like a long shot. They didn’t have experience in tech, and it didn’t seem like something you could just “pick up.”

That, of course, isn’t true.

Regardless of your background, it’s completely possible to learn a new career field. Hell, it’s possible to learn anything. Perhaps more importantly, it’s possible without going back to school. Heading back to formal education is a knee-jerk reaction and isn’t necessary unless your intended career field has some sort of required credentials.

If formal education isn’t necessary, what exactly is the secret sauce to self-learning? Here are five keys I’ve put into practice myself.

[Read more…]

5 Lessons I’ve Learned From One Year at Automattic

Automattic

As of a few days ago, I’ve now been working for Automattic, makers of WordPress.com, for just over a year. It’s hard to believe that just a short time ago, I was ending my trial and starting full-time on a product that I both love and believe in.

I’ve written quite a bit about the trial process and what a day in the life of a Happiness Engineer looks like. But, I haven’t written much about insights working for a distributed company or how I now view customer support. In other words, what I’ve learned over the past year working at Automattic. In no particular order, here are the top five items.

[Read more…]

A Day in the Life of a Happiness Engineer

2014-company-animated

This week, many of us at Automattic are documenting our day to give everyone an idea of what it’s like to work for an entirely distributed company. If you’re interested in reading more you can follow the tag #a8cday at WordPress.com and on Twitter. Here’s my day as a Happiness Engineer.

Whenever I tell someone I’m a Happiness Engineer, I normally get a blank stare followed by one of two reactions:

  1. The person pretends like they know what that means and no further questions are asked.
  2. A short chuckle ensues with the follow-up question, “So, what does that mean?”

I definitely understand. Before working at Automattic, I had no real idea what a Happiness Engineer might do.

So, what does a Happiness Engineer actually do on a daily basis? The short answer: we do whatever it takes to make the user experience as great as possible at WordPress.com. For those that want more, here’s my complete schedule from October 6th, 2014 to give you an idea of what it’s like to work for a company that is 100% distributed.

[Read more…]

How to Make Better Decisions Based on Science

83H

This post was originally written for the Crew blog.

2+2=

Unless you’re a cyborg, you couldn’t help but think of the number “4″ when you saw the above expression. In the same way, the partial phrase “bread and” leaves you with the word “butter” on the tip of your tongue. That’s no accident.

Our brains make thousands of decisions every day. Many of them (like whether you want cream and sugar in your coffee) seem to be automatic. Others (like where you want to go for dinner) can be a bit more taxing and require mental effort.

Research has identified two seemingly separate “systems” of the brain responsible for decision-making. In order to make better decisions, we need to understand what each of these systems is responsible for and how we can shift from one to the other.

[Read more…]

How to Become More Creative

SONY DSC

This post was previously published on the Crew blog.

How many uses can you think of for a paperclip in three minutes?

If you’re average, you’ll probably be able to drum up 10 or perhaps 20 different uses. I came up with 11. The somewhat famous paperclip test was created in 1967 by J.P. Guilford as a measure of divergent thinking. It’s part of a group of assessments known as ‘alternative use tests’ which measure creativity.

Incomplete Figure Start

 

The above example shows a common incomplete figure exercise. This test asks users to complete the picture in each window. This is another test of divergent thinking, the more creative you are the more interesting the results tend to be (see below).

Incomplete Figure exercise

 

Creativity is often viewed as something you either have or you don’t. But that’s not entirely true, according to a study completed by Harvard, creativity is 85% a learned skill. That means we can improve. The question is how?

[Read more…]