Final wrap-up of The 140 Characters Webapp Challenge!

February 28, 2009

The 140 Characters Webapp Challenge is now over! If by chance you don’t know what it was, read this article at Mashable or see the original post at f055. It was great 2 weeks, everybody. You showed some awesome skills, and really raised to The Challenge! Kudos :) And thanks for making it all so exciting for all of us!

I have wrapped up all of your apps into this long, 32 apps list, which all are indeed functional and below 140 chars! (plus 4 that are interesting, but too long) You [could have] voted for ONE of your favorite apps. And yes, the voting script [was] 140 chars too!

Here is the final wrap-up of the coders and their apps, almost in the order of appearance ;] If you wish to change something in your description, tweet me! To see how these were born, follow the comments on The Challenge.

Voting!

You can vote for your ONE favorite script! Just click the VOTE link below the favorite source code! Voting is managed by yet another 140 characters app I made — it even does IP filtering to block repeated votes. If you get 0 then it means you already voted. UPDATE: Voting is now closed!

use CGI’:all’;$i=$ENV{‘REMOTE_ADDR’};$v=(param 0)=~/^(\d+)$/?$1:0;open V,’<v’;$j=<V>;open V,’>>v’;print header.($j!~/$i/?print V “!$v&$i”:0)

Results are displayed by a 160 characters app, because I wanted to make nice chart bars using input fields. But it can be done in 140 chars as well, if just plain text is displayed.

use CGI’:all’;print header;open V,’v’;%v=();$v=<V>;while($v=~/!(\d+)&/g){$v{$1}++};for$i(sort{$a<=>$b}keys%v){print p.b(“$i.”).br.input({size=>$v{$i}}).$v{$i}};

OK! Enough of this talking, let’s get down to business! Here are the awesome coders and their apps!

Coders and the webapps

Isaac Van Name

1. Micro-Twitter in 154 chars of PHP (props for being the first!):

<form><input name=“a”><input type=“submit” value=“send”/></form><?php if($_GET[‘a’]){$q=fopen(‘micro.php’,‘a’);fwrite($q,$_GET[‘a’].’<hr>’);fclose($q);}?>

Bari

2. Micro-Twitter in 139 chars of PHP (modification of Issac’s code):

<form><input type=“submit”><input name=“a”></form><?php $a=$_GET[a];if($a){$q=fopen(‘m.php’,‘a’);fwrite($q,”<hr>$a”);fclose($q);echo $a;}?>

Andy Bailey

3. Age Guessing in 140 chars of JS:

var c=0;var i=35;do{var x=confirm(‘are you ‘+i+’?\n(ok=Y)’);i=Math.floor(Math.random()*70);c++;}while(!x);alert(‘I only took ‘+c+’ tries!’);

4. Micro-Twitter in 99 chars of JS:

(”<input value=..><p>[go]”);$(‘p’).click(function(){$(‘body’).append($(‘input’).val() + ‘<hr>’);});

Example: http://www.fiddyp.co.uk/internal/140charchallenge/

James

5. Micro-Twitter in 134 chars of PHP:

<form><input name=“s”><input type=“submit”><?$s=$_GET[s];$f=file(‘a’);$a=!empty($s)?”<hr>$s$f[0]”:’‘;fwrite(fopen(‘a’,‘w’),$a);echo$a;

6. Time of life counter in 146 chars of JS:

d=prompt(‘DOB?’,‘DD-MM-YYYY’).split(/[^\d]/);d=(new Date()-new Date(d[2],d[1],d[0]))/1000;alert(d+’ seconds\n’+d/60+’ minutes\n’+d/60/60+’ hours’)

Keenora

7. Micro-Twitter in 129 chars of PHP:

<?=’<form><input name=a><input type=submit></form>’;fputs(fopen(a,a),$_GET[a].”\n<hr>”);$a=file(a);krsort($a)?><?=implode( ,$a)?>

8. The same, but without sorting, just 82 chars:

<?=’<form><input name=a>’;fputs(fopen(a,a),$_GET[a].’<hr>’)?><?=readfile(a)?>

9. Delicious links in 136 chars of PHP:

