other stuff Flashcards

1
Q

What is CSS?

A

Cascading Style Sheets, language for applying styles to HTML
—————————————————————
Stands for cascading style sheets and is used to describe how a document (commonly, html. sometimes svg or xml) should be displayed on media (e.g. screen, printer, projector)

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

What is the box model?

A

CSS model for HTML elements, defines space within and around the element. Margin, outline, border, padding, content. Box-sizing affects width and height calculations, general best practice is to use border-box
—————————————————————
https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
content->padding->border->margin

standard css box model and alternative css box model. we use the alternative one called border box

alternative is called border-box, like border in the box :)
box-sizing: border-box;

If you are using the standard box model, the size of the border is added to the width and height of the box. If you are using the alternative box model then the size of the border makes the content box smaller as it takes up some of that available width and height.

used to describe how [html] elements are derived from css properties <—

https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model#what_is_the_css_box_model

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

What are the display types? What is the difference between them?

A

Block, inline-block, inline, flex
—————————————————————

block - starts a new line and takes up whole width
inline - (e.g. span) height and width don’t impact these
flex - Displays an element as a block-level flex container
grid - Displays an element as a block-level grid container
none -The element is completely removed
..
inline-block - formatted as an inline element (, not taking up the whole width?) except you can apply height and width

inline - (e.g. span) height and width don’t impact these
block - starts a new line and takes up whole width
inline-block - formatted as an inline element (, not taking up the whole width?) except you can apply height and width
flex - block-level flex container
contents

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

How do you apply width and height to a span?

A

Change display type to block, inline-block, or flex and set width/height or add padding/margin
—————————————————————
change type display type of it

can use block, inline-block, flex … then you can adjust height and width etc

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

Tell me about the cascade and selector specificity

A

id

.class
[attr]
[attr=value]
—————————————————————
cascade = process of resolving conflicts when more than one rule applies to an element

Use the one with the most importance, in this order:

user !important declaractors (user changes in their browser)
author !important declarations (changs devs make)
author ddeclaractions (stuff we devs write)
user declaractions (user changes stuff in their browser)
default browser declarations (what the browser sets)


If they have the same importance, use the one that’s the most specific, in this order

(inline, ID, class, elements) - count the numb rof occurrances in the selecter to get the total
eg (0,0,1,0)

inline styles
ids
classes, pseudo classes, attributes
elements, pesudo elements


If they have the same specificity, use the last one that was declared. (so the one on the bottom)

https://www.udemy.com/course/advanced-css-and-sass/learn/lecture/8274424#search

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

Tell me about pseudo-selectors

A

Keyword added to any selector to specify a special state of the element. :before, :after, :hover, :focus, :first-child, :last-child, :nth-child, :target, :disabled, etc….
—————————————————————
keyword added to a selector that specifies the selectors state

button:hover {
color: blue;
}
—————————————————————
Pseudo class define special state of element like i.e a:hover
while pseudo element define style for specific part of element i.e h1::before
—————————————————————
Difference between pseudo elements and classes:
=> pseudo element represent an actual part of DOM whereas pseudo classes
represents state of an element based on the user’s interactions with it
=> pseudo elements use :: while classes use :
0

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

What is important keyword?

A

!important breaks the cascade, prevents further overrides, generally considered bad practice/avoid if possible
—————————————————————
bad practice, impacts the cascade dramatically

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

Tell me about float and clear

A

Used to position elements on the page, float pulls an element out of the default document flow, clear ensures earlier floated elements are cleared (position on new line), float/clear layouts are mostly replaced by newer standards (grid, flexbox)
—————————————————————
old method, use flexbox or grid instead.

float - removes an element from the normal flow of the page, sticking an element on the left or right side of its container

clear - moves elements below (clearing them) floated elements before it

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

What are CSS positions?

A

Relative, absolute, fixed, sticky
—————————————————————

static - default value of elements
relative -  positioned statically but then offset from its original position
fixed - removed from normal document flow, space gets taken up by other stuff, and positioned relative to the viewport or a parent blocks transform
absolute - The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to its closest positioned ancestor, if any

Sticky - It is positioned relative until a given offset position is met in the viewport - then it “sticks” in place (like position:fixed).

sticky - The element is positioned according to the normal flow of the document, and then offset relative to its nearest scrolling ancestor and containing block (nearest block-level ancestor)

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

What are media queries?

