Skip to content

Instantly share code, notes, and snippets.

@jecrockett
jecrockett / cfu_crud_in_sinatra.markdown
Last active December 2, 2015 16:12 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.
    • Create, Read, Update, Delete
  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.
    • get '/' --> Serves as the index/list of "things"
    • get '/new' --> Renders form used to create new "thing"
    • post '/' --> Creates thing and redirects to "get '/'"
    • get '/:id' --> Renders view of individual "thing"
    • get '/:id/edit' --> Renders view of form to edit "thing"
    • put '/:id' --> Updates "thing" and redirects to "get '/:id'"
    • delete '/:id' --> Deletes "thing" and redirects to "get '/'"
1. The Agile model promotes a constant, circuitous process that favors functional finished products and iterations to build upon those products over a single, long-term linear process with little room for adaptation.
2. The Agile model is probably so popular because it promotes more communication between the client and the developers, flexibility regarding requirements, and improvements via learning and trial/error.
3. My instinct would be that it is applicable in all industries, though I wouldn't be surprised if there's an exception.

Big O Notation

Overview

  • What is Big O Notation? What does it measure? (Time and Space, we're going to focus on time today)
  • How can we use it? (technical interviews, plus like, writing code every day)

Core Examples

  • O(1): 'Constant time'
  • O(n): 'Linear time'
  • O(n^2): 'Quadratic time'

Room Temperature (working title)

Pitch

Quickly check the temperature, or general tone/sentiment, of a Slack channel to gauge the morale of a given team or project group.

Problem

It's important for managers to be aware of their team's morale, but time-consuming to keep up to date on every post in a Slack channel. Often times large chunks of messages go unread, and it's easy to miss a big success or major complication.

Which of Sandi's rules do you feel like might be the hardest to follow—why?

The hardest for me is for controllers to only instantiate a single object, just only passing a single instance variable to a view. I often find myself sending 3 or 4 instance variables in as various models compile information for a view. Seems like that's not what Sandi recommends. Instead, it seems as though I should use presenter type objects to compile that information, and pass an instance of that presenter to the view.

Exercism Review

Bob

My Solution

  • 1 - Looks cleaner than mine, though I like that I set up variables to make the code more readable. I also like my .match method better than his .search method for checking to see if the input has letters.
  • 2 - Again, I prefer my way of setting up the variables so that it's clear what everything tests. I prefer the .trim() method to testing for /\S, which I assume is whitespace.
  • 3 - I like how readable it is. It's super broken out into abstrations. It's too much though, I think the functions are unnecessary -- those can simply be saved in variables.
  • 4 - I don't think this one will work. It relies on the '!' input to return 'Whoa

Which sections were interesting?

  • The initial chapter 3 'quirks' were interesting, as was a lot of the explanation regarding function expressiona and declarations.
  • Objects and their properties -- Feel like I'm starting to mentally put together what OOP will look like with JS
  • The fact that the inverse of 'strict mode' is called 'sloppy mode', at least in chap 17.

Which sections did you totally skim?

  • By the third "variation on IIFE" section I started to skim those.
  • Property attributes and property descriptors. The "advanced topic. You normally don’t need to know how they work." suggested it might not be worth my time. Already felt like info overload.
  • Most of the rest of chapter 17.
@jecrockett
jecrockett / package-management.markdown
Created March 24, 2016 21:27 — forked from rrgayhart/package-management.markdown
The Dangers of Using Code You Don't Control

JavaScript Functions

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

  • Well, at least one of them. Function declarations are hoisted, but with variables only the declaration (NOT the definition) is hoisted, so the variable still isn't defined until the code gets there.

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

  • global object

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

  • it's the object.
@jecrockett
jecrockett / require.markdown
Last active April 5, 2016 14:46 — 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?
  • Modules are small chunks of your application that serve a specific purpose (cite: 2nd article). It's basically a group of functions/variables that are related and belong in their own separate file. I think of it like a class but I don't know if that's technically the right way to think of it.