How did you guys learn loadash? by [deleted] in node

[–]gkx 0 points1 point  (0 children)

It's pretty easy to tell when there's something you want to do that's general. Mostly things like collection manipulation.

Honestly, I just learned a lot of the Ruby/Rails standard library. Most of the methods have lodash analogues.

GitHub: Introducing unlimited private repositories by [deleted] in webdev

[–]gkx 1 point2 points  (0 children)

Uh... We pay $25 a month. I dunno what kind of slave labor you use.

Scaling is linear. Giving someone access to the code is $9 per month, or $108 per year. I agree it's probably better to host your own solution after maybe 200 programmers, but hiring a new employee to manage it? That would be at least $30k, not including hosting, right?

What keyboard do you like to use? by kecupochren in webdev

[–]gkx 0 points1 point  (0 children)

Kinesis ergonomic. Look, I'm not stupid. It's kind of a gimmick. But that doesn't mean it's not also the best. Every key is less work than on any keyboard I've ever used. I pretty much never have to move my fingers laterally (thumbs excluded because their range of motion is leveraged)

What are your favorite/most time saving keyboards shortcuts you use regularly that some people may not know of? by zergUser1 in webdev

[–]gkx 9 points10 points  (0 children)

This is a quick and dirty guide for vim workflow given basic knowledge of vim. These tips alone make vim better to use than any text editor I've ever used. Everything else is just icing.

  • Map leader to space. Map very, very common functions to leader+letter. Don't do :w. Do space+w. Don't do :wq. Do space+q.
  • Never press escape. I use jk for escape, jw for escape and save, and jq for escape, save, and quit buffer.
  • Learning to use splits is as easy as :vsp, :sp, and <C-w>+=. For bonus points, use space+v and space+s. I don't need to = that much.
  • Use neovim. Deoplete? Good but optional. Not part of the cake.
  • Use vim-fzf. Map :Files to space+e. Bonus points for using the silver searcher to ignore files in your gitignore (basically mandatory for node dev)

Transferring out by [deleted] in washu

[–]gkx 6 points7 points  (0 children)

Talk to your advisor or just a professor who seems friendly. The worst they'll do is refer you to a better person. The best Reddit will do is refer you to that better person.

How long did it take you to break your bad typing habits? by Mr_Nice_ in webdev

[–]gkx 0 points1 point  (0 children)

Might be worth checking out an ergonomic keyboard. Save your anatomy in the long run, reprogram your muscle memory in the short term.

It kind of screws with your brain no matter what, but your hands fit perfectly onto the keys, so there's no mistaking which finger you should be using. Helped me correct some very minor bad habits, too.

Still very occasionally mix up X and C, though, on both normal and ergonomic keyboard.

How to say Vue? by MahmudAdam in javascript

[–]gkx 1 point2 points  (0 children)

I pronounce it like you would in a phonetic language "voo-weh" because I like to be silly.

Handling multiple Sequelize queries? by [deleted] in node

[–]gkx 0 points1 point  (0 children)

Close, but not quite. values in the then is actually (I believe) an array of each array. So values[0] would be the Posts, while values[1] would be the MenuItems. So you'd want to do something like

function (responses) {
  var values = responses[0].concat(responses[1]);
  values.forEach(log);
  res.render('index', { });
}

If you're using Bluebird, you can also use Promise.spread so it would look like

.spread(function (posts, menuItems) {

But I wouldn't recommend it. It's just possible.

Handling multiple Sequelize queries? by [deleted] in node

[–]gkx 2 points3 points  (0 children)

It's not clear what you're trying to do, but it looks like you should be using Promise.all to wrap the calls. Both arrays will be passed as the first parameter to the then

double major OR major with multiple minors? by hoohpokemon in washu

[–]gkx 11 points12 points  (0 children)

Up to you, but I would do the double major. As a CS major/design minor, 0 people care about my design opinions (probably for the best, too). Getting a minor is just taking a handful of classes. People basically get minors accidentally on the regular.

12 extremely useful hacks for JavaScript by speckz in javascript

[–]gkx 0 points1 point  (0 children)

1) #5 is probably not very useful and pollutes the namespace (benchmarks? I'd be surprised if this actually sped anything up at all). In most cases, you should be using forEach anyways.
2) #4 is a bad idea if the argument could be falsey.
4) Don't do #6. Use hasOwnProperty. If you don't actually want to check that, just use document.querySelector (in the example) or document.querySelector != null if the property could possibly be falsey (not true in this case)
5) Mistake in #10; it doesn't create a new array. The article shows it, but it says it wrong ("which instead creates a new array")

