Skip to content

Instantly share code, notes, and snippets.

View stevepentler's full-sized avatar

Steve Pentler stevepentler

View GitHub Profile
@stevepentler
stevepentler / cfu_crud_in_sinatra.markdown
Created December 1, 2015 20:03 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.
  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.
  3. Why do we use set method_override: true?
  4. Explain the difference between value and name in this line: <input type='text' name='task[title]' value="<%= @task.title %>"/>.
  5. What are params? Where do they come from?
  1. Describe the request *response cycle. Start with the client making a request.
  • oh geez! Client sends request, makes it through rack and middleware, heads to DNS? DNS bounces the message to a few more servers with greater specificity each time. Eventually it locates the server and passes the response back through the rake/middleware to the client.
  1. Explain when each of these HTTP verbs would be used: GET, POST, PUT, DELETE.
  • GET is used to retrieve and display information from the server.
  • POST is used to modify the server by adding information.
  • PUT modifies information that exists in the server with greater specificity than POST.
  • DELETE LOLZ, duh
  1. What are all of the necessary routes for full CRUD functionality in Sinatra app? Why do we need seven routes when there are only four CRUD actions?
  1. What is the purpose of the router in a Rails project?

    • A router redirects the incoming HTTP request to the appropriate controller. It determines what type of information will be displayed and in what context we want to view the information (ex: to view / edit).
  2. What routes would be provided to you with the line resources :items?

    • Resources establishes the seven RESTful routes for the controller.
      • get "/items" => "items#index" INDEX
      • get "/items/:id" => "items#show" SHOW
      • get "/items/new" => "items#new" NEW
      • post "/items" => "items#create" CREATE # usually a submitted form
  • get "/items/:id/edit" => "items#edit" EDIT

Setting Group Expectations

Group Member Names:

  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?
  • JP lightning talk Friday
  • Aaron prep computability theory
  1. How will group members communicate? How often will communication happen, and how will open lines of communication be maintained?
  • Slack group (private)

What does it mean to concatenate files? Find an image of an example concatenated file. Why would we want to concatenate files?

  • To put them together so theyre treated as one. We might want to concatenate to send fewer files for the same amount of data.

What does it mean to precompile files? What does this have to do with coffeescript and sass files?

  • To grab database info all at once for faster successive calls. Coffeescript and Sass files are precompiled so that all of their libraries can be accessed.

What does it mean to minify files? Find an image of an example minified file. Why would we want to minify files?

JavaScript Functions

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

  • Declarations are hoisted to top priority, whereas function expressions are declared but not defined until that line is run.

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

  • global object

Step One: Watch Mary Rose Cook Live Codes Space Invaders from Front-Trends. (The second worst conference name ever?)

Step Two: Fork this gist.

Step Three: Respond to this question in your fork: What is one approach you can take from this Mary's code and implement in your project?

  • I watched the video a few days ago, but it was crucial to undestanding collision detection.

Step Four: Totally Optional: take a look at some of the other forks and comment if the spirit moves you.

@stevepentler
stevepentler / testable-js.markdown
Last active April 6, 2016 04:57 — forked from rrgayhart/testable-js.markdown
Writing Testable JavaScript

Step One: Watch Writing Testable JavaScript - Rebecca Murphey from Full Frontal 2012 (award for worst conference name ever?)

Step Two: Fork this gist.

Step Three: 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?
    • Presentation & interaction
    • Data/server communication
  • application state
@stevepentler
stevepentler / express.markdown
Last active April 18, 2016 14:42 — forked from rrgayhart/express.markdown
Building Express Applications

Web Sockets Lesson Plan

  • Fork this gist
  • Include a link to your application's repo
  • https://github.com/stevepentler/Websockets_Workshop
  • Your repo should have a link to your production app in the README
  • Include questions/comments for anything you'd like us to specifically give you feedback on
  • I completed all the "Your Turn" but I don't thing it's emitting properly. Lets imagine there are 5 users. If user 5 opens a web socket, the poll will be live with the responses from users 1-4. However, the updated poll is not send back to user one when websocket 5 submits the poll. I was fiddling with io.sockets.emit.. but couldn't get it firing.
  • The websockets homework is graded on 'completion' or 'semi-completion' - but we'll try to leave you feedback on anything we see that requires feedback in the gist.