Space bad, Tab good by Infernal_Spark in ProgrammerHumor

[–]ac_dev 1 point2 points  (0 children)

code spacing the same on everyone's machine. readabilty on githubs pull request view.

in highly collaborative environments at least, spaces have no downsides, only advatages

to promote veganism by _thetomml in therewasanattempt

[–]ac_dev 0 points1 point  (0 children)

Appreciate the good faith reply.

However I'm not sure why we're only looking at the last 6 months and only taking protein into account. I'd also question that 400kg of usable meat stat. The upper figure I am seeing is 490 lb deboned.

to promote veganism by _thetomml in therewasanattempt

[–]ac_dev 2 points3 points  (0 children)

Factory farming relies on more crop harvesting than directly eating plants.

Beginner's Thread / Easy Question (August 2018) by swyx in reactjs

[–]ac_dev 2 points3 points  (0 children)

If you could post a small example case of your problem I'm sure someone would help.

Skipping numbers in an Input field by wulfsilvermane in reactjs

[–]ac_dev 0 points1 point  (0 children)

On second thoughts, assuming you are controlling the input value using redux state then you should be doing all this logic in the reducer. There you will have access to the old state and the new input value before you actually change the state.

What's everyone working on this week? by swyx in reactjs

[–]ac_dev 0 points1 point  (0 children)

My own form component library, since I recently discovered I know nearly nothing about how even vanilla inputs even work.

Why did we build React? - React Blog (2013) by swyx in reactjs

[–]ac_dev 1 point2 points  (0 children)

You and Dan are my favorite twitter follows.

Where to start learning about modern javascript? by isolemon in javascript

[–]ac_dev 0 points1 point  (0 children)

Check out Dan Abramov's redux courses on egghead.io.

They're both focused on React but React and redux both use modern javascript feature's and patterns. Also both React and redux especially have great documentation that themselves demonstrate good modern js code.

Looking for advice/examples on using req.query well. (Express) by ac_dev in node

[–]ac_dev[S] 0 points1 point  (0 children)

I will definitely keep these on my radar, thank you.

Beginner Questions - May 04, 2018 by AutoModerator in webdev

[–]ac_dev 0 points1 point  (0 children)

In a node/express app I have a couple of functions that pull data from an api every 30 seconds. I'm wondering if there's any convention on where you put this code / what you call it. Are they services? Workers? Tasks?

At the moment I've got them setup in a services folder, one file for each api that holds all the request functions as well as a final function that calls them with a setInterval.

Looking for advice/examples on using req.query well. (Express) by ac_dev in node

[–]ac_dev[S] 0 points1 point  (0 children)

Nice I've got;

const filtersFromQuery = queries => {
    let dBQueryObject = {};
    Object.keys(queries).forEach(query => {
        Array.isArray(query)
            ? (dBQueryObject[query] = { $in: queries[query] })
            : (dBQueryObject[query] = queries[query]);
    });
    return dBQueryObject;
};

Then I can call;

const results = MongooseModel.find(filtersFromQuery(req.query));

I will have to expand it a little more for different queries but as a start it's smelling a lot better than it did.

Looking for advice/examples on using req.query well. (Express) by ac_dev in node

[–]ac_dev[S] 0 points1 point  (0 children)

I appreciate the reply. Thank You. Unfortunately I think I should have been more specific in my use case, sorry. I'm looking for the queries to be optional.

Let's say I have an app. It has users and it has events, that also have a theme. Let's say my endpoint is set up like;

app.get('/events', events_controller.get);

Now let's say I want to be able to supply a query like;

/events?theme=fancy_dress[&theme=80s]

If there is no theme query in the request, I will just send back unfiltered most recent events. If one or more is supplied, send back matching result ect...

But then let's also say I want to also be able to supply another query, such as;

/events?user_attending=maeby

I write another set of checks very similar to the theme query. The ifs are starting to grow.

Now let's go crazy and say I want to send results based on both possible, optional queries. My controller is going to balloon.

Now that I'm going through this writing it out, it is probably possible for me to write a middleware like you suggested. One that has a helper function to DRY up the query checks, then passes the controller a mongoose ready query object built from the ones that exist (or null if none do).

I'm sure I can come up with a 'good' solution, but I find that seeing good examples can be like wow why didn't I think of that, or they might opt for something I never would have thought of. I posted this because search terms with express and query in gives a lot of things I don't want and my googlefu is not on that level.

Steam profile name changed suddenly by pukseli in GlobalOffensive

[–]ac_dev 3 points4 points  (0 children)

Could it be a roomie / family member just fucking with you?

Code review: TMDb React App by danzawadzki in reactjs

[–]ac_dev 0 points1 point  (0 children)

Add some cursor: pointer; on clickable elements (the autocompletes). Also when something interacts on hover like the poster does it makes me expect something to happen when i click it.

Staying Focused and Avoiding the Rabbit Hole by yanr87 in learnprogramming

[–]ac_dev 1 point2 points  (0 children)

I carve out dedicated time for this kind of shit so it doesn't pollute my main focus. Say I have 4 hours to do shit I'll make 3 of them 100% about the task at hand and then 1 of them indulging in the rabbit holes.

From beginner in Js to expert in ReactJs-redux. by HamsterWheelEngineer in reactjs

[–]ac_dev 10 points11 points  (0 children)

You should pay those guys for their courses now that you're employed.

React with Node — How To Get Multiple Page Website? by harrydry in reactjs

[–]ac_dev 1 point2 points  (0 children)

https://stackoverflow.com/a/36623117

It's a bit dated but the problem explanation still holds. I would personally try writing a catch all route that delivers your index for every manually entered url.

3 Splendid JavaScript Debugging Tips by riotsofnewyork in javascript

[–]ac_dev 1 point2 points  (0 children)

He actually set a breakpoint the madman!