Skip to content

Instantly share code, notes, and snippets.

View dcousette's full-sized avatar

DeShawn Cousette dcousette

View GitHub Profile
@dcousette
dcousette / postgres_cloud9_setup_notes
Last active August 29, 2015 14:23
Getting Postgres to work with Rails in Cloud 9 IDE
Setup ruby environment
use rvm to get to ruby 2.1.1
postgres was installed on cloud 9 - but need to create a user and password
followed blog post on this http://www.gotealeaf.com/blog/how-to-install-postgres-for-linux
w/ a few notes...
sudo sudo -u postgres psql (to get to postgres CL in cloud9)
@dcousette
dcousette / course_2_lesson_3_quiz
Last active March 11, 2016 03:24
Tealeaf Course 2 Quiz: Lesson 3
Tealeaf Course 2 - Lesson 3 Quiz
Quiz: Lesson 3
1. The difference between rendering and redirecting is in what the request actually returns. With a render you are receiving a payload which consists of markup to display on a page along with other code (css, javascript, etc). With a redirect the request is returning a URL, which the browser then knows how to follow (which issues a new request). The impact of these two http return types on instance variables and view templates are that instance variables can only be displayed in a view when rendering a template. Redirects only contain url data for a new request.
2. The easiest way to display a message on the view template when redirecting is by storing a value in the flash and then displaying it in the layout template between requests.
3. The easiset was to display a message on a view template when rendering is to include the message in the template itself using erb, html, or string interpolation.
@dcousette
dcousette / course_2_lesson_2_quiz
Last active August 29, 2015 14:19
Tealeaf Course 2 Quiz: Lesson 2
Lesson 2 Quiz answers
1. Using the resources keyword exposes the following routes:
(ex. resources :posts)
GET /posts posts#index posts
GET /posts/:id posts#show post
GET /posts/new posts#new new_post
POST /posts posts#create
GET /posts/:id/edit posts#edit edit_post
@dcousette
dcousette / course 2_lesson 1_quiz
Created April 13, 2015 03:22
Tealeaf Course 2 Quiz: Lesson 1
Rails Course 2 - Quiz: Lesson 1
1. They call it a relational database because it is used to create, edit, retrieve and store related sets of data.
2. SQL - stands for Structured Query Language, and it is the language used to manipulate a relational database.
3. The two predominate views into a database are: the data view, and the schema view. The data view displays a tables'
columns and the rows it contains. Similar to the view of spreadsheet. The schema view displays information about the
column names in the database and their associated data types.