All Questions
Tagged with coffeescript javascript
19 questions
0
votes
1
answer
42
views
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:
...
7
votes
1
answer
266
views
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 ...
3
votes
0
answers
52
views
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.
...
3
votes
0
answers
53
views
Search Class with Static Methods
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.
...
4
votes
1
answer
10k
views
Regex for curly quotes and apostrophes
After years of fear and procrastination I decided to learn regular expressions. This is the result:
CoffeScript:
...
2
votes
0
answers
383
views
RESTful API parsing DBF data HSET in Redis
I have this working code, but would like your review:
sync.coffe
...
10
votes
1
answer
302
views
Tabbed navigation to hide and show pages
I'm new to jQuery and trying to learn how to refactor my bloated code to make it nicer and better maintainable.
I have a tabbed navigation which I'm using jQuery to hide and show pages depending on ...
2
votes
1
answer
123
views
Backbone subviews with non-uniform layout
I have a “featured projects” view that requires its subviews conform to a non-uniform grid: one narrow column with 3 items, then one wide column with 2 items, followed by another narrow column with 3 ...
3
votes
1
answer
155
views
Paginating a Backbone collection
This is part of a class for paginating a Backbone collection.
The paginateTo method is for paginating to a model id. It returns ...
5
votes
2
answers
780
views
isRTL.coffee library to determine if a text is of right-to-left direction
I just wrote this tiny library called isRTL.coffee to determine the direction of the text. Is there any better way of doing this?
...
3
votes
2
answers
749
views
Fibonacci using cache
This is my simple Fibonacci implementation in CoffeeScript. What do you think? Using cache (fibResults), it's very very fast.
...
3
votes
2
answers
1k
views
Getting the outliers of both dates and values
This is working now, but it looks very inelegant. I'm sure there is a nicer way of doing this.
...
3
votes
2
answers
811
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 :
...
3
votes
1
answer
375
views
Functional Sundaram's sieve
I wrote this Sundaram's sieve in Coffeescript to quickly generate prime numbers up to limit:
...
4
votes
2
answers
11k
views
3
votes
1
answer
328
views
Object wrapper/parameter injection module
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 ...
4
votes
1
answer
514
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.
...
1
vote
2
answers
176
views
Similar but slightly different JavaScript functions
I have two very similar functions that exist mainly for syntactic sugar.
...
12
votes
3
answers
4k
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 ...