Log in
Sign up
Overview Questions Answers

itsbambi

    Stats

    • 186 reputation
    • 28 questions asked
    • 138 answers
    • 68 selected answers
    Overview Questions Answers
    • Newest Questions 28
    Good questions to ask at the end of a software development interview?
    Asked 1 year, 2 months ago by itsbambi · Unansweredinterviews
    1
    Get the current version of NPM via the command line?
    Asked 1 year, 2 months ago by itsbambi · Answerednpm
    2
    Get the current version of Node.js on macOS?
    Asked 1 year, 2 months ago by itsbambi · Answerednode.jsmacos
    3
    Clear all localStorage data in Cypress?
    Asked 1 year, 2 months ago by itsbambi · Answeredcypressjavascript
    2
    Remove any spaces from the start and/or end of a string?
    Asked 1 year, 2 months ago by itsbambi · Answeredjavascriptstrings
    3
    View more →
    • Newest Answers 138
    What does this .replace(/ {2,}/g, " ") regular expression do to a string?

    It finds any instances of two or more consecutive spaces and replaces it with one single space.

    A breakdown:

    • {2,}: matches any instances of two or more consecutive spaces.
    • g: modifier that specifies a global match. So all matches are found (not just the first).
    Answered 1 year ago by itsbambi
    What does this .replace(/\s+/g, " ") regular expression do?

    It finds any whitespace with two or more spaces and replaces it with a single space.

    A breakdown:

    • \s: matches any whitespace in the string.
    • +: quantifier that matches any whitespace greater than one space
    • g: modifier that specifies a global match. So all matches are found (not just the first).
    Answered 1 year ago by itsbambi · Selected answer
    Use an if else statement in a Handlebars (.hbs) file?

    Handlebars has a built in {{#if}} helper you can use.

    More info here: https://handlebarsjs.com/guide/builtin-helpers.html#if.

    They have a good example of an if...else here: https://handlebarsjs.com/examples/builtin-helper-ifelse-block.html.

    Answered 1 year ago by itsbambi
    Check if docker-compose is installed on my macOS machine?

    The which command should work for this:

    which docker-compose
    

    If Docker Compose is installed on you machine, it should output the path to the executive:

    /opt/homebrew/bin/docker-compose
    
    Answered 1 year ago by itsbambi
    Get the name of the current browser being used in Cypress?

    Your looking for the Cypress.browser object.

    In that object is a name property that returns a "firefox", "chrome", "electron", or "edge" browser name string.

    Cypress.browser.name
    

    If you wanted to only run a test in Chrome, you could do this:

    if (Cypress.browser.name === "chrome") {
      // run specific test
    }
    
    Answered 1 year ago by itsbambi · Selected answer
    View more →
    • Terms
    • Privacy

    © 2023 Chunkks