Skip to main content

Questions tagged [coffeescript]

CoffeeScript is a little language that compiles into JavaScript. Underneath all of those embarrassing braces and semicolons, JavaScript has always had a gorgeous object model at its heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.

Filter by
Sorted by
Tagged with
1 vote
1 answer
662 views

I'm trying to convert a Date object into a weird format, like so: 03/30/2017 11:37:14:082 -0500 The issue that really trips me up is the timezone offset. There's ...
Camden Clark's user avatar
4 votes
1 answer
103 views

I tested this program on Smooth-CoffeeScript I just wanted to have as many eyes on this as I could to learn about coffeescript; Is there anything I should do to improve it? Am I using the tools ...
Shui's user avatar
  • 173
0 votes
1 answer
766 views

I was wondering if there was a better way to write this: ...
Wes's user avatar
  • 133
0 votes
1 answer
58 views

I am currently working on refactoring two methods that exist in directives into a service. This is method one: ...
theGreenCabbage's user avatar
0 votes
1 answer
68 views

Mostly robocop and hound give "line is too long" for such code statements. I just wanted to know which one is better and preferable way. This one is a way to avoid making the message long so just do ...
Junaid Farooq's user avatar
2 votes
0 answers
69 views

I would like some opinions on this Mobile Menu plugin I wrote for work. We develop custom WordPress themes, nothing too advanced or anything. I would like if anyone could just take a look and provide ...
bebaps's user avatar
  • 21
7 votes
1 answer
292 views

The code below is loading an svg into the canvas via RaphaelJS. There are mouseover/mouseout events, on click on an element of the svg, and drag/zoom. I would like to know, what are some good ...
Radu Dascălu's user avatar
3 votes
0 answers
93 views

Question: You're in a hotel and you forgot what room number you were in but remember that the sum of it's divisors is greater than the number, yet there is no subset of those divisors that add up to ...
user avatar
3 votes
0 answers
56 views

I have created a class to keep track of some internal states. You can see it as a very simple implementation of a state machine ...
Anthony Kong's user avatar
2 votes
0 answers
59 views

I have such objects that I need to merge: ...
eawer's user avatar
  • 207
3 votes
1 answer
1k views

I am working on a simple Rails app. For the Expense resource I use a DataTable. So, in my CoffeeScript for this resource I basically do several things: initialize ...
Alexander Popov's user avatar
1 vote
1 answer
127 views

I'm working through Coffeescript implementing simple algorithms (started with Prim's as reviewed in this previous post) and wrote out Kruskal's algorithm as below, with a few helper functions. I'd ...
sunny's user avatar
  • 1,865
1 vote
1 answer
184 views

I'm starting just now with CoffeeScript and I found out that I can't solve problems like looping and recursives with just one line. I would like to improve the code that I just wrote using built-in ...
Amanda Ferrari's user avatar
2 votes
3 answers
168 views

I'm just starting to learn CoffeeScript and am trying to work through simple examples, this one being Prim's algorithm. I'd like feedback on everything but especially on making this script take ...
sunny's user avatar
  • 1,865
3 votes
0 answers
61 views

I'm trying to improve my Angular directive. I'm pretty new to CoffeeScript, so I think there may be inconsistent code. ...
user98293989823's user avatar
3 votes
0 answers
59 views

Most of my programming experience is in PHP, and I have always been a bit wary of JavaScript. I have a JavaScript class to manage executing, caching and displaying search results. ...
James Fenwick's user avatar
3 votes
0 answers
98 views

I created a widget to handle multiple selections in CoffeeScript. There's a working attached snippet that uses the compiled JavaScript (Stack Snippets don't support CoffeeScript), which is available ...
Mohamad's user avatar
  • 2,044
4 votes
1 answer
93 views

I have such input: [ { name: 'timezone', value: 'EST' }, { name: 'interval', value: 'day' }, { name: 'metrics[]', value: 1}, { name: 'metrics[]', value: 2} ] ...
eawer's user avatar
  • 207
3 votes
0 answers
686 views

After reading this, I'm on board, however it doesn't get into passing methods from the parent class. In my mixins right now I have a lot of helper functions that are used across the various components ...
Ben's user avatar
  • 131
1 vote
1 answer
58 views

I need to produce a list objCollector with some results: ...
Jesus_Maria's user avatar
2 votes
0 answers
85 views

I wrote this code that's supposed to correct quizzes on a webpage, but it feels bloated and I'm sure there's tons of ways to improve it. Any thoughts? ...
Kevin Ferm's user avatar
4 votes
2 answers
770 views

I do HTML5 Video player with some controls. I have a button, where I change classname for make play, pause or replay button. I have a mute/unmute button, volume range slider, timer and fullscreen mode ...
rel1x's user avatar
  • 301
2 votes
0 answers
897 views

I needed a simple way to add this test to certain click events: if isUser then fireClickEvent else openSignInModal So I made this directive: ...
goldylucks's user avatar
2 votes
0 answers
391 views

I'm learning Angular and I don't like my current approach. The current controller uses first Geolocation service and when ...
luzny's user avatar
  • 131
