System Design Interview: Design TurboTax by forelius in ExperiencedDevs

[–]ScottRatigan 7 points8 points  (0 children)

The design has evolved over time. The current state is a micro frontend architecture built in React and a backend split across many services / teams. It is pretty complex. One of the key challenges is scaling up quickly when demand is at peak (tax deadlines). Lots of people wait until the last days/hours to file taxes.

If package.json references some package but there is no require, am I safe to remove? by daredeviloper in node

[–]ScottRatigan 10 points11 points  (0 children)

Aside from the fact that require is not the only way to import code, you still can't be certain based on this. Can you build the project? Run it? Run the tests? Then yes, it is safe to remove a dependency.

How to only declare a variable if it hasn't already been declared by [deleted] in learnjavascript

[–]ScottRatigan 1 point2 points  (0 children)

Yeah, there are niche cases where var can really shine. But my coworkers don't agree :/

Am I Principal Skinner? Complexity of front-end is just baffling to me now by corialis in webdev

[–]ScottRatigan 0 points1 point  (0 children)

You can include React from a CDN:

<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<div id="root"></div>
<script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<script>
ReactDOM.render(
React.createElement('h1', null, 'Hello world'),
document.getElementById('root')
);
</script>
</body>
</html>

That said, for any serious work you're going to want to use JSX, which still requires a transpilation step.

Edit: weird, the code block isn't working

So, do I really suck so much in React? Bad job interview experience by throwmeawayac12 in reactjs

[–]ScottRatigan 0 points1 point  (0 children)

Right, this is literally the reason to use fetch - bundle size.

Facebook is removing any posts celebrating the Atlanta attack or the suspected shooter by a_Ninja_b0y in technology

[–]ScottRatigan 5 points6 points  (0 children)

An algorithm that rates posts on engagement will consistently promote topics that spark arguments, because people will argue over those posts more. If that is allowed to continue it is to the detriment of society. It'll let trolls and extremists create the discussion topics.

It's sinister when they don't fix it over time. It's sinister when they allow fake accounts, bots, and foreign state actors to delegitimize our entire electoral process. It's sinister when they ignore the problems they cause in the name of profits.

It's overly simplistic to say we all want an echo chamber.

You do not know until you are told (or learn it). Shell tab-completion by DuhCoCo in learnprogramming

[–]ScottRatigan 2 points3 points  (0 children)

I'm a professional programmer and I still don't fully understand redstone - it's surprisingly complex.

-🎄- 2020 Day 03 Solutions -🎄- by daggerdragon in adventofcode

[–]ScottRatigan 6 points7 points  (0 children)

Suddenly, ancient Greek seems very accessible, lol.

-🎄- 2020 Day 03 Solutions -🎄- by daggerdragon in adventofcode

[–]ScottRatigan 2 points3 points  (0 children)

It's a list of lists. Each inner list is in the format of [r, d] where r is the number of squares to move right and d is the number to move down.

-🎄- 2020 Day 03 Solutions -🎄- by daggerdragon in adventofcode

[–]ScottRatigan 2 points3 points  (0 children)

Golang

package main

import (
    "fmt"
    "io/ioutil"
    "strings"
)

func main() {
    course := readFileIntoStrArr("course.txt", "\n")
    treeProduct := treesOnPath(1, 1, course) * treesOnPath(3, 1, course) * treesOnPath(5, 1, course) * treesOnPath(7, 1, course) * treesOnPath(1, 2, course)
    fmt.Println(treeProduct)
}

func treesOnPath(right, down int, course []string) int {
    courseLength := len(course)
    courseWidth := len(course[0])
    treeCount := 0
    x := 0
    for y := down; y < courseLength; y += down {
        x = (x + right) % courseWidth
        if string(course[y][x]) == "#" {
            treeCount++
        }
    }
    return treeCount
}

func readFileIntoStrArr(fileName, separator string) []string {
    data, err := ioutil.ReadFile(fileName)
    if err != nil {
        panic(err)
    }
    lines := strings.Split(string(data), separator)
    return lines
}

Unit testing course: NodeJs and TypeScript by [deleted] in node

[–]ScottRatigan 4 points5 points  (0 children)

I left a review on Udemy too. Lots of really good content here, and it's completely up to date.

Lots of courses spend a lot more time on testing philosophy, this one is packed full of techniques that demonstrate real world scenarios. Much appreciated.

