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
- In the context of Node, what is a
module
? - A
module
is a containing element for related pieces of code. Often a separate .js file, modules are used to organize and pass along information to other files using the require() syntax.
- One of the more frustrating aspect of styling a web page is putting HTML elements in the center of the page and making divs line up the way you want. There are multiple ways to do this and in my talk I want to go over why you'd use one vs another.
- Using Float to move elements to the left or right
- Why it's important to use clear: both after using float
I can explain the difference between function declarations and function expressions.
- A function declaration is a named function that is not stored as a variable. An expression is an anonymous function set to a variable.
function logSomething(thing){
console.log('something');
}```
I understand that functions in JavaScript can take any number of arguments.
- I also understand that you can ask for the arguments to be printed to the console if you're confused with what is being considered an argument.
console.log(arguments)
- JS MAGIC!
I can describe the similarity between blocks in Ruby and anonymous functions in JavaScript.
- Ruby functions take blocks like so:
array.each do {|thing| thing.to_s }
which then iterates over said thing and makes it a string. - JS functions take anonymous functions that implicitly call an object, using the "any number of arguments but one of those arguments will be an individual element" idea: ```array.forEach(function(thing){ thing.toUpperCase });
Where are the methods available to all arrays (e.g. forEach
, map
, etc.) defined?
###Sandi Metz's Rules For Developers
Sandi Metz states four rules to maintain good code:
- Classes can be no longer than one hundred lines of code.
- Methods can be no longer than five lines of code.
- Pass no more than four parameters into a method. Hash options are parameters.
- Controllers can instantiate only one object. Therefore, views can only know about one instance variable and views should only send messages to that object.
In my opinion, rule 2 is the most difficult to follow as a new developer. It is difficult to determine when a long method should be broken into smaller methods, especially if its because of a single if else statement. As I learn more about what good code is, my methods are getting progressively shorter. That being said, access to the breadth of knowledge necessary to know how to efficiently navigate around a problem is still a work in progress. It will be an interesting challenge to keep this
- Define CRUD.
CRUD stands for Create, Read, Update, and Delete which are associated with the verbs POST, GET, UPDATE, and DELETE in HTTP.
-
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.
-
READ '/tasks' - GET a view of all tasks from index.erb
-
READ '/tasks/:id' - GET a view of a specific task from show.erb
-
CREATE(pt1) 'tasks/new' - GET a form to create a new task in new.erb
-
CREATE '/tasks' - POST data to the server and redirect to '/tasks'