Basic Code Academy Flashcards

You may prefer our related Brainscape-certified flashcards:
0
Q

What is ruby?

A

A programming language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

To print something on the computer

A

Puts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is rails?

A

Rails is framework to build Webb apps. Like the frames of a house already in place so one can focusing on building the details.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an web app?

A

Any software that runs in a web browser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

name 5 objects

A
Strings
Numbers
Booleans
Arrays
Hashes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name three types of methods

A

Methods
Loops
Control flow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Name three types of classes

A

Classes
Attributes
Instance variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are strings

A

Words or numbers between quotes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are numbers (object)

A

Numbers. Ruby has two types, floats: numbers with decimals like 4.3. And integers: whole numbers, either positive or negative like 75 or -10.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are booleans

A

True or false statements. 1==1 is true. 1==5 is a false statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How is a variable with strings declared?

A
a = "apple".
a = "12"
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How is a variable with numbers object declared?

A
A = 12
A = 12.5
A = 22 + 12.5
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How is a variable with booleans declared? True and false

A
A = (1 == 1) 
A = (1 == 6)

True
False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is arrays?

A

An object. Its a list of objects too.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How is an array created?

A

By declaring array name and listing the objects between brackets:

A = [“Sebastian”, “Jonas”, “Lisa”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is an object in an array list called?

A

An element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How is an element in an array accessed?

A

Array name and the index number:
Puts a[0]
=> “Sebastian”

17
Q

What are hashes?

A

An object. Helps store information as pairs, key and value.

18
Q

How are hashes declared?

A

Menu = {“pizza” => 14.00, “soda” => 2.00, “pasta” => 8.00}

19
Q

What type of object is declared? Which is key and which is value?

Menu = {“pizza” => 14.00, “soda” => 2.00, “pasta” => 8.00}

A

Menu hash
The foods key
The prices value

20
Q

How is the value of a key in a hash object accessed?

A

From
Menu = {“pizza” => 14.00, “soda” => 2.00, “pasta” => 8.00}

Menu[“pasta”]

Result

=> 8.00

21
Q

What is a variable?

A

They are used to store objects so we can access them again. Any object can be stored as a variable.

22
Q

What’s the terminal command to list the content of the current directory?

A

ls

23
Q

What’s the terminal command to list the content of the current directory, including hidden files?

A

ls -a

24
Q

How is got configured on a new computer?

A

git config –global user.name “your name”

git config –global user.email “email”

25
Q

How is git setup for a new project?

A

Go to folder in terminal.

git init

26
Q

How is a project saved to git?

A

git status //shows what files you’re tracking

git add . //stage

git commit -am “a name for personal reference”

27
Q

How can you get back something you shouldn’t have deleted with git?

A

git add .

git checkout -f

28
Q

What’s the terminal command to see where you are?

A

pwd

29
Q

how do you check your rails version?

A

rails -v

30
Q

How do you create a new rails application?

A

rails new examplename

cd examplename

31
Q

How do you run the rails server?

A

rails server

32
Q

What are the four steps to upload changes to github?

A

Git status

Git add .

Git commit -am “ref name”

Git push

33
Q

How can u move straight to desktop folder from anywhere, through the terminal?

A

cd ~/desktop

34
Q

How do you create a new page?

A

Rails generate controller pages home

35
Q

Where is the default url location of a newly created page?

A

Localhost:3000/pages/pagename

36
Q

Where do you update the text on your page?

A

App/views/pages/pagename.html.erb

37
Q

In what file do you handle directs of visitors?

A

Config/routes.rb

38
Q

How can you change the default location of the home page from localhost:3000/pages/home to localhost:3000 (root)

A
Go to config/routes.rb
Replace
get "pages/home"
With
Root "pages#home"
39
Q

How do you create a page manually?

A
  1. Go to app-controllers:pages_controller.rb

Add:
def name of page
end

  1. Go to app-views-pages.
    Create a new file: name of page.html.erb
  2. Go to config:routes.rb
    Add: get “pages/sebastian”