Skip to content

Instantly share code, notes, and snippets.

View GregoryArmstrong's full-sized avatar

Gregory Armstrong GregoryArmstrong

View GitHub Profile
@GregoryArmstrong
GregoryArmstrong / testable-js.markdown
Last active April 6, 2016 01:13 — forked from rrgayhart/testable-js.markdown
Writing Testable JavaScript

Consider the four responsibilities that Rebecca lists for client side code (hint: they're color coded).

  • Did any of the responsibilities that she lists surprise you?
  • I've never quite thought of them in these exact divisions, but they're not too surprising to see. If I had to pick one as the most surprising, I'd say the setup responsibility. In my mind everything is set up by the server and just presented to the client, who then sends a response. But I suppose now that I see it listed by Rebecca, there is some inherent setup on the client side to take what information has been delivered by the server, and execute it / get it ready to be shown to the client.
  • Do you feel like you mentally split your client side code in IdeaBox and other past projects into these responsibilities?
  • Yes except for the setup, for the same reason as the previous answer. I'll begin to try and think of my code in these four divisions for the next project.
@GregoryArmstrong
GregoryArmstrong / require.markdown
Last active April 4, 2016 18:25 — forked from rrgayhart/require.markdown
The Concept of Require
  • In the context of Node, what is a module?

Answer: A module is essentially just a file in Node. You export what you want to be available when requiring the file.

  • The code examples from the second blog post look very different from the first. Why?

Answer: Theyre using RequireJS to add some functionality specific to their scenarios.

JavaScript Functions

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

-- Yep! A function declaration is parsed through by JS and hoisted to the top. It can actually be located at the bottom of the file, but able to be used and referenced beforehand due to hoisting. A function expression is more akin to a typical Ruby variable, it's name is hoisted to the top by not defined until the function expression is actually run.

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

-- Global window.

Array Prototype Methods

I understand that functions in JavaScript can take any number of arguments.

  • Sure do! Flexibility is cool!

I can describe the similarity between blocks in Ruby and anonymous functions in JavaScript.

  • They are essentially the same. A bit of code which is to be run by the method / function but doesnt need to be accessed outside of it.
@GregoryArmstrong
GregoryArmstrong / cfu_crud_in_sinatra.markdown
Last active December 2, 2015 15:51 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.

    • Create, Read, Update, Delete. Describes the type of actions one should be able to do to the database.
  2. There are seven verb + path combinations that are necessary in a basic Sinatra app in order to provide full CRUD functionality. List each of the seven combinations, and explain what each is for.

      1. See all: '/tasks' + GET
      1. See one: '/tasks/:id' + GET
      1. Form to create (part 1): '/tasks/new' + GET
      1. Create from form (part 2): '/tasks' + POST