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.
0
votes
0answers
12 views
What is a functional-style replacement for this loop?
nums = [2 5 3 7]
result = []
result.push {x:nums[0]}
for n in nums.slice(1)
result.push {n:n + result[-1].x}
log result
# [{x:2} {x:7} {x:10} {x:17}]
This is hard to express functionally using ...
0
votes
1answer
18 views
Angular js ng-repeat and directives
I have a list of items that can be starred. The buttons to archive, delete and star pop up on hover. However, if the item is starred, the star does not fade out but remains visible.
I have created ...
1
vote
2answers
22 views
Coffeescript: invoking function with space before parens
When I invoke a function with a space before the parens, it gives an error saying unepected ,
sum = (a, b) ->
a+b
console.log (sum (1, 2))
error: unexpected ,
console.log (sum (1, 2))
it ...
1
vote
1answer
26 views
Confused about Backbone model validating on instantiation
I'm trying to check if values passed to my model, on instantiation, are empty. If they are, they shouldn't be stored, and shouldn't be retrieved with model.get('value')
Model instantiation:
# Model
...
0
votes
1answer
26 views
AngularJS: Retrieve newly created Record Id in CoffeeScript
To create a new record added from a form in AngularJS, I have:
task = Task.save($scope.newTask)
But I need to also retrieve the new id that was created upon save. The answer found here: Not getting ...
0
votes
0answers
45 views
Why doesn't my selector work?
When I try to use selector on my page like
$("selector:pseudoselector") or $("selector").filter(":pseudoselector") or also $("selector").siblings("selector"), I get error Uncaught TypeError: Object ...
2
votes
2answers
37 views
Node.js class issue, or Am I doing something wrong?
this code
class Foo
bar: []
test = new Foo()
test.bar.push('b')
test2 = new Foo()
console.log test2.bar
Will produce output ['b']. How it is even possible?
Edit:
This is what CoffeScript ...
1
vote
1answer
24 views
Filters being ignored in jquery-datatables-rails
I have used jquery-datatables-rails to present some information for my index and have added in filters following this. However the datatable appears to be ignoring the filters and they are not shown ...
0
votes
0answers
15 views
jQuery plugins in brunch.io
I'm developing an application using brunch.io and want to use a jquery plugin (in this case the jQuery Waypoints plugin).
What is the recommended way of doing this?
I know it is possible to get the ...
12
votes
2answers
2k views
How can I completely disable CoffeeScript in a Rails 3.1 app?
At the moment when I generate a new controller, Rails also generates a .js.coffee file for the controller as well. As I don't use CoffeeScript I want Rails instead generate .js files for me.
Is it ...
0
votes
1answer
31 views
Backbone context issue with coffeescript
I have a simple calendar that re-renders whenever the date changes. After onClick the date is set triggering the change:date event and the render method is called.
However, the context is off as the ...
0
votes
1answer
78 views
+50
global helper is overriding local context in meteor handlebars template
In my meteor app I have some coffescript making a global helper:
Handlebars.registerHelper "title",->
Session.get("title")
and a piece of template:
{{#each edited}}
<li><a ...
0
votes
0answers
16 views
IcedCoffeeScript Sourcemaps in Node.js
I'm using iced-coffee-script with node.js. I haven't been pre-compiling my .coffee files but instead am just requiring the iced-coffee-script package from my .js application startup file. Does anyone ...
2
votes
1answer
46 views
Coffeescript running a second function before the first has finished executing
My code is as follows. I would expect the code inside configureMission() to finish running before running mapSurface. This does not appear to be happening.
missionCommands = "" # you don't have a ...
0
votes
0answers
36 views
Testing AngularJS controllers with resource services
Background:
I'm writing unit test for angular js controllers, which utilize angular $resources wrapped in services (for maintainability purposes).
Example controller:
name = ...