8 votes
Accepted

Operating on a list of files using recursion

Fake for-loops and comprehensions At the beginning of your post, you say that you can't always achieve everything with looping in one line in CoffeeScript. When you say that, I assume you are taking ...
  • 13.2k
6 votes
Accepted

Get <TH> texts into a tab separated string

CoffeeScript is not my forte, however I quite like this approach: ...
  • 32.8k
6 votes

Get <TH> texts into a tab separated string

You can use explicit find like so $ 'thead tr th', @dom.table and put some indentations instead of braces ...
  • 1,729
6 votes
Accepted

Ruby on Rails text editor

There's two things I usually consider in this kind of situation: Use custom helpers and partials The idea here is to break down your view in small components, and have one helper to build each ...
  • 956
4 votes

Mathematical boundaries (audio meter)

vumeter % 50 < vumeter doesn't make much sense to me. For non-negative numbers, this is equivalent to vumeter > 50, so you ...
  • 3,605
3 votes

Determining if a target string is found in an array of strings

The in in CoffeScript is essentially the same as Ruby's include?. You may write following Ruby version ...
  • 173
3 votes

Prim's algorithm in CoffeeScript

To add on the previous answers, this loop: for k, v of obj if v < min_v min_v = v min_k = k can be reduced to one line ...
  • 201
3 votes
Accepted

Prim's algorithm in CoffeeScript

This already seems pretty good considering you just started learning coffeescript. for k, v of obj if v < min_v min_v = v min_k = k ...
  • 248
3 votes
Accepted

Merge values of the objects properties with the same name into array

Your code looks ok overall. There are perhaps a few CoffeeScript features you can make use of, but nothing major. However, I don't like that the input array is modified in-place (i.e. the function ...
  • 32.9k
3 votes
Accepted

Regex for curly quotes and apostrophes

Since you know that the double quotes will always be matched, you might try this instead of your first two replaces: r.replace(/"([^"]*)"/g, "“$1”") I think that'...
  • 226
3 votes

Function with underscore overuse

Interesting question, I am not sure there is such a thing as over-use of underscore, and what the drawback would be. I think that code looks okay from that perspective. However, from a once over: <...
  • 32.8k
3 votes
Accepted

Flood game implementation

Overall, it's not bad. I only have some minor observations on the code itself: You're setting, and re-setting @top in both the constructor and ...
  • 32.9k
3 votes
Accepted

Mathematical boundaries (audio meter)

Assuming that you want to replicate a classical audio meter (aka green bar grows until 50, then a yellow bar appears on top of green and grows until 85, then a red bar grows from there), then the ...
  • 5,150
3 votes
Accepted

Tick module for the game

Do you really need a comment above every line? There are a few good comments like ...
2 votes

Promises and chained calls

Bluebird has the concept of Promisification that converts any library into a Promise. Maybe it did not exist at the time the chosen answer was written, but I wanted to add this so people coming into ...
2 votes
Accepted

NodeJS conditional request before the real request

Promises would make sense to me, but first step would be to extract stuff into functions. You don't really need promises for this, though. Here's one way to just do it with plain callbacks: ...
  • 32.9k
2 votes
Accepted

English-Russian irregular words tester

First of all, I would architecture the data in a more readable and flexible way: ...
2 votes

Periodic Table generator

IMHO, you're making your work slightly harder for yourself with your encodings for ranges and spacers. How about using {s: 10} for a spacer, and ...
  • 441
2 votes

Periodic Table generator

CoffeeScript or otherwise, it does seem like you're working a bit too hard here. Since the information you use is split between the list in the HTML and the array in the script, there's some coupling ...
  • 32.9k
2 votes
Accepted

AngularJS Login Check

I think I would make a state object and a user object to represent this delema. We will make a user class to encapsulate working with the user api ...
2 votes

Prim's algorithm in CoffeeScript

@Brad M already pointed out most of the stuff I'd have pointed out too. These are just some additional things CoffeeScript is still JavaScript, so it's typically written in ...
  • 32.9k
2 votes
Accepted

Displaying job status in a jQuery Datatable

First of all, you may benefit from the fact that in Coffee (and in JS, too), the following code if condition variable = value can be expressed simpler as <...
  • 196
1 vote
Accepted

Configuring a DataTable using CoffeeScript

I can't tell you when something like Angular/React will make more sense. It's a cost/benefit question, but they're your costs and your benefits. I'd say you code is okay. In some places it seems ...
  • 32.9k
1 vote
Accepted

Kruskal's algorithm

Disclaimer: I don't know coffeescript, but I do know a little javascript Most of the code is understandable, even for me not knowing coffeescript, but it is obfuscated by bad naming and laziness. So ...
  • 11.5k
1 vote
Accepted

Extracting a list of hyperlinks

I just moved things around to make it a bit more readable. You can use the map function instead of each. The signature of map is ...
  • 2,264
1 vote

Wait for all resources to be loaded

Actually I'm surprised there isn't a $q.some or so to do exactly that. I think this is a good solution for the problem, though putting it in a separate function ...
  • 11k
1 vote

CSV lookup problem solved with CoffeeScript

Your lookupIndex may not work as intended unless the value you're using for the lookup is unique across all rows. You'll always find the last row in the CSV data, ...
  • 32.9k
1 vote

Refactor Coffee Script to fire on page load instead of change

This is borderline Code Review material, since the code doesn't work as intended. It's not the same thing as "broken", because it does run, but what you're asking for is more or less a new feature. (...
  • 32.9k
1 vote
Accepted

Conditional AND statement- which is more readable?

I don't know coffeescript, but in general, extracting complex conditions to a helper function is a common refactoring technique. When you do that, you effectively give a name to the previously ...
  • 110k

Only top scored, non community-wiki answers of a minimum length are eligible