7
\$\begingroup\$

A short while, ago, @daniel_ernston sent the following challenge to @StackCodeGolf on Twitter:

@StackCodeGolf Your task is to build a program that uses the API of your choice to tweet its own source code. Shortest code wins, of course.

\$\endgroup\$
  • 1
    \$\begingroup\$ What about reading the source code and other quine cheats? \$\endgroup\$ – Martin Ender Mar 7 '15 at 3:06
  • \$\begingroup\$ All permissible. I want to see how short you can get it, and I have a suspicion it may not be possible if I don't open those up. \$\endgroup\$ – Joe Z. Mar 7 '15 at 3:08
  • \$\begingroup\$ If you can come up with a solution that doesn't use that cheat, though, then by all means I'll give you an honourable mention (and maybe even a bounty). \$\endgroup\$ – Joe Z. Mar 7 '15 at 3:08
  • \$\begingroup\$ Hm, won't this depend quite heavily on the chosen user name and credentials? (Both whether it fits in the tweet and the actual score.) \$\endgroup\$ – Martin Ender Mar 7 '15 at 3:15
  • 11
    \$\begingroup\$ I don't have a twitter account and while I could create one, I have to give them my phone number to get an api key, maybe someone could post api keys from a throwaway account for everyone to use. This would also make the challenge fairer since they would be the same length. \$\endgroup\$ – Maltysen Mar 8 '15 at 19:25
9
\$\begingroup\$

JavaScript, 38 characters

window.open("http://tinyurl.com/erjk34");

Here is the tweet, in all its glory: https://twitter.com/kevinaworkman/status/575425948562014209

And here is my previous entry at 95 characters:

function q() {
window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(q+";{q();}"));
};{q();}

And if that's not cheating...

HTML, 22 characters

http://tinyurl.com/erjk35

\$\endgroup\$
  • \$\begingroup\$ It this what was meant by tweeting or was it referring to the REST API dev.twitter.com/rest/public? \$\endgroup\$ – Maltysen Mar 10 '15 at 20:51
  • \$\begingroup\$ @Maltysen It sends a tweet, so I'm counting it as fair game. It might be cheating, but hey, OP said that cheating was allowed! :p \$\endgroup\$ – Kevin Workman Mar 10 '15 at 20:56
  • 1
    \$\begingroup\$ Okay then, +1 for loopholes. \$\endgroup\$ – Maltysen Mar 10 '15 at 21:05
  • 1
    \$\begingroup\$ Well, uh, the TinyURL should post the tweet entirely by itself, without requiring you to press the "Tweet" button... \$\endgroup\$ – Joe Z. Mar 10 '15 at 23:48
  • 1
    \$\begingroup\$ @JoeZ. I went into this knowing that it was probably cheating- especially my last update, haha. I just figured it would be fun to try, especially since you didn't have any answers after 3 days! \$\endgroup\$ – Kevin Workman Mar 11 '15 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.