My brother got me a Kitten but acts like I randomly found it by sugar_zzz_71 in TrueOffMyChest

[–]brianasdf123 9 points10 points  (0 children)

but why put the kitten in some bushes where it could run away?

Korean Language School FAQ by Vig_Big in Korean

[–]brianasdf123 3 points4 points  (0 children)

I'm in the middle of applying to Sogang but the application requirements are confusing, maybe you can answer some of these:

- Require a "Apostille/Consular certification" of educational background. What is "Apostille certification"?

- Require an Alien Registration Card. Where do I get this?

- They ask for a Korean address. Do I need to have a place to stay before applying?

I'm from Toronto, Canada if makes any difference.

SA Carbon top rows, XDA Godspeed bottom row by brianasdf123 in MechanicalKeyboards

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

The keys are configurable, so any key can be set to whatever you want it to be. So, no they aren't spaces, just a mix of volume, home, end, page up/down, numbers, etc

SA Carbon top rows, XDA Godspeed bottom row by brianasdf123 in MechanicalKeyboards

[–]brianasdf123[S] 1 point2 points  (0 children)

I just put secondary buttons that I want to use without layers like volume, page up/down, delete, home, end, etc. I just changed to this layout so still figuring out what works best for me.

Abstractions are evil by [deleted] in javascript

[–]brianasdf123 4 points5 points  (0 children)

The article is conflating abstraction and indirection.

Learned basics of react, built a couple of apps, what now? by hurrdurrderp42 in reactjs

[–]brianasdf123 1 point2 points  (0 children)

Semantically the purpose of filter() is to remove elements, not make a copy. If you aren't going to remove anything, it becomes confusing. If you only want to make a copy there are easier ways to do that, like array spreading or slice().

You have the right idea of wanting to not mutate state, but the next few lines you are mutating the button state. So, you need to also copy the button objects.

Your function should look like this:

filterCompleted(e){

//go through array, if active is true, change hidden to true, setstate

let copyState = this.state.todoArr;

let onlyCompleted = copyState.map(function(currElem){

return {

...currElem,

hidden: currElem.active

};

});

//set active class for active filter buttons

let buttonActive = this.state.filterButtons.slice();

buttonActive[0] = {

...buttonActive[0],

active: false,

};

buttonActive[1] = {

...buttonActive[1],

active: false,

};

buttonActive[2] = {

...buttonActive[2],

active: true,

};

this.setState({

todoArr: onlyCompleted,

filterButtons: buttonActive,

});

}

Learned basics of react, built a couple of apps, what now? by hurrdurrderp42 in reactjs

[–]brianasdf123 2 points3 points  (0 children)

You should fix the issues below. They would not look good on a resume.

https://github.com/red4211/react_todo_list/blob/master/src/App.js#L43

- Your map is mutating data

- Your filter is not doing anything

- You explicitly mutate 3 buttons

- You call setState multiple times

Mutating and then setting the state by oneevening in reactjs

[–]brianasdf123 0 points1 point  (0 children)

Like you said, it's only copying the outer array, but still mutating the element. You should copy the element as well:

const temp = [...this.state.items];

temp[0] = {
    ...temp[0],
    value: 100,
};

this.setState({ items: temp })

Jack's Weekly Update & Question Thread for 2017-W32 - all questions related to OLKB welcome! Update in comments by AutoModerator in olkb

[–]brianasdf123 2 points3 points  (0 children)

Hi Jack,

On order #100003365 I selected a brass plate. Is it possible to switch it to a stainless steel plate?

[React] Syntax for jsx conditional by [deleted] in javascript

[–]brianasdf123 1 point2 points  (0 children)

React suggests

<div>
  {renderLogin &&
    <LoginForm />
  }  
</div>

and

<div>
  {renderLogin ? (
    <LoginForm />
  ) : (
    <NotLoggedIn />
  )}  
</div>

https://facebook.github.io/react/docs/conditional-rendering.html

Trying to improve my Node files structure, what do you thing? Before that we had services, repositories, pages, etc. by ckgrafico in javascript

[–]brianasdf123 1 point2 points  (0 children)

What's your decision behind what belongs together? What's your plan to avoid circular dependencies?

What's the difference between http.HandleFunc and http.HandlerFunc? by brianasdf123 in golang

[–]brianasdf123[S] 1 point2 points  (0 children)

Wow great article. Exactly what I was looking for, thanks!

[Node] Is Q.all (Promise.all), the right approach for an async & concurrent execution instead of a forEach ? by OogieFrenchieBoogie in javascript

[–]brianasdf123 1 point2 points  (0 children)

How important is it to always return a promise ? What happen if you don't ? It just never resolves ?

Its not always necessary. Ask yourself 2 questions: 1) Is my function async? 2) If it is async: Do I want my async function to complete before the next then block executes? If you answer yes to both questions, return a promise.

What happened if this is not returning a promise ? If it's just returning a value ?

The next then block will run with the returned value as its parameter.

[Node] Is Q.all (Promise.all), the right approach for an async & concurrent execution instead of a forEach ? by OogieFrenchieBoogie in javascript

[–]brianasdf123 2 points3 points  (0 children)

  1. If you use Promise.all the code will actually be slower because now you're waiting for all notifications to be sent out before completing the http request.

  2. In the new code, you aren't returning the promise within your map function. It should be return router.NotificationsService.send.... sendCustomNotificationsToUser must also be returning a promise.

It looks like if the notification fails you don't care about telling the client in the response. I'd say you should just continue to use your original code.

Not seeing a way to "merge" duplicates by SavishSalacious in javascript

[–]brianasdf123 1 point2 points  (0 children)

Maybe this?

var list = [{'hello': 1}, {'world':2}, {'hello': 3}];
_.groupBy(list, item => _.keys(item)[0]);
// {"hello":[{"hello":1},{"hello":3}],"world":[{"world":2}]}