Tagged Questions
9
votes
3answers
3k views
Coffeescript beautification and refactoring
As much as I try, I cannot seem to get this Coffeescript code to look beautiful (I'd like to think it is possible). I have tried both Javascript and Coffeescript. Just to be clear, this code works ...
5
votes
1answer
213 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
...
4
votes
1answer
324 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 ...
3
votes
2answers
52 views
Passing Context in CoffeeScript
I'm trying to migrate from JavaScript to CoffeeScript. However I'm not sure about the best way to optimize the code generated by js2coffee.
Below is the original JavaScript source :
var async = ...
3
votes
1answer
113 views
Functional Sundaram's sieve
I wrote this Sundaram's sieve in Coffeescript to quickly generate prime numbers up to limit:
sieve_sundaram = (limit) ->
numbers = (n for n in [3...limit+1] by 2)
half = limit / 2
...
3
votes
2answers
680 views
CoffeeScript date formatting
forceTwoDigits = (val) ->
if val < 10
return "0#{val}"
return val
formatDate = (date) ->
year = date.getFullYear()
month = forceTwoDigits(date.getMonth()+1)
day = ...
2
votes
2answers
141 views
My first real JS project, simple form validation
I would really like to hear how I can improve my form validator.
Next, I want to refactor it into OO and learn a testing framework like Jasmine.
Some things I know I could improve
Don't make it ...
2
votes
2answers
94 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")
...
2
votes
0answers
152 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 ...
1
vote
1answer
42 views
JQuery Dynamic Dropdown Update
This is based (somewhat loosely) on the code written in this railscast. I'm planning to re-use it in different places throughout the site, so I made it a bit more generic rather than based on IDs. ...
1
vote
1answer
182 views
Increasing web load time (coffee script and d3.js) [closed]
I took the Bubble chart visualization from Jim Vallandingham: http://vallandingham.me/vis/gates/ and added a few other features such as: a picture over svg, a click function, option to select only ...
0
votes
1answer
104 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 ...
0
votes
0answers
128 views
Angular JS photo app for personal cloud
I've been working on my first Angular JS app for the past few days.
It's in a very early stage (no real functionality), but that will only make it easier to review what IS there.
The client side is ...