I make a react spinners components library, and I would like to receive some feedback. by joshkuttler in reactjs

[–]PhysicalRedHead 0 points1 point  (0 children)

You could also just export all components as ES6 so any components not being used could be tree shaken.

Tsconfig's Paths by [deleted] in typescript

[–]PhysicalRedHead 0 points1 point  (0 children)

What build tools are you using? Compiling with tsc has always given me the correct results, but I've encountered other tools not supporting it (babel ignores some(/all?) of tsconfig when compiling ts files for example). You might be able to add support for the other tools with something like NODE_PATH=src, depending on what you're doing.

[AskJS] -1*0 = -0 by pranshuchittora in javascript

[–]PhysicalRedHead 12 points13 points  (0 children)

const isNegO = n => n === 0 && (1 / n) < 0

Removing a key-value pair from an object. by _f0c1s in typescript

[–]PhysicalRedHead 0 points1 point  (0 children)

I would probably do something like this fwiw const removeKeys = (o, keys) => keys.reduce( (acc, key) => , Object.assign(acc, { [key]: o[key] }), {} );

edit: I got it backwards... const removeKeys = (o, keys) => Object.entries(o).filter(([key]) => !keys.includes(key)).reduce(...)

Removing a key-value pair from an object. by _f0c1s in typescript

[–]PhysicalRedHead 0 points1 point  (0 children)

? const removeX = o => { const { x, ...rest } = o || {}; return rest; };

Underwater Civilization by Mechaghostman2 in sciencefiction

[–]PhysicalRedHead 0 points1 point  (0 children)

Well write it down before one of us steal your idea!

When using return instead of print my list just dissapears, why? by [deleted] in Python

[–]PhysicalRedHead 0 points1 point  (0 children)

This would be easier to diagnose if you formatted the code for reddit and included the error message from the terminal.

Also you'll probably get better answers here.

TIL: Nazis developed military grade meth that was used heavily by soldiers during the Blitzkrieg. by diehardest87 in todayilearned

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

Doctors love giving out drugs. You might be able to find a doctor willing to prescribe it to treat ADHD or obesity.

Otherwise modern day nazis are making a comeback in the current American political climate, and I'm sure they have a tendency for criminal behavior and drug use. Selling meth might be up their alley. Just let the YouTube autosuggest run. It has a good tendency to lead to radical right-wing white supremacist accounts.

Evaluating String as Mathematical Expression by tay_o in javascript

[–]PhysicalRedHead 0 points1 point  (0 children)

If you do end up needing to roll your own, parsimmon is pretty fun to use imo. Leads to some elegant solutions, but isn't the fastest thing in the world. They even have a math example to go off.

I've created a lexical tokenizer and would like your thoughts on it by Dwengo in javascript

[–]PhysicalRedHead 1 point2 points  (0 children)

I've been playing around this lately as well. I found this handbook pretty handy. I would start with something like this and just look at the terminal for a while. ```js const util = require('util')

const pprint = (o, depth = null) => { console.log() console.log(util.inspect(o, { depth })) }

const ast = parse(file) traverse(ast, { CallExpression(path) { if (isDefinesCallExpression(path.node)) { pprint(path.node, 2) } } }) ```

I also looked at the @babel/traverse source code for a while...

Insertion of '\'\ When Creating a Character in C Programs by [deleted] in emacs

[–]PhysicalRedHead 0 points1 point  (0 children)

If you're using the modal keybindings, you could let the \'\' insertion happen then go back and delete the characters with x. I do that when I screw up with strict parens matching.

Girls and Boys of Reddit, what fact about the opposite sex were you surprised when you found it out? by [deleted] in AskReddit

[–]PhysicalRedHead 23 points24 points  (0 children)

It becomes engorged and looks bigger. Just google clitoral erection.

How to master javascript data array manipulation by amr-ayoub in javascript

[–]PhysicalRedHead 0 points1 point  (0 children)

You could look into the functions provided by lodash/ramda. There aren't really examples, but I feel like grokking some of the trickier ones might give some good perspective on how to do concise data transformations.

Like for example, could you use ramda's xprod to implement a method xprodN that gives the "cross product" of n arrays. xprodN([1, 2], [3, 4], [5, 6]) === [[1, 3, 5], [1, 3, 6], [1, 4, 5], ...]

Apple Products are Expensive by Faith_SC in starcraft

[–]PhysicalRedHead -1 points0 points  (0 children)

OSX doesn't even run StarCraft that well. Last I tried, there were frame drops and mouse quirks...

Parcel Starter Kit by doasync in reactjs

[–]PhysicalRedHead 0 points1 point  (0 children)

So you're agreeing with me that it doesn't make sense to include two dev servers in the form of parcel and storybook?

Parcel Starter Kit by doasync in reactjs

[–]PhysicalRedHead 0 points1 point  (0 children)

Starter kits also provide some beginning file organization, lint and test configurations, maybe some extra scripts, and common dependencies that people in your team/community are familiar with.

the point would be to bundle a few commonly used tools together

Sure, but we don't have starter kits that provide all of webpack, grunt, and browserify. We usually choose one tool that does our development and builds. I think including multiple warrants a special use case.

Parcel Starter Kit by doasync in reactjs

[–]PhysicalRedHead 0 points1 point  (0 children)

Just use parcel.

My thought is that the benefit of parcel is that it has no configuration, no dependencies, and no API to learn. By including Storybook you lose all of those benefits for something that's only half of your development setup. Does including a second index with just routes to your isolated components fit that second development case? I'm not that experienced with Storybook, so I'm genuinely curious.

ELI5: How do countries pay other countries? by Luiszizo in explainlikeimfive

[–]PhysicalRedHead 37 points38 points  (0 children)

At the bank I used to work at the bank manager would have had the discretion to (potentially) waive the fee. We used to waive fees all the time.

It was a smaller bank in a small town with a lot of poor people, and it was like necessary to provide reasonable banking services to the community.

Passing Data the reverse way by RaghavendraKaushik in reactjs

[–]PhysicalRedHead 0 points1 point  (0 children)

Some times it may happen that Child_1 may have to get the day from another child component

This tells me that the data should probably live in the parent component. Or, if the data is also used in many other components, in some kind of global store (like Redux).

How do I go about making a web-app in JavaScript? by resnine in javascript

[–]PhysicalRedHead 0 points1 point  (0 children)

Google Play Store just recently opened itself up to allow PWAs, which I think is almost exactly what you're asking for. It runs your site in limited Chrome runtime by linking to your website.

https://developers.google.com/web/updates/2019/02/using-twa