My JavaScript book is out! Don't miss the opportunity to upgrade your beginner or average dev skills.

Friday, August 19, 2011

CoffeeShit, The CoffeeScript Parody


    ... because script happens!


This silly project does not want to offend the CoffeeScript creator neither any CoffeeScript user, hoping both have sense of humor :D

About

Every cult movie has one or more parodies ... well, every cult technology as well (or at least it should)!
This idiotic project is on github with a better explanation, a suite of unit tests, and both source code and the partially manually minified one ( manually because I have discovered a nice bug with closure compiler and eval there ... )

About The Name

You can check the library by yourself and realize I have used all worst possible practices in order to simulate a different syntax within the one allowed by JavaScript.
Such pile of shit I wrote to mimic an excellent project as CoffeeScript is could not have a better name, imo.
If you feel insulted by this idiotic experiment please let me know and I'll do my best to let people try it under a different name.

Example


// CoffeeScript
square = (x) -> x * x
fill = (container, liquid = "coffee") ->
"Filling the #{container} with #{liquid}..."
mood = greatlyImproved if singing
eat food for food in ['toast', 'cheese', 'wine']
winner = yes if pick in [47, 92, 13]
speed ?= 75

// CoffeeShit
square = 'x'['->']('x * x')
fill = ['container', 'liquid = "coffee"']['->'](
'Filling the #{container} with #{liquid}...'
)
mood = greatlyImproved.if(singing)
'eat(food)'.for('food').in(['toast', 'cheese', 'wine'])
winner = yes.if(pick.in([47, 92, 13]))
'speed'['?='](75)

Many more in the landing page, even more inside unit tests file.

As Summary

I really could not resist :D
This post aim is to let you write some comment, have fun with CoffeeShit!

3 comments:

Jani Hartikainen said...

Hah, nice one. Reminds me a bit about my silly attempt at poke fun at PHP/jQuery/certain-other-things with pooQuery... Some people took it seriously, so I guess it was pretty succesful.. :D

http://codeutopia.net/blog/?s=pooQuery

Andrea Giammarchi said...

ah ah Jani, didn't noo pooQuery, brilliant :D

However, I would rather prefer developers use CofeeScript rather than this stupid JS library ... it's really the most evil code I could possibly think about, wrong for so many reasons ... not sure it will have a future, but it can prove JS is quite flexible ;)

Christopher said...

This is great... I love the gratuitous (mis)use of eval() and the String and Object and prototypes.