Remove Duplicates from Array in CoffeeScript

Problem You have an array in CoffeeScript, which contains equal elements multiple times such as: [1,1,2,3,3] You would like to have only unique values in the array. Thus, transform it into: [1,2,3] Solution You can use the following method to accomplish such: References This solution is based on this approach (with a few minor issues … Continue reading Remove Duplicates from Array in CoffeeScript

CoffeeScript Fat Arrow (=>) explained

Anyone who has worked with JavaScript for anything but a very short time will have come across the problem that the meaning of 'this' is often ambiguous at best. CoffeeScript attempts to mitigate this problem somewhat by introducing the Fat Arrow operator (=>). This operator can be used as a replacement for the thin arrow … Continue reading CoffeeScript Fat Arrow (=>) explained

Render HTML from Object with CoffeeKup

CoffeeKup allows to render HTML from multiple sources: A String containing valid CoffeeScript code A JavaScript/CoffeeScript object arranged according to CoffeeKup rules To render HTML from a String is quite straightforward and documented on the CoffeeeScript reference: you can use the methods .compile and .render as documented there. However, to render HTML from a JavaScript/CoffeeScript … Continue reading Render HTML from Object with CoffeeKup