Skip to content

Instantly share code, notes, and snippets.

#Materialize

####Sick of using Bootstrap?

  • What is Materialize/Material Design?
  • Things to know (similarities and differences compared to Bootstrap)
  • To CDN or not to CDN
  • Noteable CSS Features
  • A few cool Components/JS Features
  • Additional Resources
1. Describe the request-response cycle (start with the client making a request).
* The client sends a request to the server with a verb (GET) and a path (/tasks) that it wants to ineract with.
* The server/router accepts that request and sends it to the controller.
* The controller routes the request to the proper location with the proper action (get, post, etc.)
* If the request requires pulling informaiton out of the database then the controller passes the request to the models, which then fetches from the database and hands it back to the controller.
* The controller then passes the available information over to the views, and the views build a page with the requested info.
* The views send the page back to the controller, where it renders HTML that gets sent back to the server.
* The server then sends a response to the client with information about whether the request was successful or not -- and if so, it passes the html in though the response body.
  1. What is the purpose of the router in a Rails project?

It's the doorman to your app a.k.a. --> it handles all incoming requests and routes them to the correct place, controller, etc.

  1. What routes would be provided to you with the line resources :items?

get "/items" => "items#index"

get "/items/:id" => "items#show"

ActiveRecord
1.) What is the difference in using find vs find_by? Find takes 'id' as an argument and returns that record. Find_by can take any argument from the table and return the corresponding record.
2.) Why use where over find_by? Where will return multiple active record associations, while find_by will only return one.
3.) What does pluck do? Pluck returns an array of elements from a particular column.
4.) Describe joins. Joins pulls in information from multiple tables.
5.) Describe includes. Retrives all records that match a given query?
RSpec:

Setting Group Expectations

Group Member Names: Edgar, Matt R., Matt S.

  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? We'll shoot to work after school most days, trying to accomodate little schedule differences as they come. Flexible on weekends.

  2. How will group members communicate? How often will communication happen, and how will open lines of communication be maintained? Started a slack chaneel #Mattgar + texting. Anytime we separate to work on home, we'll plan on checking it at the end of each day to realign/help each other with problems they're having. We'll likely be pairing together most of the time, with the exception of smaller/repetitive tasks. Shoot to set mini-milestones/goals and chip away at those instead of falling behind or getting overwhelmed with the scope of the entire project.

#Asset Pipeline
###What does it do?
* Concatenation
* Minification
* Precompiling

##Leap My code: here

  • Responder #1 (here) - This responder showed that I could've written a much shorter function by condensing my if statements. By combinig all of my conditionals, I could've significantly reduced the number of lines that I needed to write.
  • Responder #2 (here) - This responder did a hybrid between the code I wrote and what Responder #1 wrote. This version is slightly less verbose than mine, but still not as clean as Responder #1's.
  • Responder #3 (here) - This is my favorite implementation yet ;). if(year === 2015) { return false; } Seems like it got the tests to pass, but won't work for any year other than 2015.
  • Responder #4 (here) - Lots of if state

Javascript Basics

  • Inside of a method — indeed, inside of any function — there is a special keyword available to us: this. It refers to the object that is the context in which the function was called.

  • You can force the meaning of this to be what you want it to be, using the .call() or .apply() method on the function itself.

  • With a var person and a function called sayIt, we can force the function to act upon the person variable. sayIt.call( person, 'Hello', '!!1!!1' );

  • As it turns out, most values in JavaScript are truthy — in fact, there are only five values in JavaScript that are falsy:

    • undefined (the default value of declared variables that are not assigned a value)
    • null
  • NaN ("not a number")

Array Prototype Methods

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

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

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

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.
Yes.

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