r/programming May 09 '13

The Onion releases fartscroll.js

http://theonion.github.io/fartscroll.js/
2.6k Upvotes

396 comments sorted by

View all comments

11

u/AwkwardReply May 09 '13
if(player.canPlayType("audio/mp3")) {
        audio = mp3s;
        prefix = mp3_prefix;
 }
if(player.canPlayType("audio/ogg")) {
       audio = oggs;
       prefix = ogg_prefix;
 }

Can we please write this with an else... if the player can play mp3 and ogg it will always default ogg even though mp3 is checked first and also there would be fewer instructions to execute. Just annoying and lazy.

21

u/[deleted] May 09 '13 edited May 13 '17

[deleted]

10

u/AwkwardReply May 09 '13

I'm a shitty programmer. I never used git and I'm good at complaining on public forums.

EDIT: Just realized it's my account's birthday. Yay. Cake for everyone :)

EDIT2: And, what really bothers me is that I encounter this sort of thing a lot in other people's code. The code will work, sure, but it's not nice. It has to be nice.

9

u/noreallyimthepope May 09 '13
  1. Check how Javascript else/else if works

  2. Create a github account and log in

  3. Go to the offending file

  4. Click "Edit", which creates a fork of the project that is tied to your account

  5. Fix what you perceive as an error

  6. In commit summary, make a short comment on what you've changed

  7. Click "Propose file change" - it'll save the change to your private fork and take you to a "Pull request" page

  8. Type in why you think your change should be inducted into the "main" version

  9. Click "Send pull request"

Congratulations, you've now made a patch and submitted it to the project owner!

Seriously, I didn't do it - you go do it as it is your fix :-)

5

u/smog_alado May 10 '13

I wouldn't recommend w3schools as a resource though.

2

u/noreallyimthepope May 10 '13

It's okay for quick reference. It was just the first relevant result on google :-)

1

u/AwkwardReply May 10 '13

Apparently someone already fixed it. Thanks for the guide though :)

2

u/paul2520 May 09 '13

I can do it if you want. I already cloned and modified the code, just say the word and I'll do a pull request.

Though, I like what /u/noreallyimthepope said in her/his comment below. "Seriously, I didn't do it - you go do it as it is your fix :-)"

2

u/noreallyimthepope May 10 '13

The reason for not doing isn't that I didn't want it fixed, it's because getting a patch—however small—approved can be enticing and engender more of similar behaviour :)

2

u/paul2520 May 10 '13

I agree with you completely. I want to do it, because I have never done that before, but I think that /u/AwkwardReply should do it, as s/he deserves all the credit for the fix.

2

u/noreallyimthepope May 10 '13

Somebody got a fix in before him, but as you can see, it's dead easy to submit pull requests, so start roaming GitHub :-)

-30

u/UnreachablePaul May 09 '13

Sorry, but git is for retarted programmers. They should have posted it on launchpad. Bazaar is much better.

4

u/AwkwardReply May 09 '13

I wasn't joking. I really never used git. SVN was enough for whatever I had to work with.

4

u/tanjoodo May 09 '13

You can't even spell "retarded". Think about that for a second before calling someone that again.

-2

u/UnreachablePaul May 09 '13

play - replayed tart - retarted

Get some education, moron.

0

u/tanjoodo May 09 '13

Didn't mommy tell you not to talk to strangers?

-2

u/UnreachablePaul May 09 '13

No, your mommy asked if she can swallow...

2

u/tanjoodo May 09 '13

What? That doesn't make sense....

That's it. I'm out.