Skip to content

Instantly share code, notes, and snippets.

View artem-alek's full-sized avatar

Artem Aleksandruk artem-alek

View GitHub Profile
Normal Mode:
1. SELECT COUNT(users.id) FROM users;
50
2. SELECT items.title FROM items ORDER BY items.price DESC LIMIT 5;
title
Small Cotton Gloves
Small Wooden Computer
Awesome Granite Pants
Sleek Wooden Hat
Section 1:
1. ages.map(function (num) { return num * 2 }
2. ages.map(function (num) { return num * 2 }).filter(function (num) { if (num < 65) {return num}})
3. ages.map(function (num) { return 'Age is: ' + num})
Section 2:
1.
Section 1
1. feels[3].tags[0]
2. feels[6].tags[2]
3. having trouble with this one because of time crunch. Need more testing in console
Section 2
1. because of asyconyus issue. console.log would run faster than the data could be retrieved.
2. var data = $.ajax({
url: '.../search/code_',
dataType: 'json',
Section 1:
1. get, post, put, delete
2. not sure
3. not sure
4. 2xx = success; 3xx = redirection; 4xx = client error; 5xx = sever error
Section 2:
1. the ajax function, and data is the whole information for the GET.
2. it makes the function ajax wait to receive the information before exiting out of the function.
Section 1:
1. To ensure that we know what data type we are working with. That it s jquerified for the rest of the function.
2. jqButton is a jquerified and is not able to be used with .innerHTML because it is a regualr javascript function. We need to use .html().
Section 2:
1. event because the event is that holds the object of the click.
2. It refers to the key of object event. So, .target is a key in the object event.
Section 3:
1. No idea, i get lost when i need to have two arugments.
Section 1:
1. A callback calls another function to do something with a variable or data.
2. var evens = numbers.filter (function (nums) { return nums = numbers % 2 === 0 })
3. i used an anynonymus function and numbers.filter is the higher function and does the callback.
Section 2:
1. a string with methods attached to it
2. function isPariable (array) { return array.length % 2 === 0 }
Section 1:
1. String, numbers, bolean, num, undefinded
2. number & string
3. the first position of the array
4. studentsAre = feels[3]
Section 2:
1. prices.length
2. prices[count]
3. to add a + 1 to count variable for the loop variable
Secition 1:
1. Console.log(....), if, else
2. No, because the if else statment will always stop at the first condition.
Section 2:
1. The document is your html file that the .js file is linked to. It is in scope if the variable in the function is not returned.
2. The whole tag that the ID is set too. The whole html raw line.
3. .value for input commands only, rest is uses .innerHTML.
Section 3:
Section 1
1. <html></html>,</head></head>,<body></body>
2. <link href="style.css" ref="stylesheet">
Section 2
1. padding, margin, border, height, width
2. The display attribute changes how the box modeled is displayed. (ex. display:inline, display:block...ect)
3. postion: realtive is referring to the anchor point of a element and postion:absolute is fixing a element to that exact location, its absolute.
Section 1
1. They are elements like img and are empty becuase they hold no data. They pull data from somehwere else and its not does not have to be stored on server.
2. The difference between class and id is that id can only be used once per page where class can be used mutlple times per page.
3. Inline only take up the amount of space they need where blocks go to the next line and take the whole row. Inline = <span> and blocks = <div>
Seciton 2
1. a css selector is the target you wish to change. ex a, p, nav, body, .something, #something
2. nav(div) -> id(#something) -> class(.something)