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.
93 questions
1vote
1answer
632views
Converting Date object in CoffeeScript to string (with a weird format)
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 ...
4votes
1answer
76views
CoffeeScript 2 + 2 program
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 ...
0votes
1answer
734views
Displaying job status in a jQuery Datatable
I was wondering if there was a better way to write this: ...
0votes
1answer
48views
Abstracting out two lines of code in Coffeescript
I am currently working on refactoring two methods that exist in directives into a service. This is method one: ...
0votes
1answer
44views
Multiple string interpolation
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 ...
2votes
0answers
67views
jQuery Mobile Menu plugin
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 ...
7votes
1answer
276views
Loading an SVG into the canvas
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 ...
3votes
0answers
83views
Hotel Room Problem in CoffeeScript
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 ...
3votes
0answers
42views
Backbone.model based state machine
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 ...
2votes
0answers
53views
Recursively merge objects with corresponding property names
I have such objects that I need to merge: ...
3votes
1answer
1kviews
Configuring a DataTable using CoffeeScript
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 ...
1vote
1answer
108views
Kruskal's algorithm
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 ...
1vote
1answer
167views
Operating on a list of files using recursion
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 ...
2votes
3answers
120views
Prim's algorithm in CoffeeScript
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 ...
3votes
0answers
52views
Using Angular directives for connect HTML clicks in buttons and controller actions
I'm trying to improve my Angular directive. I'm pretty new to CoffeeScript, so I think there may be inconsistent code. ...