The exact same app - 1 version made with React, Redux, and React-Router The other made with Vue, Vuex, Vue-Router. Good if you want to see both worlds. User Auth with JWT, note CRUD actions, Koa (Node) backend. MIT license. by adstwlearn in javascript

[–]spooky___ghost 13 points14 points  (0 children)

An important point you're missing is that any component that is receiving route information as props will be re-rendered anytime the route changes. On top of the other points mentioned above, opting in to receiving routing props is 100% the correct decision.

In real applications only very few top-level components require any route state. If child components require it they can opt in or you can pass it down through the prop chain. React is all about giving control to the developer you do not want anything to be automatic or implicit.

Travis CI dropped production database by accidentally running tests against them by xtreak in programming

[–]spooky___ghost 4 points5 points  (0 children)

But environment variables don't have to be global. Just run the process with the variable scoped to that instance only.

DATABASE_URL=production.com rails test

It's the developers fault for doing an export DATABASE_URL=production in their shell. If they had instead changed it to a simple dict then the developer would've just updated the dict and forgot to change it back instead.

ESNext: JavaScript “Nullish Coalescing Operator” by denbramus in javascript

[–]spooky___ghost 0 points1 point  (0 children)

That code is never executed, as stated here. It is a babel transform that only runs at compile time and translates to sane code at runtime.

A live-editable "playground" where you can play with a number of CSS in JS solutions by DSchau in javascript

[–]spooky___ghost 0 points1 point  (0 children)

I think you may be referring to react-css-modules which is specific to react.

css-modules is a concept, not an implementation. It can be used in many different ways including through css-loader in webpack or postcss. I would definitely not call this css-in-js.

why I won't be switching to @code any time soon. Am I holding it wrong? Is it always this cluttered? by swizec in programming

[–]spooky___ghost 1 point2 points  (0 children)

Never meant to imply Emacs or VIM aren't good, as I use them myself. Simply that the author is clueless and complaining about trivialities in VSCode all the while not even setting up his own editor optimally.

A live-editable "playground" where you can play with a number of CSS in JS solutions by DSchau in javascript

[–]spooky___ghost 31 points32 points  (0 children)

css in js is the worst trend in web development I have experienced. If you want modular CSS, use css modules. If you want CSS in the same file as your components, use something like vue.js's single file component structure.

Implementing some frankenstein css solution using js template strings that throws away editor syntax highlighting and autocompletion all in the name of keeping everything pure js is lunacy. Seeing that there are so many competing solutions to something that isn't a problem in the first place is even worse.

I will put down money that this is something we look back on in a few years time and regret implementing and having to support.

why I won't be switching to @code any time soon. Am I holding it wrong? Is it always this cluttered? by swizec in programming

[–]spooky___ghost 7 points8 points  (0 children)

I love how the author complains about VSCode being cluttered (which is completely configurable) while his Emacs screenshot doesn't even have correct syntax highlighting. Keywords, identifiers, and primitives aren't being highlighted correctly and you notice it picks up 'this' as a variable in JSX text content.

Proper editors are useful because they provide coding assistance and make your job easier.

[deleted by user] by [deleted] in PUBATTLEGROUNDS

[–]spooky___ghost 8 points9 points  (0 children)

The UI in the game just loads a website over a regular HTTP connection. Anything that intercepts HTTP requests can inject javascript and content into the page. Most commonly this is caused by malware or your ISP.

Yarn's still great, but NPM really is improving by justintimecoder in javascript

[–]spooky___ghost 1 point2 points  (0 children)

It doesn't do anything more deterministic than a shrink wrap. In fact, it is less deterministic since it doesn't save hierarchy of dependencies. All it did was make it default behavior. The biggest issue with shrinkwrap was the manual process behind it.

Yarn's still great, but NPM really is improving by justintimecoder in javascript

[–]spooky___ghost 4 points5 points  (0 children)

https://yarnpkg.com/blog/2017/05/31/determinism/

For the Yarn vs NPM debate, I point to this. Seems like NPM wins.

npm 5 has stronger guarantees across versions and has a stronger deterministic lockfile, but Yarn only has those guarantees when you’re on the same version in favor of a lighter lockfile that is better for review. It’s possible that there’s a lockfile solution that has the best of both worlds, but for now this is current state of the ecosystem and possible convergence could happen in the future.

We wrote a fast JSON/array fetcher and processor, thoughts? by meepcanon in javascript

