Prework Flashcards

1
Q

Command, regardless of where we currently are, will take us to our home folder

A

cd ~

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

Command to create a file

A

touch file.txt

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

Command to open a file

A

open joke.txt

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

Command to see whats in a file without opening it

A

cat file.txt

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

Command to create a folder

A

mkdir folder

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

command to move a file into a folder

A

mv joke.txt funny_things/

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

command for remove

A

rm

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

options to commands format

A

Options to commands are always of the format –word or

-letter

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

Command for copying folders

A

cp -r folder copy_of_folder

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

Command Line

A

A text-based interface.

Synonyms: command-line interface (CLI), console

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

Terminal

A

An OSX application that provides text-based access to the operating system;
Any device or application used for data entry and display in a computer system
Synonyms: client, computer terminal, terminal emulator

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

File System

A

A file system is a systematic way to control how information is stored and retrieved. It describes where one piece of information stops and where the next one begins. Each file system has its own structure and logic.
Synonyms: NTFS (Windows’ File System), HFS+ (Apple’s File System), file allocation table, GFS (Global File System)

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

Directory

A

An organizational unit, or container, used to organize computer files into a hierarchical structure.
Synonyms: folder, catalog, drawer

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

Path

A

A sequence of symbols and names that identifies a file or directory. The path always starts from your working directory or from the root directory, and each subdirectory is followed by a forward slash.
An absolute or full path begins with the root directory and specifies every directory above the terminating file or directory name.
A relative path does not include the root or parent directory names, and refers to a file or directory directly below the current working directory.
Synonyms: pathname

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

Command

A

The action we want the computer to take; always a single word.
Synonyms: utility

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

Option

A

Follows the “command” in a command line, to modify the behavior of the command in some way.
Synonyms: flag

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

Argument

A

Follows the “command” and “options” (if any) in a command line, and is used to explain what we want the command to act on.
The number of arguments used generally depends on the command: some don’t need arguments, some require exactly one argument, some require lots of arguments, and some are flexible in the number they can take.

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

Prints the working directory; returns the absolute path name of the current directory.

A

pwd -options

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

Lists directory contents.

A

ls [-options] [path/to/directory]

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

Changes the current working directory to the specificed directory.

A

cd [-options] [path/to/directory]

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

Makes a new directory

A

mkdir [-options] [path/to/directory]

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

Removes directories or files permanently

A

rm -r [path/to/file] [path/to/file] …

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

Moves directories or files to a new local

A

mv [-options] [path/to/file] [path/to/directory]

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

Renames a file or directory.

A

mv [-options] [path/to/file] [NEW_FILE_NAME]

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

version control

A

making a saving multiple versions of a project so you can restore an old version

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

command to list files including hidden files

A

ls -a

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

git init

A

hides a .git file in the directory you are working in so it can use the git stuff. turns directory into a git repository or “repo”

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

update on the status of a git project

A

git status

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

git

A

An open source program for tracking changes in text files. It was written by the author of the Linux operating system, and is the core technology that GitHub, the social and user interface, is built on top of.

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

Commit

A

An individual change to a file (or set of files).
It’s like when you save a file, except with Git, every time you save it creates a unique ID (a.k.a. the “SHA” or “hash”) that allows you to keep record of what changes were made when and by who.
Commits usually contain a commit message which is a brief description of what changes were made.
Synonyms: a revision

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

Diff

A

A diff is the difference in changes between two commits, or saved changes.
The diff will visually describe what was added or removed from a file since its last commit.

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

Remote

A

The version of something that is hosted on a server, most likely GitHub.com. It can be connected to local clones so that changes can be synced.

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

Repository

A

The most basic element of Git.
A repository is a project’s folder, containing all of the project files (including documentation), and stores each file’s revision history. Repositories can have multiple collaborators and can be either public or private.

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

Fork

A

A personal copy of another user’s repository that lives on your account.
Forks allow you to freely make changes to a project without affecting the original.
Forks remain attached to the original, allowing you to submit a pull request to the original’s author to update with your changes.

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

Clone

A

A copy of a repository that lives on your computer instead of on a website’s server somewhere, or the act of making that copy.
With your clone you can edit the files in your preferred editor and use Git to keep track of your changes without having to be online.
It is, however, connected to the remote version so that changes can be synced between the two.
You can push your local changes to the remote to keep them synced when you’re online.

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

Push

A

Pushing refers to sending your committed changes to a remote repository such as GitHub.com.
For instance, if you change something locally, you’d want to then push those changes so that others may access them.

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

Tells Git to start monitoring the current folder you’re in. In other words, for my working directory, create a new “timeline” where we can manage our source code.

A

git init

38
Q

git status

A

Get the current status of Git. Files that are “staged” (about to be committed), and files that are unstaged (files that have changed since the last commit, but are not about to be committed) will both show up here

39
Q

git add path/to/directory/or/file

A

Add a file to the “stage”. The stage can be thought of as an inbetween state between the last commit and what is ready to be committed. Once the command git commit is run, all staged files will be committed to the timeline.

40
Q

Commit all staged files to the timeline. If -m “Commit messsage” is ommitted, Git will open your default text editor (typically Vim) to enter a longer message. If for any reason Vim is opened, you can close it by typing :q.

A

git commit -m “Commit message”

41
Q

Visualize the timeline. You can scroll with the arrow keys or j, k, and it can be exited by typing q.

A

git log

42
Q

Show the changes of the given file or directory.

A

git diff path/to/directory/or/file

