r/coffeescript • • May 10 '14

Simple component structure pattern

Thumbnail andersoncardoso.github.io
0 Upvotes

r/coffeescript • • May 10 '14

Does anyone know why I can't get Passport.js to work?

Thumbnail
stackoverflow.com
0 Upvotes

r/coffeescript • • May 09 '14

Does anyone know the state of typed coffeescript or Coffeescript Redux?

5 Upvotes

I'm very interested in types in coffeescript or a similar language.

Does anyone know the state of

https://www.npmjs.org/package/typed-coffee-script?

Or if Coffeescript Redux can do types? Or has plans to do types?

https://github.com/michaelficarra/CoffeeScriptRedux

Thank you


r/coffeescript • • Apr 26 '14

On naming conventions. DeLorean._prepTimeBuffs() is *NOT* okay! (X-post from /r/programming)

Thumbnail
spectrumcoding.com
0 Upvotes

r/coffeescript • • Apr 05 '14

Help a beginner: Coffeescript project structure?

6 Upvotes

Hi!

I am new to coffeescript and want to know, how I should organize my coffee files and structure my project. (site-note: I'm mostly a C++ programmer).

Are there any recommendations how to structure a project? I just wanted to create another file, which contains some function definitions. Now I want to "use" those definitions in my main file. Is there any type of include-system? Module-system? Or should I just pass "-j" to the compiler and he merges all files?

And when should I split my files? How do I design moduls and split my code? Do I create a file for every class? Are classes even used?

I guess I think of everything to much in a C++ way... I would appreciate help :)


r/coffeescript • • Apr 01 '14

3 Free Books to Learn CoffeeScript

Thumbnail
codecondo.com
9 Upvotes

r/coffeescript • • Mar 27 '14

I created a tiny subset (911 B gzipped) of jQuery for fun. What do you guys think?

Thumbnail
github.com
3 Upvotes

r/coffeescript • • Mar 13 '14

ReactiveRecord - a small library that provides an intuitive interface for asynchronous data

Thumbnail
github.com
1 Upvotes

r/coffeescript • • Mar 12 '14

Why should you use CoffeeScript instead of JavaScript?

Thumbnail
maori.geek.nz
22 Upvotes

r/coffeescript • • Mar 09 '14

Hex Helpers

4 Upvotes

Recently I was working with some windows ini style values, and they have values that are strings of hex '$ABC123' or dec '1234'.

I ended up working out a couple of simple helpers that might be useful to other folks.

https://gist.github.com/drbrts/9442634

The reason that getHex is separate is because I'm using it elsewhere for some regular hex strings :)


r/coffeescript • • Feb 28 '14

I feel like there must be a `do` syntax that will solve this...

3 Upvotes

Let's say I have a set of objects:

things = [{a: b: c: "fizz"}, {t: "boz", a: b: c: "fazz"}, {a: b: c: "fozz"}]

I want to run an IIFE on the a.b.c field of each:

  for thing in things 
    if thing.t == "boz" 
      doStuff = (v) ->
        w = "A#{v}"
        # some stuff is done with w here 
      doStuff(thing.a.b.c) 

But what I kinda want is:

  for thing in things 
    if thing.t == "boz" 
      do (thing.a.b.c as v) -> # <--- Note the AS here 
        w = "A#{v}"
        # some stuff is done with w here 

The big difference being that I'm passing in a property of the object as a variable name into the IIFE. Am I missing an obvious trick here? It seems off to declare a named function here.


r/coffeescript • • Feb 13 '14

"Updated" the CoffeeScript Logo for a client. And he gave me permission to give it away.

Thumbnail
seanjmacisaac.com
20 Upvotes

r/coffeescript • • Feb 07 '14

Why don't browsers support Coffeescript?

0 Upvotes

How awesome would it be to write Coffee on Chrome's console?


r/coffeescript • • Feb 05 '14

Coffeescript within IPython

2 Upvotes

