Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
FuckItJS: Runs your javascript code whether your compiler likes it or not. (github.com/mattdiamond)
315 points by tomkin on June 25, 2012 | hide | past | favorite | 64 comments


The software license is the best part:

"If you are caught in a dire situation wherein you only have enough time to save one person out of a group, and the Author is a member of that group, you must save the Author."


I don't know, I really liked the `FuckIt.moreConflict()` method, especially when I read the source and realized he actually tested it and ensured `window.location` would not get overwritten (or you'd navigate away from the page)


Brilliant... This is going in every software license and terms agreement I write from here on out. What a tremendous insurance policy if I perhaps hit on the next Facebook. 1/7th of the planet responsible for saving lil ol' me.


Just keep in mind: widespread adoption of this license can lead to race conditions, when two concurrent authors of simultaneously used products happen to be in the same group


Our QA group is hiring


The author of this software takes precedence over all other licenses times infinity plus one!


Define author as the Original Author


Interestingly (to me), this is Technically GPL incompatible, since it adds additional restrictions beyond what the GPL requires.


Another reason not to use GPL - it breaks the ability to add something funny to licence.


Not so much a fault of the GPL as a fault of copyright law - I've heard judges tend to look poorly on people who appear to be disrespecting the legal system.


On their own code, a person can add what ever extra restrictions on top of the GPL they like. You might be able to argue that it is not really the GPL afterwards. If they want to use other GPL code in it, then they have to be careful. If someone else wants to use the code in some other GPL code, then they too have to be careful.


Just dual-license the work.


"Dual-license" means that the user gets to pick a license, not that the union of all license restrictions applies.


Well-done. What does this have to do with making a joke license for a work people might want to actually modify? Do they not get to laugh if they choose GPL over the one with the comedy in?


> Do they not get to laugh if they choose GPL over the one with the comedy in?

The important thing is what happens if they pick the joke license. They get to ignore the GPL entirely, which is probably not what you want if you only intended to add something funny to your work.

If you just want to add funny license terms but keep the GPL terms, you have to modify the GPL license instead of having a dual license.


I dunno. Does this clause require me to save you if I'm in favor of said event happening?


That's not a 'dire situation' more of a plan coming together.


[deleted]


It is a good idea to read the article before commenting.


In this case, that should be considered a feature.


Reminds me of Failure-Oblivious Computing [1]. It takes advantage of the fact that in many programs errors have a short error propagation distance as they are often written as a main event loop and as long as you can get to the next iteration of the loop the error won't corrupt state. For example, if your server crashes on one request, it will probably be fine if it just gets invalid data instead, discards it as invalid, and then waits for the next response.

I'm not sure if this applies well to JavaScript. We might observe that most JavaScript is a set of disjoint event handlers. If one doesn't work right it probably won't break the rest of the site.

I played around with implementing FOP dynamically through DynamoRIO [2] as a class project but only got through a proof of concept and quickly remembered why I hate x86 assembly.

1: http://en.wikipedia.org/wiki/Failure-oblivious_computing

2: https://github.com/periodic/Shady


This is exactly what browsers do already. If one event handler has an error, that event is aborted. But the event loops continues, and js will continue to run.


So that's where the name comes from. FOC-It.


That reminds me a bit about a 'feature' of VB (LotusScript?) "on error resume next" :)


Clearly this is the future.


I love a good tongue-in-cheek git repository... Reminded me of: http://html9responsiveboilerstrapjs.com


That is the funniest thing I've seen all month!

"2. How do I install this?

Um... are you stupid or something? Just attackclone the grit repo pushmerge, then rubygem the lymphnode js shawarma module – and presto!"


+1


Don't forget to check out the companion Twitter account: https://twitter.com/H9RBSjs


That's awesome! Try running the JS file - clearly, it should be included in every site. And check out the source of the page.


Original Author here... for reasons I can't fathom, someone has created a Drupal module:

http://drupal.org/project/fuckitjs


Which contains this gem http://drupal.org/node/1657944


Interestingly, the Bad Judgement module looks like it's a legit check on other non-serious modules:

This module provides an explicit dependency for modules whose usage requires bad judgement. Joke modules often require "bad judgement".


I realize that this is a joke, but I can't help but wonder if there is a possible valid use for it. I could imagine needing something that fixed bad js for a crawler that needed JS on a poorly coded site, but I can't think of an occasion where discarded bad code would ever be useful. Maybe if a site deliberately injected bad JS to prevent crawling it would be worthwhile.


I've used this library for loading horrible, third-party javascript:

https://github.com/gregersrygg/crapLoader


> 1. Include jQuery, because everything requires jQuery

I love it! :P

Great sense of humor.


Also, "Note: This is ALPHA software and may result in irreversible brain damage."


This is ALPHA software and will routinely bully other software to assert its dominance.

Sorry, couldn't resist :)


This is ALPHA software and will give you a squeaky voice if you have enough electrons on hand.


For completeness, it should use WTFPL license.

http://en.wikipedia.org/wiki/WTFPL


+1


First thing I thought when I see it: Why!?

Second thing: Why not call it OnErrorResumeNext!?


Ah... bringing back the memories :)

I think I'll go add an "Option Explicit" to the top of the file I'm working on, right now, just for fun...

Since it's not valid JavaScript, I'm sure FuckItJS will just skip over it.


You mean, write a script which wraps each line in a js file with try catch? Sounds doable.


How would I go about integrating this as a step into my build process?


this is probably like integrating a car crash into your daily commute

but you can probably integrate into Jenkins for continuous jury-rigging


> Through a process known as Eval-Rinse-Reload-And-Repeat

ERRAR. I like it.


Intentional or not, that is Portuguese for "to make a mistake".


It's also a netspeak spelling of the English word "error." (For some reason it's considered humorous to transform -er and -or into -ar.)


It is? I can safely say I've never seen anyone say "errar", ever.


It's a general thing some people do. Anything that ends in an -er sound can be replaced with -ar for apparent hilarity. I think the most common (and maybe first) example is "winnar," though there are many more.


Nevar, evar?


I feel terrible for the person who takes a contract job and is handed some code that depends on this. Also I hope it isn't me.



My apologies. I submitted, but when it has been submitted before it usually just redirects you to the previously submitted one. Not sure why it didn't do this for me this time!

EDIT: Seems to be "http" vs. "https".


No need to apologise. If something is missed the first time, people see it the second time and it gets voted up to the front page then people want to see it. With the voting system if it truly is a "dupe" it wont get voted up...


I read the source before I read the readme, and was thoroughly mindfucked.

I love it.


...but still, what does `FuckIt.moreConflict()` actually do and when would I use it? (I just desperately feel the need to use a function named `moreConflict`... don't ask!)


It overwrites ever property on the 'window' object (except for 'location') with FuckIt.


Pardon me but I don't get any alert when I run the test script.


//@ TODO: give a shit

epic comment, in an epic app



One of the best laughs I've had in a while.


+1 for creative name


Nice.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: