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.

learn more… | top users | synonyms

0
votes
1answer
37 views

Displaying job status in a jQuery Datatable

I was wondering if there was a better way to write this: ...
0
votes
1answer
30 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: ...
0
votes
0answers
13 views

Refactoring two similar methods into a single Angular service

I am trying to create a service for two similar-but-still different methods: Method one is this: ...
0
votes
1answer
38 views

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 ...
1
vote
0answers
26 views

Coffee for tooltip with images [closed]

i have an coffee script for creating tooltip and it look like so unacceptable. How can I refactor it? ...
3
votes
0answers
24 views

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 ...
5
votes
0answers
41 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
0answers
25 views

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 ...
1
vote
0answers
23 views

Simple Node.js localization package

I wanted a simple localization module to manage multi-language strings in my new personal Node.js project. As I'm working on this project primarily to learn and play around and the packages I found ...
0
votes
0answers
27 views

Idle game code optimization

I am currently making an idle game, and I currently have a few issues about optimization that I want to fix (which I will list at the end). But first, the code: main.coffee ...
3
votes
0answers
21 views

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 ...
2
votes
0answers
38 views

Recursively merge objects with corresponding property names

I have such objects that I need to merge: ...
3
votes
1answer
267 views

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 ...
1
vote
0answers
23 views

Better way to template in simple coffee script

I am looking to see if there is a better way to refactor the creatMessage such that the logic of identifying message elements is outside the actual message ...
1
vote
1answer
55 views

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 ...
0
votes
1answer
152 views

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 ...
2
votes
3answers
72 views

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 ...
3
votes
0answers
41 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. ...
1
vote
0answers
185 views

Optimizing redis cache

I am new to Express so I'd like to clear my code. This is Express with Redis support. I am getting someId and then I am searching it on Redis or using scraper which ...
3
votes
0answers
41 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. ...
3
votes
0answers
55 views

Multiple select widget in CoffeeScript

I created a widget to handle multiple selections in CoffeeScript. There's a working attached snippet that uses the compiled JavaScript (Stack Snippets don't support CoffeeScript), which is available ...
4
votes
1answer
57 views

Merge values of the objects properties with the same name into array

I have such input: [ { name: 'timezone', value: 'EST' }, { name: 'interval', value: 'day' }, { name: 'metrics[]', value: 1}, { name: 'metrics[]', value: 2} ] ...
3
votes
0answers
584 views

Passing functions using higher order components in React

After reading this, I'm on board, however it doesn't get into passing methods from the parent class. In my mixins right now I have a lot of helper functions that are used across the various components ...
1
vote
1answer
32 views

Extracting a list of hyperlinks [closed]

I need to produce a list objCollector with some results: ...
2
votes
0answers
53 views

Correcting a quiz

I wrote this code that's supposed to correct quizzes on a webpage, but it feels bloated and I'm sure there's tons of ways to improve it. Any thoughts? ...
4
votes
2answers
510 views

HTML5 Video player

I do HTML5 Video player with some controls. I have a button, where I change classname for make play, pause or replay button. I have a mute/unmute button, volume range slider, timer and fullscreen mode ...
1
vote
0answers
26 views

Extend a rethinkdb query, with `if`s

I have something roughly like this: ...
2
votes
0answers
518 views

Click interceptor directive

I needed a simple way to add this test to certain click events: if isUser then fireClickEvent else openSignInModal So I made this directive: ...
2
votes
0answers
333 views

Resource that use two different services and query with pagination when resolved

I'm learning Angular and I don't like my current approach. The current controller uses first Geolocation service and when ...
2
votes
1answer
112 views

Wait for all resources to be loaded

In my application I need some resources to be loaded and I have services to load each of them and then I need some point to know that all requests finished. First thought was to use $q.all with array ...
4
votes
1answer
2k views

Regex for curly quotes and apostrophes

After years of fear and procrastination I decided to learn regular expressions. This is the result: CoffeScript: ...
5
votes
2answers
246 views

Periodic Table generator

I've been playing around with Jekyll and CoffeeScript the last few days and made a Periodic Table to learn those two. Now, to create the Periodic Table, I take an array of ...
1
vote
1answer
647 views

AngularJS Login Check

I have states that have a requiredlogin object set as true, then I have Angular listen on ...
4
votes
1answer
127 views

Flood game implementation

There is the implementation of flood game on my GitHub. The app.coffee is the main part of project: ...
1
vote
1answer
86 views

CSV lookup problem solved with CoffeeScript

Source code with some test: ...
4
votes
2answers
493 views

Get <TH> texts into a tab separated string

table_with_headers = $(this.dom.table).find("thead tr th").map(-> $(this).text() ).get().join("\t") Can one write it nicer? I especially don't like the inner ...
6
votes
1answer
168 views

English-Russian irregular words tester

Could you please offer some suggestions about my self learning project? It is really hard-coded, but I have no idea what to do next. I'm using angular (only few ...
2
votes
0answers
252 views

RESTful API parsing DBF data HSET in Redis

I have this working code, but would like your review: sync.coffe ...
1
vote
1answer
73 views

Conditional AND statement- which is more readable? [closed]

Does this function automationStatusIsSuccessful = (data) -> data.Automation.Status isnt "FAILED" and data.Automation.Status isnt "COMPLETEDWITHERROR"` ...
0
votes
1answer
66 views

Function with underscore overuse

The code below is converting: data from one format to another ...
1
vote
1answer
593 views

Refactor Coffee Script to fire on page load instead of change

I have a Rails app where I'm trying to select a list of facilities based on what region is selected in a form. So far, I've implemented group_collection_select to do this as well as a bit of ...
2
votes
1answer
258 views

NodeJS conditional request before the real request

In my code I have to login a user with username and password. But if the user sends his e-mail instead of his username, I have to resolve it with another request. This is what the code looks like: <...
1
vote
1answer
385 views

Generating Passwords with a Secure PRNG

What's the best way to approach generating a password using a secure prng? In Python, I could simply use os.urandom. Any suggestions on this? ...
5
votes
2answers
65 views

Mathematical boundaries (audio meter)

I've just been putting together an audio meter by stacking bootstrap progress bars, and thought there was probably a better way, mathematically / logically, of achieving this. ...
5
votes
1answer
57 views

Tick module for the game

I tried to look up and suck in most of the information about optimizing this operation and this is what I came up with. As it's pretty much core of the game, I really would like to have it performant ...
1
vote
1answer
84 views

Navigating around ul li and looking for the active state on the current slide

How can I rewrite this in a simpler way? ...
3
votes
1answer
99 views

Automatically gravitate popover towards page center

I've authored a couple of plugins which show popovers on a given element. One of the objectives for both was no specification of plugin direction. So instead of the implementing dev having to specify <...
3
votes
0answers
168 views

Create component with select+button

I'm new to ReactJs and trying to figure out the preferred style. I also have tried it enough to realize that I'm not a fan of jsx and prefer how React looks when written in coffeescript. This is a ...
3
votes
1answer
58 views

Set up event on class and initialize state [closed]

Very similar to this question, I'm curious about common patterns/best practices for handling events in coffeescript classes, particularly when you also need to call the event handlers immediately to ...
4
votes
1answer
219 views

Ruby on Rails text editor

I'm currently building a text editor using contenteditable and RoR back end. As the editor is WYSIWYG and trying to follow DRY, I used only one file to 3 actions: Show, Edit and New. Edit and new ...