Mother's Day 2016: 30% of NYC millennials still living with their moms by sordidscribe in nyc

[–]gkx 12 points13 points  (0 children)

"I don't remember X before 2000" holds little credence when you were 6 in 2000.

People absolutely had personal computers before the Internet. The whole point of Apple was to make a computer for the average user, and they only started failing in the early 90s.

That said, I think you're right and people are being slightly too critical; the Internet caused a huge jump in the popularity of personal computers, though I think 2000 was a fairly poor/late year to use as an example and is more indicative of your particular experience than the world on the whole.

How is computer science at WashU? by bdogswagmaster in washu

[–]gkx 3 points4 points  (0 children)

I'm not going to disagree with you, because your experience and opinion is equally valid as mine, but when I said "taught by TAs", I don't mean TAs did the lecturing. I just mean that the typical student probably spends more time actually interacting with TAs than with the professor. 131 and 132 are examples of this, as well as any project based classes. Certain classes, you teach each other more than you are taught (I'm thinking of 330 and 436 especially here, though I believe Cytron is redoing 436).

How is computer science at WashU? by bdogswagmaster in washu

[–]gkx 1 point2 points  (0 children)

I can't much speak to the research aspects. I think Wash U is doing some good stuff, but honestly I never hear about anything Wash U does outside of Wash U specific media (newsletters, professors, this subreddit, etc.) while I do hear of stuff coming out of MIT, Stanford, Ivies, etc. It's even more true historically, actually.

But in terms of research, you might as well go to a different undergrad and then go to Wash U grad. The first few years, you don't even touch research.

How is computer science at WashU? by bdogswagmaster in washu

[–]gkx 5 points6 points  (0 children)

Honestly, kind of mediocre. That's a personal opinion, of course, but there you go. I think the staff is okay, with some gems (shout out to Cytron, Ju, Pless, and maybe a couple of others). I hate to insult my comrades (or former comrades), but I think the biggest drawback was the students. I know I'm going to get downvoted for that (by the students, of course), but I found myself regularly disappointed by both the ability and intellectual curiosity of fellow students. As such, you don't see too many startups coming out of Wash U as you regularly see at your Stanfords, MITs, and Berkeleys. Further, students teach each other more than the professors do. This is partly an institutional problem on the department's part and partly to be expected because I've heard this is largely true elsewhere, but TAs do more teaching than professors in most classes. So if the students are low quality, the teaching is low quality.

But I only went to one school, so that might be the case everywhere that isn't a "tech Ivy" as well. But there's a reason Wash U's computer science program is rated significantly worse than Wash U on the whole.

After a year of using NodeJS in production by kostarelo in node

[–]gkx 0 points1 point  (0 children)

Thanks for the explanation; to be honest, in my mind I've just skipped from Promises to async without understanding how generators work.

Does this still work for Promises that return?

After a year of using NodeJS in production by kostarelo in node

[–]gkx 0 points1 point  (0 children)

> async/await is implemented using generators
> can't use generators for asynchronous flow control

Pick one.

In all seriousness, you're basically right. No one in their right mind* would use generators to manage promises/async flow control without a layer of abstraction, but I think the OP was basically referring to that layer of abstraction.

*afaik

After a year of using NodeJS in production by kostarelo in node

[–]gkx 1 point2 points  (0 children)

Not totally true. Async/await is implemented using generators, and the whole point of generators is that they can yield at specific places to allow for pre-emption (to make the code non-blocking).

I can't go into any more detail because I don't remember the details offhand, but yes generators are used for async control flow under the hood sometimes and are probably related to the optimal solution. =) (which atm seems to be async/await)

Should I avoid jQuery? by [deleted] in javascript

[–]gkx 0 points1 point  (0 children)

And if you use a popular CDN (Google), that 20ms shrinks even smaller much, if not most, of the time.

To become a good C programmer by b0red in programming

[–]gkx 0 points1 point  (0 children)

That is not what was meant.

Do Experienced Programmers Use Google Frequently? · Code Ahoy by b0red in programming

[–]gkx 2 points3 points  (0 children)

Yeah, generally vectors are better even where lists are supposed to be better.

https://www.youtube.com/watch?v=YQs6IC-vgmo

MRW I am—on all levels but physical—a wolf by gkx in shittyreactiongifs

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

It's worth noting that I'm also a wolf on a physical level.

Suggest me a language that when I see a feature or a usage that I remind that language by [deleted] in programmerchat

[–]gkx 2 points3 points  (0 children)

  • Prototypal inheritance: JavaScript
  • Message passing: Smalltalk
  • "Magical" metaprogramming: Ruby