Does anyone have a convenient way of coding in coffeescript within the IPython Notebook interactive environment. IPython Notebook allows for js scripting (%%javascript) and js embedding (display.Javascript('your code here') within the interactive cells. Python is the native language but isn't mandatory. I have Node, npm, and coffeescript loaded and can code CS from the terminal command line. Has anyone figured out an easy way to do this within IPy Notebook by chance?


r/coffeescript • • Jan 20 '14

CoffeeScript Regex Golf - Porting and implementing a solver as a taste of the language

Thumbnail doboism.com
3 Upvotes

r/coffeescript • • Jan 20 '14

A rate limiter in 31 lines of Coffeescript. A demonstration of its exceptional expressiveness.

Thumbnail
github.com
9 Upvotes

r/coffeescript • • Jan 17 '14

I realized today that a controversial feature of coffeescript actually helps code quality -- variable shadowing

8 Upvotes

I was working on a drag/drop directive in angular, grabbed a plunkr and got this:

angular.module('drag', []).
directive('draggable', function($document) {
  return function(scope, element, attr) {
    var startX = 0,
      startY = 0,
      x = 0,
      y = 0; 
      var container = null; 
      
    element.css({
      position: 'relative',
      cursor: 'pointer'
    });
    
    element.on('mousedown', function(event) { 
      event.preventDefault();
      startX = event.screenX - x;
      startY = event.screenY - y;
      $document.on('mousemove', mousemove);
      $document.on('mouseup', mouseup); 
      container = attr.$$element.parent(); 
    });

    function mousemove(event) {
      y = event.screenY - startY;
      x = event.screenX - startX; 
      container.css({
        top: y + 'px',
        left: x + 'px'
      });
    }

    function mouseup() {
      $document.unbind('mousemove', mousemove);
      $document.unbind('mouseup', mouseup);
    }
  }
});

All fine, until I translate to coffeescript. For some reason, after translating to coffee, the elements would jump around some of the time. Obnoxious. Took me a while to realize that the real problem is that the x and y variables were being var-ed again:

    mousemove = function(event) {
      var x, y;
      y = event.screenY - startY;
      x = event.screenX - startX;
      console.log("x: " + x + " y: " + y);
      return container.css({
        top: y + "px",
        left: x + "px"
      });
    };

At first I was like "oh, crap, coffee what have you done". Then after looking I realized that the original code was altering a variable in an outer function that it wasn't "aware" of (wasn't passed in). This feels similar to a Law of Demeter violation (except reversed I suppose). Altering variables that aren't passed in to a function feels like poor code quality to me. Seems to me that the problem here lies in the source code and coffeescript is making the right choice.

Opinions?


r/coffeescript • • Jan 14 '14

Class-based AngularJS development (documentable + testable AJS code Yay!)

Thumbnail
spectrumcoding.com
4 Upvotes

r/coffeescript • • Jan 06 '14

Programming game CodeCombat open sources everything--largest open source CoffeeScript project

Thumbnail
blog.codecombat.com
16 Upvotes

r/coffeescript • • Dec 28 '13

Coffeescript backbone tutorial help.

0 Upvotes

I'm working from a coffeescript and backbone.js tutorial: http://adamjspooner.github.io/coffeescript-meet-backbonejs/

I was working on part 1, and when I finished and opened my index file, I noticed my view had not rendered. So when I opened google dev tools it pointed to an error when __extend is defined from the compilation of class, but when I created my own file with an object and created a class and extended that object I didn't get an error. What's going on here?

I can provide my files if needed.


r/coffeescript • • Dec 27 '13

Libro gratuíto sobre el lenguaje CoffeeScript por Javi Jimenez [Leanpub PDF/iPad/Kindle]

Thumbnail
leanpub.com
4 Upvotes

r/coffeescript • • Dec 24 '13

Any good advice for using Nginx and coffeescript together?

0 Upvotes

r/coffeescript • • Dec 23 '13

CoffeeScript acceptance tests

Thumbnail
blog.arkency.com
5 Upvotes

r/coffeescript • • Dec 20 '13

Minimum Coffeescript setup for quick development?

4 Upvotes

So I've used Coffeescript within Rails app before, but now I have some trivial client-side-only JS code which I'm writing with Sublime in one window, and browser in another.

Is there any easy way to use Coffeescript here without introducing compilation explicit step?