43
Q

Create a new local git repo copied from a remote one

A

git clone http://path/to/repo

44
Q

Send local changes to tracked remote repository

A

git push origin master

45
Q

Equality

A

==

ex. 10 == ‘10’

46
Q

Strict equality

A

===

(2 * 5) === 10

47
Q

Inequality

A

!=

9 != 10

48
Q

Strict inequality

A

!==

‘10’ !== 10

49
Q

Greater than or equal

A

> =

50
Q

Ternary Operator

A

(expression) ? ‘if true’ : ‘if false’;

51
Q

if else syntax

A
if (condition1) {
  // Code to be executed if condition1 is true
} else if (condition2) {
  // Code to be executed if condition1 is false and condition2 is true
} else if (condition3) {
  // Code to be executed if condition1 and condition2 are false, and condition3 is true
} else {
  // Code to be executed if condition1, condition2, and condition3 are false
}
52
Q

switch statement syntax

A
switch (expression) {
  case value1:
    // Code to be executed if expression === value1
    break;
  case value2:
    // Code to be executed if expression === value2
    break;
  default:
    // Code to be executed if expression is different from both value1 and value2
  }
53
Q

while Loops

A

while loops can run indefinitely, so long as the condition remains true.
The loop’s condition is re-evaluated each time the block finishes running.

54
Q

for Loops

A

A ‘for’ loop will generally run a fixed number of times, not indefinitely.
The three parameters for a for loop, in order, are (1) an initialization, (2) a condition, and (3) a final expression.

55
Q

function

A
A function is a custom operation that can be run on command. It can be use both as an operator (accepting input values and calculating output values) and as a subroutine (do this thing... then do this thing...).
Functions must be defined before they can be used. To define a function, use the following recipe:
var myFunctionName = function() {
  // Body of the function
}
To use, or call a function, simply type the name of your function, followed by () (plus any inputs that you might be passing in).
56
Q

return statements

A
In addition to specifying a final value for the function to give back as a result, a return statement will cause the function that contains it to immediately end when that line is run. For example, if the function below is operating on a number greater than ten, it will stop executing at its second line, and return 15, not x.
var someFunc = function(x) {
  if (x > 10) {
    return 15;
  }
  return x;
}
57
Q

array functions

A

In addition to storing a set of values, arrays also have a number of in-built properties and functions that they can use.
.length gives you the length of the array you call it on.
.push() adds a new element to the end of an array, and returns that element.
.pop() removes the last element in an array, and returns that element.
.indexOf() searches within your array for the first element that matches its parameter, and returns the index of that match; if no match is found, it returns -1.

58
Q

for loops

A

for (var i = 0; i

59
Q

.map()

A

creates a new array with the results of calling a provided function on every element in this array.

60
Q

.forEach()

A

executes some function once for each element in the array it’s called on.

61
Q

associative array

A

myassociativeArray[‘myKey’]
myAssociativeArray[‘myKey’] = ‘aValue’
myAssociativeArray[‘someNewKey’] = ‘someNewValue’

62
Q

Math.floor()

A

rounds down

63
Q

Math.ceil()

A

rounds up

64
Q

helper method

A

method inherent for specific data type

65
Q

‘string’.toUpperCase()

A

STRING

66
Q

parseInt(‘123’)

A

123

67
Q

parseInt(‘123asd’)

A

123

68
Q

parseInt(‘asd123’)

A

NaN

69
Q

Number(‘123’)

A

123

70
Q

4.2 % 1

A

0.200000000

71
Q

parseFloat(‘123.34’)

A

123.34

72
Q

array.unshift(‘thing’)

A

puts in array at front as opposed to push

73
Q

array.shift()

A

like pop but cuts off the front

74
Q

for loop classic structure

A

for (var i = 0; i

75
Q

{ …..

…..}

A

block

76
Q

{

A

curly brace

77
Q

!

A

bang
opposite
true to false
or !=

78
Q

switch syntax

A
var food = 'apple';
switch(food) {
    case 'pear':
    console.log('I like pears');
    break;
    case 'apple':
    console.log('i like apples')
    break;
    default:
    console.log('i don't like food);
}
79
Q

for key in object subject

A

for (key in Object){
console.log(key);
}

80
Q

npm

A

node package manager

81
Q

higher order objects

A

objects
array
functions/methods
core library

82
Q

core library

A
Math
Array
String
Number
Function
83
Q

some objects

A
objects
array
functions
Math
Array
String
Number 
Function
84
Q

where does javascript get executed

A

browser or node

85
Q

parameters vs arguments

A
when you define - parameters
when you receive - arguments
function myFunction(parm1, parm2) - formal parameters
function myFunction(2,3) - receiving arguments
86
Q

javascript arguments always optional?

A

yes

87
Q

Argument Evaluation

A
  1. there are no datatypes for formal parameters
  2. there is no type-checking for passed arguments
  3. argument length is never compared to formal parameteres and thus will never throw an argument miss match
  4. any missing arguments (fewer than the formal params), no error, but it will receive ‘undefined’ for the named params.
  5. extra arguments are simply appended to the _arguments_object.
88
Q

.map example !!

A
function length_map(arr){
   var L = arr.map(function(el){
      return el.length;
    });
    return L;
};
89
Q

Dry

A

dont repeat yourself

90
Q

javascript only has functional scope

A

javascript only has functional scope

91
Q

mdn constructor functions

A

look up documentation

92
Q

constructor function metaphore

A

like a cookie cutter, but can make different things