Skip to content

Instantly share code, notes, and snippets.

@gusmcnair
gusmcnair / various exercises
Created February 13, 2020 04:03
various exercises
function urlify(input){
let urlString = ''
for(let i = 0; i < input.length; i++){
if(input[i] === ' '){
urlString += '%20'
} else {
urlString += input[i]
}
} return urlString
}
@gusmcnair
gusmcnair / arrayanswers.js
Last active February 12, 2020 21:24
Array question answers
1. Done, and in relevant files.
2.
a. Length 1, Capacity 1, Address 1
b. Length 6, Capacity 12, Address 3: The capacity is tripling and the memory address is reassigned every time the limit is reached.
3. Length 3, Capacity 12, Address 3: The three last values from the array are removed, but the capacity and address stay the same.
4. It returns 'NaN' for 'tauhida' or any other text, because this array appears unable to store strings.
@gusmcnair
gusmcnair / bigo.js
Last active February 12, 2020 04:53
Big O exercises
Constant time / O(1) = Getting a specific value from an array, or adding two numbers – Only one operation
Logarithmic time / O(log(n)) = Decreasing the search by half every time you perform it – Repeatedly halving the operation
Linear time / O(n) = Searching one-by-one through a set of info for a variable (think FOR loops) - Operation equals its length
Polynomial time / O(n^k) = Comparing one set of values to itself or another set of values one-by-one, FOR loop within FOR loop
Exponential time / O(2^n) = Each time the function is run, the data increases exponentially.
//1. First question
a. This resembles constant time – 0(1) in that you're getting a specific value without performing a full search
b. This is essentially a FOR loop, and thus linear time, O(n).
@gusmcnair
gusmcnair / recursion.js
Last active February 11, 2020 02:43
Recursion exercises
const sumOf = function(list) {
// Base case
if (list.length === 1) {
return list[0];
}
// General case
return list[0] + sumOf(list.slice(1));
}
@gusmcnair
gusmcnair / grampsmdfinal.md
Last active February 8, 2020 22:31
GrampsMD final version
@gusmcnair
gusmcnair / grampsmd_revision2.md
Created February 4, 2020 20:33
Gramps MD second iteration

Response to my app from friends and family:

  1. Fix various misspellings/grammar errors in table seed file (Changed in new iteration)
  2. Add loading page in case API takes longer than expected (Changed in new iteration)
  3. Make "gender" and "improv" not show up as "symptoms" (Changed in new iteration)
  4. Functionality and display worked well on both laptop and desktop. (No change necessary)
@gusmcnair
gusmcnair / node test questions
Last active August 3, 2021 23:00
node test questions
Describe the HTTP requests/response lifecycle.
The client sends the server a request, and the server sends a response, which can be either the requested data or an error.
Describe the architecture of a basic Express app. How is it organized?
An express app has methods for routing HTTP requests (figuring out which route should be used based on request), configuring middleware
(a series of functions often to validate request or determine specifics before sending response), and more.
Organization: Request, middleware, main task, response.
Tell me about a time when you've used Express Router. How was it helpful?
For my Thingful project, is was helpful in that it allowed several different methods (post, delete, get) to be easily configured on
@gusmcnair
gusmcnair / grampsmd_mvp.md
Created February 3, 2020 16:08
GrampsMD MVP assignment
@gusmcnair
gusmcnair / grampsmdstaticclient.md
Created February 1, 2020 21:25
GrampsMD static client info
@gusmcnair
gusmcnair / userfeedback.md
Created February 1, 2020 02:27
GrampsMD User feedback

From mentor:

  • Files are poorly organized, reorganize for better clarity
  • React Router is poorly organized, reorganize
  • Use a different branch for your work, not the master branch

From friends:

  • Make it so 'next' button can't be clicked until the symptoms/data have been clicked
  • Have symptoms show up (along with results) on the last page
  • Use different pictures for different pages and results