You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building a simple Web-Application for Analyzing Web-Sites
The objective is to build a web-application that does some analysis of a web-page/URL.
The application should show a form with a text-field thus the user can type in the URL of the webpage being analyzed.
Additionally to form should contain a button for sending the
input to the server as well as to trigger the server-side analysis process.
After processing the results should be shown to the user in terms of a simple table below to the form. The result comprises the following information:
** What HTML version has the document?
** What is the page title?
** How many headings of what level are in the document?
** How many internal and external links are in the document? Are there any inaccessible links and how many?
** Did the page contain a login-form?
In case the URL given by the user is not reachable an error message should appear below the input form. The message should contain the HTTP status-code and some useful error description.
Please write a node application handling all the wanted features. HINT: for document analysis
consider using a library such as cheerio.js and for the server framework you could use express.js!
If you are more familiar with other frameworks/libraries please feel free to use them.
For the frontend part you can use all the available libraries and frameworks available on the internet.
Please provide the result as a npm package with this content:
The project with all source files
A short text document that lists the main steps of building your solution as well as all assumptions/decisions you made in case of unclear requirements or missing information
How would you clone an object in Javascript ? Cite your answer without using libraries:
function clone(obj){
if(obj == null || typeof(obj) != 'object')
return obj;
var temp = obj.constructor(); // changed
for(var key in obj)
temp[key] = clone(obj[key]);
return temp;
}
Three disadvantages of jQuery ?
What are closures ?
Whenever you see the function keyword within another function, the inner function has access to variables in the outer function. That is a closure. A function doesn't have to return in order to be called a closure. Simply accessing variables outside of your immediate lexical scope creates a closure. StackOverflow Reply
function foo(x) {
var tmp = 3;
return function (y) {
alert(x + y + (++tmp));
}
}
var bar = foo(2); // bar is now a closure.
bar(10);
What are the different types of inheritances in Javascript. Explain Classical vs Prototypal ?
dataType: jsonp for cross-domain request, that means request to different domain and dataType: json for same domain-same origin request.
Read about same origin policy
With JSONP you shouldn't see an ajax request if that's what you're looking for. You should however see a request for the resource because JSONP is used for cross domain calls to pull in data from different domains.
It returns your JSON data wrapped in a function name. jQuery handles the function name behind the scenes and passes the data into your success handler. The data is loaded by dynamically creating a script element with the src attribute pointing to the service being called and then attached to the browser's DOM. Then the browser makes a request to the resource and the web service responds with the callback function and data.
How is paint, repaint different in WebKit, Gecko and Trident. (Find out about Blink just in case. For sometime it will be the same as Webkit)
Different Video formats supported in HTML5 ? Read about flash fallbacks
Differences in Canvas / SVG / Flash
Browser Hacks OR Conditional Stylesheets. What is better and in what scenario ?
Man Slash Hack \*/*
Slash 9 Hack */9
Where should we place Javascript files - top OR bottom. What are the advantages and disadvantages of either method. Where would you use these (Google webfonts you need to place on top + jQuery down or top)
What are counters in CSS3 ?
What would text-shadow: 0 0 0 be minifeid to using a standard CSS minifier. What error does it show ? How can you fix it ?
How is word-wrap different from white-space ?
What is <pre> ?
How is <b> different from <strong> ?
What are Mixins? How can you pas arguments to Mixins ?
Brushing up on sorting algorithms is always good before a big interview. Also, if you are like me and don't have a fancy computer science degree, getting answers to Hashes and the big O questions would be good.
Some sorting algorithms written in Javascript (Google) :
document.ready vs window.onload : The ready event occurs after the HTML document has been loaded, while the onload event occurs later, when all content (e.g. images) also has been loaded.The ready event occurs after the HTML document has been loaded, while the onload event occurs later, when all content (e.g. images) also has been loaded.
bind() only applies to the items that we currently have selected in the jQuery object. Elements that weren't there when this code was run to attach the handler won't get the handler.live() applies to all current matching elements, as well as any other we might add in the future ie. This also works for the elements that will be created after the page has been loaded. This makes use of event bubbling.
Closure :A closure is the local variables for a function, kept alive after the function has returned. They are objects and have a scope chain associated with them. The benefit of a closure is in the fact that it retains the scope of the parent execution context. So if we have multiple functions within the lexical scope of one function, the function would have access to the local variables of other function. To sum it up we can nest JavaScript functions one inside another, with multiple levels of nesting and a function can read and write not only its own parameters and local variables but also those of any functions it’s nested in.
Delegate:
Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
In general, it's best to use the delegate() method rather than the live() method.
There are two main reasons underpinning this conclusion:
• Performance. The delegate() method offers better performance and faster execution of your code in benchmarks, primarily because it can be applied to specific DOM elements.
• Chaining. The delegate() also supports chaining, whereas live() currently doesn't.
live() bubbles all the way up, and attaches the handler to the document.
If the commit hasn’t been push you can do the following, which will allow you to edit the message on the most recent commit:
git commit --amend
How can I undo the last commit?
You can use git reset e.g.:
git reset --hard HEAD~1
HEAD~1 means HEAD-1 commit. It should be noted that this is the nuclear option, and any changes you made will be discarded. If you want to keep your changes in the working tree use:
git reset --soft HEAD~1
If you’ve already published your commits, you should use revert. This is create new commits undoing the last change:
git revert HEAD~1..HEAD git revert commitid
Delete a Git branch remotely
git push origin --delete branchname
What are the differences between ‘git pull’ and ‘git fetch’?
git pull, is git fetch followed by git merge. git fetch gets the remote changes, they get kept under refs/remotes//. However it doesn’t affect your local branches, and won’t change your working copy. git pull then merges these changes with the local copy.
How do I undo a ‘git add’ before committing
You did a “git add filename” accidentally and want to undo it before committing your change. You can simply do:
git reset filename
To unstage your changes to that file.
How do I deal with merge conflicts
Use “git mergetool” which gives a handy interface for solving merge conflicts.
Remove all local untracked files (and directories) from your local clone
Careful! You might want to take a backup before doing this:
git clean -f -d
Clone all remote branches
You probably already have, they’re just hiding! Use the following to see all the branches:
git branch -a
You can then use “git checkout origin/branchname” to take a look at the branch. Or “git checkout -b branchname origin/branchname”. To create a local tracking branch.
Rename local branch?
git branch -m oldname newname
Revert to a previous Git commit
You can use reset as above to revert to a previous commit, this assumes you mean go back to where you were before permanently rather than just take a look (for that you want to checkout an old version). The commit ID, should be as shown in the output of “git log”.
git reset --hard commitid
Again this will discard all changes in your working tree, so make sure this is really what you want to do! Or look at using –soft rather than –hard.
Remove a git submodule
Creating a submodule is pretty straight-forward, but deleting them less so the commands you need are:
document.ready vs window.onload : The ready event occurs after the HTML document has been loaded, while the onload event occurs later, when all content (e.g. images) also has been loaded.The ready event occurs after the HTML document has been loaded, while the onload event occurs later, when all content (e.g. images) also has been loaded.
bind() only applies to the items that we currently have selected in the jQuery object. Elements that weren't there when this code was run to attach the handler won't get the handler.live() applies to all current matching elements, as well as any other we might add in the future ie. This also works for the elements that will be created after the page has been loaded. This makes use of event bubbling.
Closure :A closure is the local variables for a function, kept alive after the function has returned. They are objects and have a scope chain associated with them. The benefit of a closure is in the fact that it retains the scope of the parent execution context. So if we have multiple functions within the lexical scope of one function, the function would have access to the local variables of other function. To sum it up we can nest JavaScript functions one inside another, with multiple levels of nesting and a function can read and write not only its own parameters and local variables but also those of any functions it’s nested in.
Delegate:
Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
In general, it's best to use the delegate() method rather than the live() method.
There are two main reasons underpinning this conclusion:
• Performance. The delegate() method offers better performance and faster execution of your code in benchmarks, primarily because it can be applied to specific DOM elements.
• Chaining. The delegate() also supports chaining, whereas live() currently doesn't.
live() bubbles all the way up, and attaches the handler to the document.