MyBB Community Forums

Full Version: CoffeeScript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just started using this and I like it. Takes less to code things and it looks cleaner imo. Here's a jQuery plugin I wrote in Javascript then CoffeeScript:

Jscript:
http://ericj.koding.com/coffee/js/script.js

CoffeeScript:
http://ericj.koding.com/coffee/js/script.coffee

So have you ever used it? Considered it? Or have you even heard of it before?
First link leads to a 403 forbidden page. Wink

I've actually never heard of CoffeeScript. Blush
Never used it before. But the code seems good.
Looks more like a Python code (i guess its meant to be like that, isn't it). Big Grin
(2013-04-07, 01:50 AM)Seabody Wrote: [ -> ]First link leads to a 403 forbidden page. Wink

I've actually never heard of CoffeeScript. Blush

Click the link, click in your address bar, then press enter to reload, and it should work then. Same thing happened for me.
Yeah it's basically just changing how much you have to type to get things done. For example:

Javascript:
(function() { })

CoffeeScript:
->

If you have a Koding profile it's pretty simple to use, just open a console tab, navigate to where your .coffee file is with cd, then run this command:

coffee --watch --compile yourfile.coffee

And any time you save that file it'll automatically compile it to .js.

Also for using it locally, http://coffeescript.org/



It's pretty nice, and using it makes your code pass JSLint automatically.

(Sorry about the error btw, idk what's up. Typing Javascript: also bugs out for some reason)
Yeah, I started using coffeescript recently along with Spine.app (uses the Spine library) and I agree with the similarities with python, in terms of indentation (especially with things like if/else statements)

Python:
if 4 + 4 == 8:
    # Do something
else:
    # Do something else
Coffeescript:
if 4 + 4 == 8
    # Do something
else
    # Do something else

I have to say I love coffeescript as the code looks alot more readable and there is less of it!
Yeah it uses things found in Ruby and Python.

Ruby:
if var == 10
   # Something
else
   # Something
end

CoffeeScript:
if var == (Or just is) 10
   # Something
else
   # Something

I haven't used Spine before though, thanks for the link I'll definitely take a look. Big Grin
(2013-04-08, 11:01 PM)Eric J. Wrote: [ -> ]I haven't used Spine before though, thanks for the link I'll definitely take a look. Big Grin

Here is a basic hello world app I made (its not much but shows the basic structure of spine.app Toungue ):
http://github.com/SmItH197/spine.hello/
Hi everyone. I'm just a beginner with CoffeeScript and I am trying to look for a project developed using CoffeeScript. Could anyone help me pls? Thanks Smile
Well all CoffeeScript is is something that eases Javascript development, so really all you'll find is what CS outputs in JS.