Skip to content

Instantly share code, notes, and snippets.

View ToniRib's full-sized avatar

Toni Rib ToniRib

View GitHub Profile

JavaScript Functions

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

  • Function declarations do not declare var with a name before the function prior to the function keyword like function expressions do. With the expression, you cannot make a call to a function that is declared later in the file or it will throw an error because only the var part is hoisted to the top of the file, but the value of that (which is going to be a function) is still undefined. All function declarations (named functions) will be hoisted to the top of the file, so you can use them even before you actually defined them in the file.

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

  • global window

I can explain what the value of this is when called from the context of an object.

  • the object
@ToniRib
ToniRib / package-management.markdown
Last active March 24, 2016 15:07 — forked from rrgayhart/package-management.markdown
The Dangers of Using Code You Don't Control
@ToniRib
ToniRib / es6.markdown
Last active March 23, 2016 15:54 — forked from rrgayhart/es6.markdown
es6 - 1510

Throughout the module (and your journey to Google enlightenment while working on IdeaBox2.0) you may notice a few different ways that JavaScript code is being written.

That might have something to do with something called ES6 and ES5

Fork this gist and answer the following questions:

  • What is ES6?
    • ES6 is "ECMAScript6" which is the next iteration of ECMAScript (aka what we commonly refer to as JavaScript). It has a bunch of cool features like string interpolation (finally!!!) and browsers are currently working on support for it. Apparently the official name is now also "ECMAScript2015." ES5 came out originally in 2009.
  • What is Transpilation and how does it relate to ES6?
  • Transpilation is the process of converting ES6 code to ES5 code. This can be done with a tool like Babel. This allows developers to write ES6 that can still run on browsers that might not support all of the functionality yet. Thus, you can take advantage of the updates from ES6 without having to worry about whether or

Array Prototype Methods

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

  • Yup. It's weird, but super flexible. I like the idea of being able to omit arguments that I don't need.

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

  • Blocks in ruby and anonymous functions in JS both can arguments of some type (often a collection) and will run some code related to those arguments. In JS we can pass arguments into an anonmyous function and do something with them inside of that to return some value, which is very similar to ruby. In the same way that we can pass a block to .each in ruby, we can pass an anonymous function to .forEach in JS.

Where are the methods available to all arrays (e.g. forEach, map, etc.) defined?

@ToniRib
ToniRib / setting_expectations.markdown
Last active January 11, 2016 17:31 — forked from rwarbelow/setting_expectations.markdown
Setting Expectations - Little Shop of Orders

Setting Group Expectations

Group Member Names: Toni Rib, Brenna Martenson, Taylor Moore

  1. When are group members available to work together? What hours can each group member work individually? Are there any personal time commitments that need to be discussed?
  • Toni: Tuesdays w/Toni 4:15-5:45pm, Thursday w/Alex 4-5pm, next Wed w/Alex 4-5pm, next Thurs w/mentor 5pm-7pm, Horace bitcoin 4pm-5pm
  • Taylor: mentor meeting at some point, probably Wed or Thurs
  • Brenna: friend in town on Thursday, dinner at some point with them
  1. How will group members communicate? How often will communication happen, and how will open lines of communication be maintained?
  1. What is the purpose of the router in a Rails project?
  • The router is used to take the incoming verb & path and find the corresponding controller action to run.
  1. What routes would be provided to you with the line resources :items?
  • All seven of the restful routes related to items, which would be:
    1. GET '/items'
    2. GET '/items/:id'
    3. GET '/items/new'
    4. POST '/items'
  1. GET '/items/:id/edit'
@ToniRib
ToniRib / week-2-diagnostic.markdown
Last active December 11, 2015 16:32 — forked from rwarbelow/week-2-diagnostic.markdown
Week 2 Diagnostic
  1. Describe the request-response cycle. Start with the client making a request.
  • The client makes a request which gets routed to the DNS. The request includes headers which have an HTTP verb, a path, and other relevant information. The DNS server tries to resolve the path, and if it cannot, it passes it off to other servies (like the .com server) that will eventually resolve the request and pass the ip address of the correct server back to the client. The client can then send the request to the correct server. Once the server receives the request, it processes it based on whatever was in the request and compiles a response which consists of a status code, other headers, and a body which is a string of HTML if something is going to be rendered (or some other string based on whatever the request was). The client can then render the string to the screen for the user.
  1. Explain when each of these HTTP verbs would be used: GET, POST, PUT, DELETE.
  • GET: get information from the server to view on the screen
@ToniRib
ToniRib / cfu_crud_in_sinatra.markdown
Last active December 2, 2015 15:44 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.
  • the conventional way to interact with a database: create, read, update, delete
  1. 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.
  • GET + /tasks - show all of the tasks
  • GET + /tasks/:id - show one task
  • GET + /tasks/new - show form to create a new task
  • POST + /tasks - create the new task
  • GET + /tasks/:id/edit - see the update task form for a specific task
  • PUT + /tasks/:id - update the task in the database
  • DELETE + /tasks/:id - delete a specific task