<?$x=new SimpleXMLElement(file_get_contents(“http://feeds.delicious.com/v2/rss”));foreach($x->channel->item as$a)echo$a->title.’‘;?>

10. Get HTTP Code of URL in 133 chars of PHP:

<?$a=(@stream_get_meta_data(fopen($_GET[a],80)));preg_match(’# (\d+) #’,@implode($a[wrapper_data]),$b)?><?=($b)?‘Code: ‘.$b[1]:’:(’?>

11. Resize JPG by half in 186 chars of PHP:

<?header(‘Content-type:’);list($w,$h)=getimagesize($_GET[a]);$b=imagecreatetruecolor($w/2,$h/2);imagecopyresized($b,imagecreatefromjpeg($_GET[a]),0,0,0,0,$w/2,$h/2,$w,$h);imagejpeg($b)?>

12. ShouldIdoIt.com copy in 139 chars of PHP:

<?=’<form><input name=a>’;$b=’<hr>’.$_GET[a].’ — ‘;if(strstr($b,’?’))fputs(fopen(a,a),rand(0,1)?$b.‘yes’:$b.‘no’);echo@implode( ,file(a))?>

Ormo

13. A clone of downforeveryoneorjustme.com in 135 chars of PHP:

<?=’<form><input name=s><input type=submit></form>’;$a=$_GET[s];echo(@file((stripos($a,”:”))?$a:“http://”.$a))?‘just you’:‘its down’;?>

Example: http://loughanmore.f2s.com/down.php

Mirko Grönroos

14. Micro-Twitter in 140 chars of Ruby (including own webserver!):

%w[rubygems sinatra].each{|w|require w};get’/’do;m=params[:m];open(“f”,”a”){|f|f<<m+”\n”}if m;haml’%form <input name=”m”/> %pre&=`cat f`’end

Code: http://pastebin.com/m430d6705

Tony Buser

15. Micro-Twitter in 136 chars of Ruby (including own webserver!):

require’rubygems’;require’sinatra’;get(“/”){r=”<form><input name=’t’></form>”;t=params[:t];`echo ‘<hr>#{t}’ >> t` if t;r<<`tail -r t`;r}

Code: http://pastie.org/388329

adamo

16. Random Quotes in 81 chars of language I can’t recognize ;] :

echo 80 stream tcp nowait nobody /usr/games/fortune fortune -a >> /etc/inetd.conf

Example: http://inbox2.eu:8081/
 Blog post: http://blog.postmaster.gr/2009/02/13/does-this-count-as-a-web-application/

synodinos

17. Odd or Not game in 140 chars of JS:

function x(){if(confirm(“odd?”)&&((Math.floor(Math.random()*10))%2))alert(“:)”);else alert(“:(“);if(confirm(“rpt?”))x()}x()

18. 1 or 0 game in 130 chars of JS:

function x(){if(confirm(”1?”)&&(Math.round(Math.random())))alert(”:)”);else alert(”:(”);if(confirm(”rpt?”))x()}x()

Blog post: http://synodinos.net/2009/02/14/re-the-140-character-webapp-challenge/

Bastian Albers

19. Micro-Twitter in 136 chars of PHP:

<form><input name=a><input type=submit></form><?if(strlen($_GET[a])<140){$h=fopen(a,“a”);fwrite($h,$_GET[a].”<hr>”);}echo@readfile(a)?>

20. More featured Micro-Twitter in 141 chars of PHP:

<form><input name=a><input type=submit><?$l=strlen($_GET[a]);if($l<140&&$l>0){$h=fopen(a,“a”);fwrite($h,$_GET[a].”<hr>”);}echo@readfile(a)?>

cherouvim

21. Epilepsy Causer in 114 chars of JS:

{r=0;setInterval(function(){document.body.style.background=(r++%2==0?’#’+r%7+r%9+r%8:’0')},50);void(0)}

Blog post: http://blog.cherouvim.com/re-the-140-character-webapp-challenge/

Facyla

22. Many-Features Micro-Twitter in 140 chars of PHP:

<form><input name=n><?$m=implode(‘’,file(n));$n=htmlentities($_GET[n]);if($n<>’’)file_put_contents(n,”<hr>”.date(YmdHi).”: $n$m”);include n;

Example: http://facyla.net/proto/twitter/@README.php

fabien

23. A PHP web framework in 131 chars of PHP:

require __DIR__.’/c.php’; if (!is_callable($c = @$_GET[‘c’] ?: function() { echo ‘Woah!’; })) throw new Exception(‘Error’); $c();

Homepage: http://www.twitto.org/

Hartog

24. Copy of downforeveryoneorjustme.com in 135 chars of Perl:

use CGI’:all’;print header.’<form>down4u?:’.br.textarea(‘a’).br.submit;if($a=param(‘a’)){`ping -c1 $a.`;print h2($? ? “down”:“just4u”)}

25. Copy of Twitto.org web framework in 111 chars of Perl:

use CGI’:all’;($a,$b)=path_info=~/.([^\/]+).(.*)/;eval”use $a”;print header.(!$@&&$a->can($b)?$a->$b():“no go”)

26. Link to banner in 130 chars of Perl:

use CGI’:all’;print header.’<form>message:’.textfield(‘m’).submit;if($a=param(‘m’)){print’‘.`/usr/games/banner $a`.’</pre>’}

Dorian Muthig

27. Guessing game of numbers between 0–20 in 140 chars of JS:

r=Math.round(Math.random()*20);for(c=1;c<=10;c++){g=prompt(‘Guess’,’‘);if(g==r){alert(‘Won’);break;}if(!g){break;}if(c==10){alert(‘Lost’);}}

haris

28. RSS/RDF parser with formatted output in 135 chars of PHP:

<?php foreach(file($_GET[p])as$l)if(preg_match(’/<(title|link)>([^<]+)/’,$l,$m))echo$m[1]==‘link’?” <a >link</a><hr>”:$m[2]?>

Example: http://test.neziric.org/140/feed-parser.php?u=http://feeds.delicious.com/v2/rss/?count=15

draegtun

29. Micro-twitter using Continuity in 140 chars of Perl:

use Continuity;Continuity->new->loop;sub main{($r)=@_;while(){$r->print(‘<form><input name=m>’);$r->next;$x+=$r->param(‘m’);$r->print($x)}}

Blog post: http://draegtun.wordpress.com/2009/02/23/the-140-character-webapp/

30. Word counter using Continuity in 139 chars of Perl:

use Continuity;Continuity->new->loop;sub main{while(){$m=$_[0]->print(”$m=$l<form><input name=m>”)->next->param(‘m’);$l=()=$m=~/\w+/g}}

Simon Overell

31. Social linking — redirects to URL left by the previous person — in 140 chars of PHP:

<?php if($_GET[‘a’]){$x=file(a);header(“Location:$x[0]”);fwrite(fopen(a,‘w’),$_GET[‘a’]);}?><form><input name=a><input type=“submit”></form>

Example: http://www.numenore.co.uk/140char/simon.php
 Homepage: http://www.doc.ic.ac.uk/~seo01/wiki/miscellaneous

awwaiid

32. Self-contained webserver using Continuity in 140 chars of Perl:

use Continuity;Continuity->new->loop;sub main{while(){$m=$_[0]->print(”$m<form><input name=m>”)->next->param(‘m’);$m=~y/a-z/n-za-m/}}#rot13!

Twitter: http://twitter.com/awwaiid/status/1245021575

Michael Cotterell

33. Album Art Finder in 192 chars of PHP:

<form>Artist<input name=artist>Album<input name=album><input type=submit><p><?if($q=$_SERVER[QUERY_STRING])echo’<img src=’.end(simplexml_load_file(current(file(a)).’&’.$q)->album->image).’>’;

Example: http://phattangent.com/140.php
 Code: http://pastebin.com/f2efc6065

Sergry Agarkov

34. Micro-Twitter in 241 chars of PHP:

<form method=”post”><input type=”text” name=”A” value=”Msg” size=”140"><input type=”submit” name=”submit”></form><?php $f=file(“1”);$m=$_POST[“A”];if($m<>””){file_put_contents(“1”,$m.’<br>’,FILE_APPEND);}for ($i=0;$i<11;$i++){echo $f[$i];}?>

Code: http://dumpz.org/5512/

Jim

35. Micro-Twitter in 308 chars of Ruby:

require’camping’;Camping.goes:T;module T::Models;class T<Base;end;end;module T::Controllers;class I<R:/;def get;@s=T.all;render:i;end;def post;T.create:d=>input.d;redirect’/’;end;end;end;module T::Views;def i;form(:method=>:post){;input:type=>:submit;input:name=>‘d’,:type=>:text;};@s.each{|t|hr t.d};end;end

Marek Foss

36. Micro-Twitter that started it all in 140 chars of Perl:

use CGI’:all’;print header.’<form>’.submit.textfield 0,’’,99;open F,’<0';print $f=(param 0)=~/1234 (.*)/?hr.$1.<F>:<F>;open F,’>0';print F$f

Blog post: http://f055.net/article/the-140-character-webapp-challenge/

Final words

I am very happy it all turned out so well. I will be thinking of a next challenge for you soon, if it again magically pops into my mind, or I’ll get inspired as I did in this challenge. Or maybe you have a really exciting idea? Share your thoughts in the comments! You may also want to follow me on Twitter and message me directly with your suggestions :)

It was fun, guys! You should be all proud. Because, as I said before, it’s easy to write a lot of code. The challenge is to write short, but packed with features. That’s what it was all about. And you all proved it can be done, with awesome results! Thanks!


Originally published at web.archive.org.