Skip to content

Instantly share code, notes, and snippets.

View alirezaandersen's full-sized avatar
💭
Copy and Paste! Thank you Stack Overflow!

Ali Andersen alirezaandersen

💭
Copy and Paste! Thank you Stack Overflow!
View GitHub Profile
@alirezaandersen
alirezaandersen / pr-template.md
Last active July 18, 2016 17:39 — forked from rrgayhart/pr-template.md
Modified Quick Left PR Template

What's this PR do?

This PR is based on refactoring the quality.js - their were two places to in which repetitous code was used. 

Where should the reviewer start?

The reviewer

How should this be manually tested?

  There is no javscript testing for qaulity.js

Any background context you want to provide?

Code is much cleaner and easier to follow. 

Screenshots (if appropriate)

Totally not appropriate ;-)

Models, Databases, Relationships in Rails

What is the difference between a primary key and a foreign key? Where would we find a primary key? What would it be called by default? Where would we find a foreign key? What is the naming convention for a foreign key?

Primary key is the main key that determines the identity or uniqueness of the entry in a table Foreign key is the primary key for another table that is directly related to the current table

Write down one example of:

  • a one-to-one relationship.
  • spouse-to-spouse
@alirezaandersen
alirezaandersen / cfu_crud_in_sinatra.markdown
Last active March 23, 2016 04:10 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.

*Create, Read, Update, Delete

  1. 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 + "/something" renders and lists all, usually in a index view; get + "/something/:id" renders an item at a time; get + "/something/new" renders a viewable form for input; post + "/something" allows an input to be submitted, and then this is redirected to a index;

Introduction to Sinatra

1. What is the purpose of the server file (routing)?

The server is a file that allows the receiver and the responder to give and get the proper out put based on the verb (POST, GET, PUT, DELETE) and the path. Whatever you put in your server file determines what the client gets back.

2. How do you pass variables into the views?

The variable that you are trying to pass needs to be considered in the “Get block” erb represents the file that you want to view