Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jsm13 on github.
  • I am jsm13 (https://keybase.io/jsm13) on keybase.
  • I have a public key ASDlpYDGK3jIFC_XnZVT42iqS3LR6JahDhK8vNQHjQ6u7go

To claim this, I am signing this object:

When setting up users for an app there are two things we need to consider:

  1. Who is the user? This is authentication.
  2. Given who the user is, what are they able to do/access? This is authorization.

To deal with the first, authentication, we need to set up the following routes. It is very common to put all of these into a router and have that handle an /auth path (profile works too, I'd just already written this).

  • GET /register (show the form for sign-up; don't need this route if the form is on another page)
  • POST /register (checks user info, creates a user, and starts a session)
  • GET /login (shows form for login; again, don't need if this is on a different page)
# What I wrote:
(1..10).inject([]) do |evens, num|
evens << num if num.even?
end
# Error was 'NoMethodError: undefined method `<<' for nil:NilClass'
# This is saying "You are calling the method `<<` on an object that doesn't have a method by that name, `nil` with class `NilClass`"
# I had been thinking evens was an array which would have a push method and on the first iteration
// What is the return value of the below code sample? Provide a sentence or two of explanation.
typeof( 15 );
// number - 15 is a primitive type number.
// What is the return value of the below code sample? Provide a sentence or two of explanation.
typeof( "hello" );
// string - characters within quotes are strings
// What is the return value of the below code sample? Provide a sentence or two of explanation.
typeof( [ "dog", "cat", "horse" ] );
Get from elevator to pbj station
Exit elevator
Turn left
if kitchen is ahead walk straight
if not, turn 180 degrees and walk straight
Stop at kitchen counter
Locate butcher's block
Assemble Ingredients
Locate bread, jelly, peanut butter, butter knife
Place bread, jelly, peanut butter, butter knife beside butcher's block