Skip to content

Instantly share code, notes, and snippets.

@Noviny
Last active February 13, 2019 21:38

Revisions

  1. Noviny revised this gist Feb 15, 2016. 1 changed file with 91 additions and 1 deletion.
    92 changes: 91 additions & 1 deletion Job Interview Things.md
    Original file line number Diff line number Diff line change
    @@ -71,4 +71,94 @@ Double equals (loose equality) are almost identical to threequals (strict equali
    0 === false - false

    ## Explain the same-origin policy with regards to JavaScript.
    The same origin policy is a security feature that prevents scripts in web applications from accessing data outside of it's origin. A web application's origin is determined by a combination of it's URL, hostname and port number. The policy is especially important in preventing malicious scripts from obtaining sensitive data from other web applications. Two of the main exceptions to the policy include Cross-Origin Resource Sharing, where response headers are added to allow XMLHttpRequest requests and JSONP which allows JSON data responses between applications.
    The same origin policy is a security feature that prevents scripts in web applications from accessing data outside of it's origin. A web application's origin is determined by a combination of it's URL, hostname and port number. The policy is especially important in preventing malicious scripts from obtaining sensitive data from other web applications. Two of the main exceptions to the policy include Cross-Origin Resource Sharing, where response headers are added to allow XMLHttpRequest requests and JSONP which allows JSON data responses between applications.






    ## What is Rails?
    Ruby on Rails is a web application framework written in Ruby providing default structures for a database, a web service, and web pages.
    Open-source
    version: 4.2.5
    date first release: July 2004

    ## What is MVC and what are the components of Rails MVC?
    A controller can send commands to the model to update the model's state (e.g., editing a document). It can also send commands to its associated view to change the view's presentation of the model (e.g., by scrolling through a document).
    A model stores data that is retrieved according to commands from the controller and displayed in the view.
    A view generates an output presentation to the user based on changes in the model.
    A view controller generates an output view and an embedded controller

    ## Explain the different variable scopes in Ruby
    Four levels of variable scope (global, class, instance, and local) denoted by sigils or the lack thereof

    global variable is a variable with global scope, meaning that it is visible (hence accessible) throughout the program
    class variable is a variable defined in a class of which a single copy exists, regardless of how many instances of the class exist.
    instance variable is a variable defined in a class (i.e. a member variable), for which each instantiated object of the class has a separate copy, or instance. An instance variable is similar to a class variable.
    local variable is a variable that is given local scope. Local variable references in the function or block in which it is declared override the same variable name in the larger scope.

    ## Name a few object-oriented concepts in Ruby
    Everything is an object (even string)
    Name a few object-oriented concepts in Ruby-
    Inheritance (OOP) is when an object or class is based on another object (prototypal inheritance) or class (class-based inheritance), using the same implementation (inheriting from an object or class) specifying implementation to maintain the same behavior (realizing an interface; inheriting behavior).
    Mixin is a class that contains methods for use by other classes without having to be the parent class of those other classes. Mixins are sometimes described as being "included" rather than "inherited". Mixins encourage code reuse and can be used to avoid the inheritance ambiguity that multiple inheritance can cause.
    Metaclass is a class whose instances are classes. Just as an ordinary class defines the behavior of certain objects, a metaclass defines the behavior of certain classes and their instances. Metaclasses can be implemented by having classes be first-class citizen, in which case a metaclass is simply an object that constructs classes.
    Provide an example showing how an iterator is used
    for loop if javascript or .each for rails
    used to display a list of items for example
    What is the difference between an argument and a parameter?
    Function parameters are the names listed in the function definition.
    Function arguments are the real values passed to (and received by) the function.

    ## Explain how sessions work, specifically in relation to cookies.
    Sessions are server-side files that contain user information, while Cookies are client-side files that contain user information.
    A cookie is simply a short text string that is sent back and forth between the client and the server. You could store name=bob&password=asdf in a cookie and send that back and forth to identify the client on the server side.

    ## How does GPS work?
    The satellites send out microwave signals to a receiver where the built-in computer uses these signals to work out your precise distance from each of the four satellites and then triangulates your exact position on the planet to the nearest few meters based on these distances.

    ## How do you add a method to jQuery?
    $.fn.doSomething = function () {
    this.css('color', 'red');
    };
    What is browser sniffing? When would you use it?
    Browser sniffing is the act of detecting the web browser a visitor is using in order to serve version-specific pages, scripts, images, or other content.
    Check if a feature has to be used by a specific browser.
    What's the difference between .call and .apply?
    theFunction.apply(valueForThis, arrayOfArgs)
    theFunction.call(valueForThis, arg1, arg2, ...)
    What's a doctype do?
    The doctype declaration should be the very first thing in an HTML document, before the tag. The doctype declaration is not an HTML tag; it is an instruction to the web browser about what version of the markup language the page is written in. The doctype declaration refers to a Document Type Definition (DTD).

    ## What's the difference between inline and inline-block?
    Inline elements:
    respect left & right margins and padding, but not top & bottom
    cannot have a width and height set
    allow other elements to sit to their left and right.
    Block elements:
    respect all of those
    force a line break after the block element
    Inline-block elements:
    allow other elements to sit to their left and right
    respect top & bottom margins and padding
    respect height and width

    ## What's the difference between "resetting" and "normalising" CSS? Which would you choose, and why?
    CSS resets aim to remove all built-in browser styling. Standard elements like H1-6, p, strong, em, et cetera end up looking exactly alike, having no decoration at all. You're then supposed to add all decoration yourself.
    Normalize CSS aims to make built-in browser styling consistent across browsers. Elements like H1-6 will appear bold, larger et cetera in a consistent way across browsers. You're then supposed to add only the difference in decoration your design needs.
    If your design a) follows common conventions for typography et cetera, and b) Normalize.css works for your target audience, then using Normalize.CSS instead of a CSS reset will make your own CSS smaller and faster to write.

    ## What is the difference between document load event and document ready event?
    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 onload event is a standard event in the DOM, while the ready event is specific to jQuery. The purpose of the ready event is that it should occur as early as possible after the document has loaded, so that code that adds functionality to the elements in the page doesn't have to wait for all content to load.
    ##Describe event bubbling.
    https://jsfiddle.net/qfv0tjcv/
    ...

    ##Explain "hoisting".
    https://jsfiddle.net/d7L766mz/

    ##What is a closure, and how/why would you use one?
  2. Noviny revised this gist Feb 1, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion Job Interview Things.md
    Original file line number Diff line number Diff line change
    @@ -64,6 +64,11 @@ minify dependencies
    When an event occurs on a webpage and multiple elements have a handle, or event rider for that event, this determines which element's event occurs first. For Event bubbling, the innermost element has the event apply first, followed by the the next innermost element and out. The opposite is capturing which moves from the outmost in.

    ## What is the difference between == and ===?
    The MDN refers to '==' as abstract equality or loose equality, while '===', or threequals, is called strict equality. Strict equality is almost always preferred in javascript, as some loosely equal equations can be misleading, such as undefined being equal to null, and the string '3' being equal to 3.
    Double equals (loose equality) are almost identical to threequals (strict equality) except that double equals compares for equality after doing type conversion (i.e. number 2 is also acceptable as the string '2') whereas threequals do not.
    1 == true - true
    1 === true - false
    0 == false - true
    0 === false - false

    ## Explain the same-origin policy with regards to JavaScript.
    The same origin policy is a security feature that prevents scripts in web applications from accessing data outside of it's origin. A web application's origin is determined by a combination of it's URL, hostname and port number. The policy is especially important in preventing malicious scripts from obtaining sensitive data from other web applications. Two of the main exceptions to the policy include Cross-Origin Resource Sharing, where response headers are added to allow XMLHttpRequest requests and JSONP which allows JSON data responses between applications.
  3. Noviny revised this gist Jan 31, 2016. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions Job Interview Things.md
    Original file line number Diff line number Diff line change
    @@ -58,3 +58,12 @@ Enable browser caching for static content elements.
    Load some content before others (lazy loading).
    Reduce the number of dependencies
    minify dependencies


    ## Describe event bubbling.
    When an event occurs on a webpage and multiple elements have a handle, or event rider for that event, this determines which element's event occurs first. For Event bubbling, the innermost element has the event apply first, followed by the the next innermost element and out. The opposite is capturing which moves from the outmost in.

    ## What is the difference between == and ===?
    The MDN refers to '==' as abstract equality or loose equality, while '===', or threequals, is called strict equality. Strict equality is almost always preferred in javascript, as some loosely equal equations can be misleading, such as undefined being equal to null, and the string '3' being equal to 3.

    ## Explain the same-origin policy with regards to JavaScript.
  4. Noviny revised this gist Jan 29, 2016. 1 changed file with 24 additions and 1 deletion.
    25 changes: 24 additions & 1 deletion Job Interview Things.md
    Original file line number Diff line number Diff line change
    @@ -34,4 +34,27 @@ In rails, methods are publicly visible to users by default, except where a nodoc
    DRY or 'Don't Repeat Yourself' is a methodology that aims at reducing repetition and extraneous code by identifing repeated code that performs the same logic throughout a project or file (depending on scope) and consolidating into a single function that can initialized where the repeated code would otherwise exist.

    ## What is the log to check for errors in Rails?
    Once the server is running, rails errors will be printed in the server logs. This is very important for checking server-side errors, as you may get inaccurate errors on the front end, or no error messages with wrong data. (also, write tests). It is recorded in log/development.log while the project is in development mode.
    Once the server is running, rails errors will be printed in the server logs. This is very important for checking server-side errors, as you may get inaccurate errors on the front end, or no error messages with wrong data. (also, write tests). It is recorded in log/development.log while the project is in development mode.


    ## How does a URL work?
    It sends information to the domain name server to retrieve the IP address, containing information both for the site to which you are visiting, as well as instructions to what page of that site you want to display. The url is like a phone number, the IP is like a phone number (you use the name to look up the phone number).




    ## What happens when you enter a URL into your browser?
    What happens when you enter a URL?
    First the browser checks the cache to see if there are is anything that doesn't have to be reloaded (i.e. already exists) from said site.
    The browser then asks for an IP address and after receiving it, opens a TCP (Transmission Control Protocol) connection to the server.
    The browser stores any cacheable data and determines what to do with the server's response (i.e. is it HTML, or an image, sound or video) and renders a visual response or a download confirmation if the file is unrecognised.




    ## Name 3 ways to decrease page load
    Do not use large libraries, or cut out only the bits of code you are using from large libraries.
    Enable browser caching for static content elements.
    Load some content before others (lazy loading).
    Reduce the number of dependencies
    minify dependencies
  5. Noviny revised this gist Jan 28, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Job Interview Things.md
    Original file line number Diff line number Diff line change
    @@ -34,4 +34,4 @@ In rails, methods are publicly visible to users by default, except where a nodoc
    DRY or 'Don't Repeat Yourself' is a methodology that aims at reducing repetition and extraneous code by identifing repeated code that performs the same logic throughout a project or file (depending on scope) and consolidating into a single function that can initialized where the repeated code would otherwise exist.

    ## What is the log to check for errors in Rails?
    Once the server is running, rails errors will be printed in the server logs. This is very important for checking server-side errors, as you may get inaccurate errors on the front end, or no error messages with wrong data. (also, write tests).
    Once the server is running, rails errors will be printed in the server logs. This is very important for checking server-side errors, as you may get inaccurate errors on the front end, or no error messages with wrong data. (also, write tests). It is recorded in log/development.log while the project is in development mode.
  6. Noviny revised this gist Jan 28, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Job Interview Things.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ Instance variables should be used when the code they exist within need a specifi
    In rails, methods are publicly visible to users by default, except where a nodoc is included. You may want to restrict the public visibility of backend classes and methods.

    ## What is meant by DRY?
    Don't Repeat Yourself. If two bits of code use the same, or similar logic, only write the line once, and include it in a function or variable.
    DRY or 'Don't Repeat Yourself' is a methodology that aims at reducing repetition and extraneous code by identifing repeated code that performs the same logic throughout a project or file (depending on scope) and consolidating into a single function that can initialized where the repeated code would otherwise exist.

    ## What is the log to check for errors in Rails?
    Once the server is running, rails errors will be printed in the server logs. This is very important for checking server-side errors, as you may get inaccurate errors on the front end, or no error messages with wrong data. (also, write tests).
  7. Noviny revised this gist Jan 28, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion Job Interview Things.md
    Original file line number Diff line number Diff line change
    @@ -22,11 +22,16 @@ By providing a convention allows ease of creation, and ease of reading others' p
    ## Compare instance and class variables
    Class variables are available to all objects in the class, while instance variables are unique to a single instance of that class. The class variables will be common to all instances, while instance variables will vary.


    Class variables (accessed with @@) belong to all objects in a class where instance variables (accessed with @) only belong to a single object.
    Instance variables should be used when the code they exist within need a specific instance (a single instance of a fruit), and class variables should be used everywhere else (available to all fruits).


    ## Describe the concept of visibility in Rails
    In rails, methods are publicly visible to users by default, except where a nodoc is included. You may want to restrict the public visibility of backend classes and methods.

    ## What is meant by DRY?
    Don't Repeat Yourself. If two bits of code use the same, or similar logic, only write the line once, and include it in a function or variable.

    ## What is the log to check for errors in Rails?
    Once the server is running, rails errors will be printed in the server logs.
    Once the server is running, rails errors will be printed in the server logs. This is very important for checking server-side errors, as you may get inaccurate errors on the front end, or no error messages with wrong data. (also, write tests).
  8. Noviny revised this gist Jan 28, 2016. 1 changed file with 16 additions and 1 deletion.
    17 changes: 16 additions & 1 deletion Job Interview Things.md
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,19 @@ If you call .empty? on something with a class of Nil, you get a NoMethodError, w

    ## What is a framework?
    A framework is a library used to provide structure to a project, including using inbuilt libraries, as well as structuring file layout.
    By providing a convention allows ease of creation, and ease of reading others' projects.
    By providing a convention allows ease of creation, and ease of reading others' projects.




    ## Compare instance and class variables
    Class variables are available to all objects in the class, while instance variables are unique to a single instance of that class. The class variables will be common to all instances, while instance variables will vary.

    ## Describe the concept of visibility in Rails
    In rails, methods are publicly visible to users by default, except where a nodoc is included. You may want to restrict the public visibility of backend classes and methods.

    ## What is meant by DRY?
    Don't Repeat Yourself. If two bits of code use the same, or similar logic, only write the line once, and include it in a function or variable.

    ## What is the log to check for errors in Rails?
    Once the server is running, rails errors will be printed in the server logs.
  9. Noviny renamed this gist Jan 26, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. Noviny revised this gist Jan 26, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Job Interview Things
    Original file line number Diff line number Diff line change
    @@ -6,10 +6,10 @@ Are made when requesting a webpage, as well as in AJAX requests after page load
    Provides structure and consistency when talking to lots of different servers.

    ## Explain the difference between empty? and nil?
    Nil is an object type, while Empty is a property of an object that contains nothing within ruby.
    Nil is an object class, while Empty is a property of an object that contains nothing within ruby.
    Empty can only be used to return a boolean, whereas things can be set as nil.
    If you call .empty? on something with a class of Nil, you get a NoMethodError, while .nil? on something empty returns false.

    {}, [], "", and '' all return 'true' for .empty? while .nil? returns false.


    ## What is a framework?
  11. Noviny created this gist Jan 26, 2016.
    17 changes: 17 additions & 0 deletions Job Interview Things
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    ## Explain RESTful architecture.
    Stands for REpresentational State Transfer
    Most APIs use restful architecture for retrieving data from them.
    They use HTTP requests, and so can have GET, POST, PUT, DELETE requests made to them.
    Are made when requesting a webpage, as well as in AJAX requests after page load to retrieve informatino from servers
    Provides structure and consistency when talking to lots of different servers.

    ## Explain the difference between empty? and nil?
    Nil is an object type, while Empty is a property of an object that contains nothing within ruby.
    Empty can only be used to return a boolean, whereas things can be set as nil.
    If you call .empty? on something with a class of Nil, you get a NoMethodError, while .nil? on something empty returns false.



    ## What is a framework?
    A framework is a library used to provide structure to a project, including using inbuilt libraries, as well as structuring file layout.
    By providing a convention allows ease of creation, and ease of reading others' projects.