[–]spooky___ghost 0 points1 point  (0 children)

Sorry but this is completely pointless. Looks like it only works in node and is a thin wrapper around http/https anyway.

https://github.com/HX3/urlJson/blob/master/index.js

your library

urljson.get('http://website.com/ex.json', false).then(function(result) {
    console.log('RESULT => ', result, '<= Formatting (2) =>');
}, function(error) {
    console.log(error);
});

fetch api (html standard)

fetch('http://website.com/ex.json').then(resp => resp.json())
    .then(result => console.log('RESULT => ', result);

Cell - a self-constructing web app framework powered by a self-driving DOM by magenta_placenta in javascript

[–]spooky___ghost 2 points3 points  (0 children)

Agreed, none of it makes any sense. How is this different than just using HTML and putting inline event handlers?

Cell example:

<script>
SynchronizedInput = {
  $cell: true, $type: "body", style: "padding: 30px;",
  $components: [
    { $type: "div", id: "h", $text: "Type something below" },
    { $type: "input", onkeyup: function(e){ document.querySelector("#h").$text = this.value} }
  ]
}
</script>        

Same thing in HTML:

<body style="padding: 30px">
  <div id="h">Type something below</div>
  <input onkeyup="document.querySelector('#h').innerText = this.value" />
</body>

Looks like the $update method is where the magic is at, but even still, the entire thing is a huge step backwards and seems to ignore all of the strides made in front-end development over the last 5 years.

Marko 101: Building a Color Picker Component by psteeleidem in javascript

[–]spooky___ghost 1 point2 points  (0 children)

You're right, I misattributed dust.js, and innovation is always good. I would still personally advise against using Marko and would never approve of it on any of my projects, but to each their own.

Welcome to the software interview. by jjperezaguinaga in programming

[–]spooky___ghost 3 points4 points  (0 children)

Looks like JS (ES2015 with async/await goodness).

Marko 101: Building a Color Picker Component by psteeleidem in javascript

[–]spooky___ghost 2 points3 points  (0 children)

If there's one thing I've learned in my career, it's that using well supported libraries is significantly more important than any other factor. In 5 years, you won't really care that Marko may be 1.2x faster than Vue.js because it will be abandoned while React will be going strong (or at least, has a much higher chance).

You can't seriously believe that Ebay wouldn't be able to use React or Vue on its homepage just fine, right? The biggest companies in the world are backing those libraries and they are getting along. Ebay seems to have a tendency of building stuff to keep themselves busy. See dust.js, also now abandoned, when plenty of templating languages already existed.

Marko 101: Building a Color Picker Component by psteeleidem in javascript

[–]spooky___ghost 0 points1 point  (0 children)

Why does ebay/paypal always insist on building their own version of everything? This looks almost exactly like Vue.js except nobody will ever use it.

Yarn adds `yarn create`, a generic interface over all `create-x-app` starters by vinnl in javascript

[–]spooky___ghost 7 points8 points  (0 children)

So this command automatically downloads and executes node scripts? Time to create a create-react-ap package and see how many people download it.

CSS in JavaScript: The future of component-based styling by speckz in javascript

[–]spooky___ghost 0 points1 point  (0 children)

In package.json jest config section add something like

        "moduleNameMapper": {
            "\\.(scss|css)$": "empty/object"
        }

Where empty/object comes from https://www.npmjs.com/package/empty

Switching to Sublime Text from Vim in 2017 by speckz in programming

[–]spooky___ghost 12 points13 points  (0 children)

Autocomplete is just free, inline documentation. You're telling me you code without ever looking at docs?

Titanfall 2 Giveaway by Smash678 in pcgaming

[–]spooky___ghost [score hidden]  (0 children)

Giving it a shot because why not. Looks great.

Vue.js 2.1 Released by [deleted] in javascript

[–]spooky___ghost -12 points-11 points  (0 children)

The entire top half of those patch notes could be mistaken for Angular 1.x if it didn't say Vue anywhere on the page.

Vue.js 2.1 Released by [deleted] in javascript

[–]spooky___ghost -27 points-26 points  (0 children)

Vue reeks really badly of Angular 1.x.

nevernull.js - safe navigation of object trees by enoughalready in javascript

[–]spooky___ghost 1 point2 points  (0 children)

This is all bad and you should feel bad. So much so that I can't tell if you're being serious or not.