Coffeescript is an alternative syntax for Javascript. Unlike other languages that compile to Javasscript, it deliberately retains the exact semantics of Javascript. Furthermore, it provides syntax help to enable you to write the correct, verbose, JS code concisely.
1
vote
0answers
35 views
Object Wrapper/Parameter Injection Module for CoffeeScript/JavaScript
I made an object wrapper/parameter injector and I hope it will be useful, I made it for a project I am working on but then decided to try polishing it a bit.
The use case is for wrapping objects such ...
2
votes
2answers
55 views
Is there any way to make this CoffeScript code simpler / smaller
I've just started with coffeescript, and I saw http://blog.8thlight.com/uncle-bob/2012/04/20/Why-Is-Estimating-So-Hard.html which has a little programming problem, so I figured I'd do it in ...
4
votes
3answers
99 views
Can this coffeescripts method be simplified?
I'm new to coffeescripts. Can the getSum method be simplified more? Thanks
MyObject =
checkCondition: (num) ->
return true if num is 5
getSum: (num) ->
total = 0
total += i for ...
2
votes
0answers
76 views
PageObject implementation (CoffeeScript, CasperJS)
I'm using CasperJS and CoffeeScript for integration testing of a hobby project. Page Objects seem to be a useful abstraction. I had two major requirements:
Support for node.js style callbacks - ...
1
vote
0answers
134 views
Learning backbone.js and Coffeescript
I am leaning backbone.js and Coffeescript, and would like someone with a little bit more experience to give my code a quick review, to see if I'm doing anything incorrectly or poorly. Basically ...
0
votes
1answer
79 views
looking to make this code cleaner
I need to count non-transparent pixels in a canvas. My code is below. I am pretty sure there is a nice and elegant syntax for doing this. But I am new to coffeescript. Please help. Note that the data ...
5
votes
1answer
124 views
Project Euler question 2 in CoffeeScript
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
fib = (x) ->
return 0 if x == 0
return 1 if x == 1
...
2
votes
0answers
150 views
Where is the memory leak in this scraper?
This is a scraper written in coffee-script for nodeJS. It is run in an interval (set to 5 seconds here to dramtically show the leak). Somewhere this code leaks memory. I already tried nulling a few ...
2
votes
1answer
86 views
Is there a better way to structure this in CoffeeScript?
I have this recursive function that searches an object tree structure:
dataSearcher = (dataElement, identifierToFind) ->
if dataElement.identifier == identifierToFind
...
0
votes
1answer
82 views
Is there any javascript pitfalls with this approach that I might be missing?
I have a model with a number of complex/simple properties that has a corresponding strongly typed view, that calls EditorFor to a custom editor template view for the model.
One of the form's ...
2
votes
2answers
77 views
Similar but slightly different JavaScript functions
I have two very similar functions that exist mainly for syntactic sugar.
deactivate = (el, seek) -> el.find(seek).removeClass("active")
activate = (el, seek) -> el.find(seek).addClass("active")
...
0
votes
1answer
63 views
Writing binding providers in CoffeeScript?
In his KnockoutJs 1.3 beta post, Steve Sanderson has an example of using Binding providers ("5. Binding providers (and hence external bindings)") where he makes a comment in the JSFiddle JavaScript ...
3
votes
2answers
94 views
Adding push to array inside the class that is being pushed
I used to mostly do this:
class Person
constructor : (@parent, @data)->
@index = @parent.length
class People
constructor : ->
people = []
for data in database.people
...
2
votes
1answer
255 views
A library written in CoffeeScript
So, I wrote this small library for fast DOM building with API tailored for CoffeeScript
I feel like the code overall can be made better/smaller/faster.
I am also not particularly happy about a few ...
3
votes
4answers
328 views
Short coffeescript style question
I'm going through the CoffeeScript book by Trevor Burnham, and I was curious as to what the best style is for a function I was writing.
In the book the author writes the function like so:
...