Skip to content

Instantly share code, notes, and snippets.

Air Alert

Pitch

This application is extremely important to people who are sensitive to air pollution or care about the enviroment and want to know ways to reduce their impact on air pollution.

Problem

There is currently no immediate notification system for air quality alerts.

Ideal User
  • Person with asthma
  • Parent
  • Senior
  • Activist
  • Healthcare worker
  • Athlete
Habits

Leap

my code

  • (code) This submission did not use the modulus operator, but instead checked if the result of dividing by a number was an integer.
  • (code) I liked this one because he created a method for checking if the year was divisible by a given number, it cleans the code up a lot.
  • (code) This solution doesn't take advantage of the fact that the bunch of logic will already return a boolean, no need to explicitly return true or false.
  • (code) Extremely similar to my solution, except that they are using == instead of the ===, which makes the code more readable, but might not be a good idea. I ran across this [resource](https://github.com/getify/You-Dont-Know-JS/blob

Methods can be no longer than five lines of code.

I feel like this one is always tricky for me, it has forced me to keep thinking about how to refactor more, so my code has definitely improved since when I first started at Turing, but it's still really hard for me.

Controllers can instantiate only one object.

I almost made this one my first choice, because for my personal project I had a multi-model form, and how the heck would I have not passed all those objects to the view? Then I saw her solution to that and it made so much more sense! I could have made a PORO to initialize all the objects for my multi-model form and then initialize that in the controller and send it off to the view.

Respond in the comments of this issue with:

  1. What is something you learned that was particularly surprising/interesting?
  • I didn't know that if you don't specify the var before declaring a variable in javascript, it will be a global variable. That seems a little dangerous if you forget that!
  • I also did not know that $() will always return a jQuery object even if the selector isn't found (so you want to look at the length of the array that's returned to make sure it's not empty)
  • Namespaced events seem incredibly useful.
  • The event object is also very cool.
  1. What was something you already knew?
Discuss Speaking JavaScript, especially following chapters here:

Chapter 3: The Nature of JavaScript

  • "And you can directly create objects, without creating an object factory (e.g., a class) first." I never thought about this until now.
  • "It fails silently." Yikes!
  • "it has no block-scoped variables." I thought let allowed you to declare a variable within the scope of a block?
  • What do you expect for a language that was written in 10 days? It's not perfect!
@bethsecor
bethsecor / package-management.markdown
Last active March 24, 2016 19:47 — forked from rrgayhart/package-management.markdown
The Dangers of Using Code You Don't Control

The Dangers of Using Code You Don't Control


Checks for Understanding

  • In broad strokes, summarize the event

    • A guy had created an open source npm package called kik and and a company called Kik asked him if he could change the name of his package. In my opinion neither party handled the situation very professionally so I'm not surprised this happened. The guy who created kik got so upset that he unpublished all of his packages, one of which included left-pad. Apparently many applications depended on this package, so for about 3 hours they were all down until npm "un-unpublished" the package to fix everything.
<div itemscope itemtype="http://schema.org/Movie">
<h1 itemprop="name">Avatar</h1>
<div itemprop="director" itemscope itemtype="http://schema.org/Person">
Director: <span itemprop="name">James Cameron</span> (born <span itemprop="birthDate">August 16, 1954</span>)
</div>
<span itemprop="genre">Science fiction</span>
<a href="../movies/avatar-theatrical-trailer.html" itemprop="trailer">Trailer</a>
</div>

JavaScript Functions

I can explain the difference between function declarations and function expressions.

  • Yes!

I can explain what the value of this is in a normal function.

  • global window
@bethsecor
bethsecor / require.markdown
Last active March 31, 2016 03:44 — forked from rrgayhart/require.markdown
The Concept of Require

When you start working with WebPack for GameTime, you'll notice that you can't just define a variable in one file and find it in another as easily as you can in Rails.

Read Node.js, Require and Exports and Organize Your Code with RequireJS

Fork this gist and answer the following questions:

  • In the context of Node, what is a module?
  • A module is a piece of your javascript code that could contain a class, or functions, or variables that are common or related to each other and warrant their own file.