A

Used to apply styles for different media types and devices, often used to detect screen width for responsive breakpoints, often used to detect orientation on mobile devices
—————————————————————
allows you to change styles based on how the page using the style is being viewed (phone, etc)

@media only screen and (max-width: 1200px){
/Tablets [601px -> 1200px]/
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  • What is CSS grid & flexbox?
A

Used to make layouts and position elements, grid is 2D, flex is 1D, grid is generally preferred at page level vs. inline for flex, can use either one to achieve the same effects most of the time
—————————————————————

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

What are CSS sprites/spritesheets? Why use them?

A

Grid of images all on one sheet, can be used to speed up load time in comparison to loading numerous individual assets (reduce network calls)
—————————————————————
CSS Sprites are a collection of images that are combined into a single file that an HTML document can access

helps with performance since it’s just one file, less requests

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

What new elements are introduced in HTML5?

A

Nav, main, section, aside, header, footer, article, figure, etc.
—————————————————————
audio and video tags
semantic stuff like section, main, header, footer, aside etc
placeholder attribute I think?

https://www.tutorialspoint.com/html5/html5_new_tags.htm

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

What is canvas?

A

Element used to draw/render graphics on the fly, kind of replaces old Adobe flash/multimedia use cases
—————————————————————
an api that provides a means of drawsing graphics via javascript

“The Canvas API provides a means for drawing graphics via JavaScript and the HTML element. Among other things, it can be used for animation, game graphics, data visualization, photo manipulation, and real-time video processing.

The Canvas API largely focuses on 2D graphics. The WebGL API, which also uses the element, draws hardware-accelerated 2D and 3D graphics” - https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API

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

What is semantic markup?

A

Markup that conveys the type of content inside the tag or the purpose of the element/tag on the page
—————————————————————
explains the purpose of sections in your document/html
- search engines, devices, accessability purposes like screen readers, for interfacing with other stuff like browser translation things

Tags conveying the meaning of what’s in the tags - https://www.udemy.com/course/understanding-html-and-css/learn/lecture/22046350#overview

“Elements, attributes, and attribute values in HTML are defined (by this specification) to have certain meanings (semantics). For example, the ol element represents an ordered list, and the lang attribute represents the language of the content.” -from the html spec at https://html.spec.whatwg.org/#semantics-2

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

What is accessibility?

A

The ability of all users to access an application’s features, particularly support for users with visual, motor, and cognitive disabilities.
—————————————————————
describes an area of focus involving making stuff accessible to more outside entities like ppl and things

“the ability to be accessed”

or in our context, the ability for users to access the things you want them to access via their methods (screen readers,

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

Accessibility best practices?

A

Follow WCAG standards, semantic markup, support keyboard navigation, support and test for screenreaders, user test with disabled people, etc.
—————————————————————
semantic, consult UX ppl to make sure it’s usable - covers a lot like readablity, getting users to where they need to go and all kinds of stuff uncovered in testing

USE Alt text on images! HEre’s an example of what happens when you don’t: https://youtu.be/dEbl5jvLKGQ?t=106

Basically, the user gets nothing at all except that there is an image there. The screenreader may read the file name and say that it’s an image.

Use headers on tables too. And use scope tags so users can see what column they’re in while they’re inside the children cells.

Name
Age
Birthday

https://webaim.org/techniques/tables/data

watch this https://www.youtube.com/watch?v=0hqhAIjE_8I

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q
  • What is ARIA?
A

Browser standard for improving accessibility of HTML elements, adds attributes to support screenreaders, aria-role, aria-label, etc.
—————————————————————
a standard for accessibility

a set of attributes that define ways to make web content more accessible to those with disabilities

watch this https://www.youtube.com/watch?v=0hqhAIjE_8I

19
Q
  • What is MVC pattern?
A

Model view controller. Model (data model), view (template, user-facing view), controller (glue between model and view, logic-heavy, transforms model to view)
—————————————————————
a pattern where you split your app into a model (data and logic) a view (what the user gets) and a controller (handles user interaction) for the purpose of organizing your code in a way that reflects how its used?

THis explains it pretty well https://www.youtube.com/watch?v=DUg2SWWK18I

model and view never communicate with each other. controller handles all that

20
Q
  • What is MVVM pattern?
A

Model view view-model. Specifically developed for frontend/GUIs in place of MVC. Model (business model), view (template, user-facing view), view-model (abstraction of the view that allows 2-way data binding, state of the data in the model which can be reflected on the view)

—————————————————————

watch this from mosh https://www.youtube.com/watch?v=fo6rvTP9kkc

Used in cases where you want to unit test your view presentation logic since the view is based on a class

https://www.youtube.com/watch?v=fo6rvTP9kkc

21
Q
  • What is observer pattern or publish and subscribe?
A

Pattern where a subject maintains a list of its observers and notifies them automatically when its state changes, usually by calling one of their methods. Observers subscribe to subject, subject publishes updates

—————————————————————
The Observer pattern is a design pattern that offers a subscription model in which objects (known as ‘observers’) can subscribe to an event (known as a ‘subject’) and get notified when the event occurs (or when the subject sends a signal or publishes an update). This pattern is the cornerstone of event driven programming. - this video shows how to do it in js and also explains it https://youtu.be/45TeJEmcqk8

22
Q
  • What is singleton pattern?
A

OOP design pattern, instantiate only a single instance of a class for use across the application, often used with dependency injection or factory pattern, often used to store global state
—————————————————————
??
Ensures a class has only one instance and provides global point of access to it (that single instance).

This video shows how to impliment this pattern in javascript easily https://www.youtube.com/watch?v=sJ-c3BA-Ypo

23
Q
  • What is a CDN? Why should we use a CDN?
A

Content delivery network, distributes cached assets from closest region to speed up load times, popular CDN libraries may already be cached for users, helps protect against DDoS attacks

—————————————————————
https://www.youtube.com/watch?v=Bsq5cKkS33I

reduces load on the server hosting the domain, and so resources required by the server are lower, uptime potentially higher
security by obscurity

caches sites static content to servers across the world and works by serving content from closest server that requests it.

https://www.youtube.com/watch?v=nle1q0qSYmA

24
Q

What is linting?

A

Enforces formatting and usage standards automatically, ex. eslint
—————————————————————
process of scanning your code for issues (potential bugs, formatting and style, etc) a linter is a tool that does linting

25
Q

What is a web server?

A

Computer running web server software (e.g. Apache, nginx) and serving application files

26
Q

What is a browser?

A

Software that lets users access websites ** answers vary widely, please have a dev3 chime in what they are looking for

27
Q

What are proxies?

A

Server that translates requests, intermediary server, often used as a firewall or filter, may discuss proxy vs. reverse proxy

reverse proxy accepts requests on behalf of server and then routes the request

forward proxy acts on behalf of hte client or multiple clients and routes all requests

https://www.jscape.com/blog/forward-proxy-vs-reverse-proxy

28
Q

What is DNS?

A

Domain Name System. Maps IP addresses to domain names for the whole internet ** answers vary widely, please have a dev3 chime in what they are looking for

The Domain Name System is the hierarchical and decentralized naming system used to identify computers reachable through the Internet or other Internet Protocol networks.

29
Q

What is HTTP?

A

HyperText Transfer Protocol. Protocol for fetching web resources like HTML pages, may discuss client-server, request-response, packets, data transfer/loss, built on TCP etc.

30
Q

What is an HTTP header?

A

Metadata for HTTP requests

31
Q

What kinds of HTTP headers are commonly sent from a browser?

A

Accept
User-Agent
Host

32
Q

What kinds of HTTP headers are commonly sent from a server?

A

Content-length, content-type, content-encoding, content-language, content-location, etc.

33
Q

What are the common HTTP verbs (request types)?

A

GET, POST, PUT, PATCH, DELETE, OPTIONS, etc.

—————————————————————
https://www.youtube.com/watch?v=Pm28JXFAu4Y

get
put
patch
delete
copy
head
options
link
unlink
purge
lock
unlock
propfind
view

34
Q

What is the data format for different HTTP verbs?

A

** answers vary widely, please have a dev3 chime in what they are looking for
—————————————————————
POST, GET, PUT, PATCH, and DELETE

Media type = “mime type”
mime types are specified in the request headers using “accept” and “content-type”

If you want json from a get request then you use this in the header
“accept: application/json”

If you want to send over some json then you do
“content-type: application/json”

—————————————————————

you can swap out the json for “text/xml” too
https://www.tutorialsteacher.com/webapi/request-response-data-formats-in-web-api

and there are a bunch of mime types actually ..
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types

post
header might be “content-type: application/json”, a json string. (json.stringify)

35
Q

What is REST?

A

REpresentational State Transfer. Architectural standard for stateless, cacheable data transfer. REST APIs are current industry best practice

—————————————————————
https://www.youtube.com/watch?v=-MTSQjw5DrM

Representational State Transfer (REST) is a software architecture that imposes conditions on how an API should work.

Stateless - requests performed independently..,
Layered - several servers can handle request,
Supports caching - some responses can be stored on the client or middle server
code can be sent to client

restful api server responses
200 - ok
400 - not found
500 - server issue
300 - redirection

36
Q

What is a URI?

A

Uniform Resource Identifier. URLs are an example. Used with a protocol (e.g. http://, ftp://) to request a resource on the network
—————————————————————
URIs identify and URLs locate; however, locators are also identifiers, so every URL is also a URI, but there are URIs which are not URLs.

URI = uniform resource identifier
URL = uniferorm resource locator

URI stands for Uniform Resource Identifier
The purpose of URI is to locate
a resource on the server
hosting the web service.
A URI format is:
:////
protocol :// service name / resource type / resource id

https://stackoverflow.com/questions/176264/what-is-the-difference-between-a-uri-a-url-and-a-urn

37
Q

What is FTP?

A

File Transfer Protocol
—————————————————————
ok
The File Transfer Protocol is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network. FTP is built on a client–server model architecture using separate control and data connections between the client and the server.

38
Q

What is AJAX

A

Asynchronous JavaScript and XML. Uses XMLHttpRequest objects. Kind of low level, usually not good practice to use XHR directly instead of modern APIs like Fetch
—————————————————————
asynchronous javascript and xml.
the use of xmlhttprequests to communicate with servers, kind of running things asynchronously in the background .

loading content on the screen without refreshing the page

39
Q

What is JSON?

A

JavaScript Object Notation. Standard format for data transfer in web APIs, often used for configs and other data storage too
—————————————————————
javascript object notation. really common format used for lots of configs and stuffs

40
Q

What is the difference between HTTP and HTTPS?

A

Security, encryption via SSL/TLS, https is now standard, browsers show insecure labels when serving over http
—————————————————————
https is encrytped

41
Q

What are cookies for?

A

Data saved in the user’s browser, used to track sessions and personal data
—————————————————————
saves stuff instead of having to re-collect the same stuff, local to the user

https://www.youtube.com/watch?v=I01XMRo2ESg

Browser cookies are used to store information about your interactions on the web. Login to a website, it starts saving information about your interactions locally. Sometimes it might store a session so that, in its local database, it can retrieve information about you next time you visit.

https://www.youtube.com/watch?v=GhrvZ5nUWNg

Cookies use HTTP header, Tokens use authorization HTTP header which is different. check video at this curernt time https://youtu.be/GhrvZ5nUWNg?t=652

Session sare often used with websites, tokens often used with apps on the phone

42
Q

Describe security concerns on web and some defensive actions you can take?

A

Form Validation/Validate Input Client
Sanitize Inputs
Validate Input Server
Encode Outputs
HTTPS
Encrypt Sensitive Data
Seed Sensitive Data
Same Origin
Cross Request Forgery
—————————————————————
form attacks, use kaptcha’s and stuff
use SSL

phishing
sql injection
denial of service

maintain backups
keep software up to date
use firewalls

43
Q

What are the different types of Attacks? Describe how each work and how to protect

A

SQL Injection Attack
Counter measures:
escaping
parameterize queries

Cross Site Scripting
Counter measures:
encoding input before storing or rendering

—————————————————————

This video shows sql injection attack https://youtu.be/ciNHn38EyRc?t=910

Mentions to parameterize queries, sanitize input (can’t put single quotes in without them being escaped). but also worry about 2nd order sql injections, video elaborates on this

This video says how to prevent sql injections, and it’s recent: https://www.youtube.com/watch?v=WONbg6ZjiXk

prepared statements
whitelisting
typecasting - convert user string to a safer data type, can do this if you don’t want to do prepared statements
escaping

cross site scripting is where someone runs js code on someone elses browser - save script in web app sdatabsae, other user will access database and incidently run script on their client side
- do server-side validation of incoming data

man in the middle - https

and others. this is an organized video that covers a lot generically. could just listen to it https://www.youtube.com/watch?v=Dk-ZqQ-bfy4