- Subscribe and get the new articles every now and then directly in your reader — I recommend using Google Reader
7 days of The 140 Characters Webapp Challenge - wrapped up!
written by Marek Foss

You may have hard of The 140 Characters Webapp Challenge. It made quite a buzz and I’m happy to report that the response was a pleasant surprise to me. Here’s a report from the middle of The Challenge — there’s still a week left!
Some statistics: 19 coders (including me), who have produced 28 webapps in PHP, Perl, Ruby and JS — all but 4 are less than 140 characters of code! Impressive work so far, everybody! Thanks! I managed to wrap up all your work into one list.
Here are these awesome 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.
Coders and the webapps
Note: the bold underlined ones are my favorite.
Isaac Van Name
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
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
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!’);
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
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;
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
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)?>
The same, but without sorting, just 82 chars:
<?=’<form><input name=a>’;fputs(fopen(a,a),$_GET[a].’<hr>’)?><?=readfile(a)?>
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.’‘;?>
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]:’:(’?>
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)?>
Ormo
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
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
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
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
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()
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
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)?>
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
Epilepsy Causer in 114 chars of JS:
javascript:{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
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
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
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”)}
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”)
Michael Cotterell
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
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
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
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
Example: http://f055.net/140/challenge.pl
Code: http://www.f055.net/images/uploads/140charswebapp.zip
Blog post: http://f055.net/article/the-140-character-webapp-challenge/
Thoughts and conclusions
I am really amazed how much can be squeezed into 140 characters. Writing a lot lines of code not necessarily means you’re a good coder — it just means you can code. Writing little code that can do lot is another thing. This is what shows the true skills. If you think you’re up to it, there’s still 7 days left to show off. Thanks to all the awesome coders that already took The Challenge! I’m impressed.
And if something more comes to your mind, don’t hesitate to post your code, either here in the comments, or in the original The 140 Characters Webapp Challenge post. Bring it on! And follow me on Twitter to get all the updates instantly!