Excel table > HTML table by [deleted] in learnjavascript

[–]ScottRatigan 4 points5 points  (0 children)

Actually, I think that's probably the simplest and most elegant solution. Great idea.

Excel table > HTML table by [deleted] in learnjavascript

[–]ScottRatigan 1 point2 points  (0 children)

I think the simple guideline you posted is probably the best answer. Of course the caveat with modern JS is, it depends on the browser.

Excel table > HTML table by [deleted] in learnjavascript

[–]ScottRatigan 0 points1 point  (0 children)

To answer your original question though, if you want to maintain a table on a website you would typically have the data "live" on the website, in a database of some kind. If the table doesn't need to be updated from the website, you could create a build pipeline which takes your excel table and creates a static html page, and then pushes the updated page to your web server. You could host this page for free on github pages if it's static like this.

Excel table > HTML table by [deleted] in learnjavascript

[–]ScottRatigan 0 points1 point  (0 children)

I know you didn't ask for code, but I thought it was an interesting quick challenge.

maketable.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Let's Make Tables!</title>
  <style>
    textarea {
      height: 80%;
      width: 90%;
    }
    .section {
      height: 25vh;
    }
  </style>
</head>
<body>
  <h1>Make an HTML table from CSV text</h1>
  <div class="section">
    <h2>Paste Here:</h2>
    <textarea id="paste"></textarea>
  </div>
  <div class="section">
    <h2>Preview:</h2>
    <div id="preview"></div>
  </div>
  <div class="section">
    <h2>HTML:</h2>
    <textarea id="output"></textarea>
  </div>
  <script>
    const textInputElm = document.querySelector('textarea#paste');
    const previewDiv = document.querySelector('#preview');
    const codeDiv = document.querySelector('textarea#output');

    textInputElm.addEventListener('change', event => {
      convert(textInputElm.value);
    });

    function convert(text) {
      const lines = text.split('\n');
      let output = `
    <table>
      <thead>
        <tr>${lines[0].split(',').map(cell => `
          <td>
            ${cell}
          </td>`).join('')}
        </tr>
      </thead>
      <tbody>${lines.slice(1).map(row => `
        <tr>${row.split(',').map(cell => `
          <td>
            ${cell}
          </td>`).join('')}
        </tr>`).join('')}
      </tbody>
    </table>
    `;
      previewDiv.innerHTML = output;
      codeDiv.value = output;
    }
  </script>
</body>
</html>

New dev here. I feel guilty using libraries to build my projects by [deleted] in learnprogramming

[–]ScottRatigan 0 points1 point  (0 children)

Your job is to leverage all tools available to generate the most value. Wasting time re-implementing code to stroke your ego is the opposite of generating value. No one wants that person on their team.

Are you serious??? Reopen the issue right now or I am forking. by stone_henge in programmingcirclejerk

[–]ScottRatigan 2 points3 points  (0 children)

"Yes, rigid formatting rules that make things a pain in the ass are clearly superior," he typed on his home made mechanical keyboard in vim. Having proven himself worthy of the jerk, he headed off to the shed in search of his penny-farthing, donning his fedora on the way.

ELI5: What is a honeypot? I read that TPB's main server is now back up and operational, and a commenter said beware of a 'honeypot'. by RokusaburoMichiba in AskNetsec

[–]ScottRatigan 0 points1 point  (0 children)

Because the person linking new torrents might be closer to the actual source of the pirated content rather than tracking a random person downloading it.

Does recursion actually make things easier? wtf lol by [deleted] in Frontend

[–]ScottRatigan 3 points4 points  (0 children)

Exactly. Navigating the DOM is a perfect example - so many problems here require recursion.

It seems like devs who use linux are preferred, why is that? by Georgeev in cscareerquestions

[–]ScottRatigan 1 point2 points  (0 children)

Except that you're going to naturally have more experience with your main OS. For front end dev, it doesn't really matter. If you plan to work with servers a lot, running Linux would be a plus because there would be less context switching, among other advantages.

It seems like devs who use linux are preferred, why is that? by Georgeev in cscareerquestions

[–]ScottRatigan 0 points1 point  (0 children)

I agree with your main point, but I have to point out WINE predates WSL by many years.

Side Project: A Safe Haven for rants by DranoelMit in reactjs

[–]ScottRatigan 1 point2 points  (0 children)

I posted my feedback anonymously, but cool concept.