2 votes
1 answer
160 views

In my application I need some resources to be loaded and I have services to load each of them and then I need some point to know that all requests finished. First thought was to use $q.all with array ...
SET's user avatar
  • 121
4 votes
1 answer
10k views

After years of fear and procrastination I decided to learn regular expressions. This is the result: CoffeScript: ...
wyc's user avatar
  • 555
5 votes
2 answers
594 views

I've been playing around with Jekyll and CoffeeScript the last few days and made a Periodic Table to learn those two. Now, to create the Periodic Table, I take an array of ...
MisterBla's user avatar
  • 151
1 vote
1 answer
1k views

I have states that have a requiredlogin object set as true, then I have Angular listen on ...
grasshopper's user avatar
4 votes
1 answer
188 views

There is the implementation of flood game on my GitHub. The app.coffee is the main part of project: ...
kharandziuk's user avatar
1 vote
1 answer
136 views

Source code with some test: ...
kharandziuk's user avatar
4 votes
2 answers
665 views

table_with_headers = $(this.dom.table).find("thead tr th").map(-> $(this).text() ).get().join("\t") Can one write it nicer? I especially don't like the inner ...
andilabs's user avatar
  • 143
6 votes
1 answer
210 views

Could you please offer some suggestions about my self learning project? It is really hard-coded, but I have no idea what to do next. I'm using angular (only few ...
outoftime's user avatar
  • 1,769
2 votes
0 answers
393 views

I have this working code, but would like your review: sync.coffe ...
khinester's user avatar
  • 277
1 vote
1 answer
109 views

Does this function automationStatusIsSuccessful = (data) -> data.Automation.Status isnt "FAILED" and data.Automation.Status isnt "COMPLETEDWITHERROR"` make ...
dman's user avatar
  • 129
0 votes
1 answer
122 views

The code below is converting: data from one format to another ...
kharandziuk's user avatar
1 vote
1 answer
1k views

I have a Rails app where I'm trying to select a list of facilities based on what region is selected in a form. So far, I've implemented group_collection_select to do this as well as a bit of ...
nulltek's user avatar
  • 139
2 votes
1 answer
723 views

In my code I have to login a user with username and password. But if the user sends his e-mail instead of his username, I have to resolve it with another request. This is what the code looks like: <...
Michael12041's user avatar
1 vote
1 answer
710 views

What's the best way to approach generating a password using a secure prng? In Python, I could simply use os.urandom. Any suggestions on this? ...
user avatar
5 votes
2 answers
124 views

I've just been putting together an audio meter by stacking bootstrap progress bars, and thought there was probably a better way, mathematically / logically, of achieving this. ...
gratz's user avatar
  • 153
5 votes
1 answer
99 views

I tried to look up and suck in most of the information about optimizing this operation and this is what I came up with. As it's pretty much core of the game, I really would like to have it performant ...
FredyC's user avatar
  • 217
1 vote
1 answer
116 views

How can I rewrite this in a simpler way? ...
r23712's user avatar
  • 11
3 votes
1 answer
128 views

I've authored a couple of plugins which show popovers on a given element. One of the objectives for both was no specification of plugin direction. So instead of the implementing dev having to specify <...
andrew.carpenter's user avatar
3 votes
0 answers
212 views

I'm new to ReactJs and trying to figure out the preferred style. I also have tried it enough to realize that I'm not a fan of jsx and prefer how React looks when written in coffeescript. This is a ...
George Mauer's user avatar
  • 1,632
3 votes
1 answer
95 views

Very similar to this question, I'm curious about common patterns/best practices for handling events in coffeescript classes, particularly when you also need to call the event handlers immediately to ...
Jared's user avatar
  • 176
4 votes
1 answer
282 views

I'm currently building a text editor using contenteditable and RoR back end. As the editor is WYSIWYG and trying to follow DRY, I used only one file to 3 actions: Show, Edit and New. Edit and new ...
Alexandre Wiechers Vaz's user avatar
4 votes
1 answer
329 views

For a game, there is some WebGLRenderer object that wraps around canvas element. There is need to update it's size when browser window size changes. Here goes my current code written using BaconJS. ...
FredyC's user avatar
  • 217
4 votes
2 answers
121 views

I wrote a simple class that substitutes all file inputs in an HTML for a more complex template and set some actions on it. The code is rather small, but I'm not used to write JavaScript. I wonder if ...
fotanus's user avatar
  • 227
1 vote
1 answer
95 views

Please critique this CoffeeScript code. Is it idiomatic? ...
Kevin Meredith's user avatar
2 votes
1 answer
125 views

I defined a function that multiplies its argument by 3: coffee> foo = (x) -> x * 3 [Function] We can call it with an input of 1: ...
Kevin Meredith's user avatar
10 votes
1 answer
273 views

I've wrote this CoffeScript function to compare values in a table, but it turned out to be a HUGE function. Since the code is really really long, you can find it here as well. Code explanation: The ...
Razvan B.'s user avatar
  • 203