The 140 character webapp challenge!

February 13, 2009

m
m
Mar 18, 2018 · 3 min read
Image for post
Image for post

How many interesting webapps can you code in one Twitter message? I have one — a micro-twitter. I want to see many!

Back at Twitter I read this message on 222 character Wikis, by Arun Shroff. I thought — why not — and replied with a challenge: Make a 140 chars webapp in 2 weeks! Whatever language, library or module included, as long as it’s standard. I made an example micro-twitter, described later in the post. If you think you can do better — I dare you. You’ve got 2 weeks again. Post your webapp here in the comments! (complete code, link or anything such that we can see it at its best)

Now, to my micro-twitter app. It’s written in Perl, using just the CGI module. The one-line code has 140 characters, although in the source code file you can find a further minimized version with just 123 characters, but less features.

What the micro-twitter basically does, is let you update your status and show it. Don’t expect any social candy, there’s no room for that, but it works, and you can (no longer) test it here — the PIN is 1234, and this version is a bit more secure, for obvious reasons. To post a message, type the PIN number, a space, and then your message.

Image for post
Image for post

I’ve worked about 2 hours refining the code. That’s around 51 seconds per character, funny how such a short piece takes so much time. And here it is:

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

The extent to which I bended the common practices of Perl are quite bizarre to me, but on the other hand this code is completely valid in my IDE of choice — Komodo Edit. First of all, I include all the fancy stuff from CGI, but in fact I am using just the :standard, :form and :html extensions. I’m printing the heading, otherwise the browser will spit an Internal Server Error. Next, I’m starting the form, no html, head or body rubbish. I’m printing the submit button and a textfield using the mentioned :form extension.

After that, I handle the possible message. I’m using a regular expression to analyze it, looking for the PIN. If found, I append the message at the beginning of the file, adding a hrizontal line to make it look readable. At the same time, I push all the file contents to a $f variable. I use it then to overwrite the database file, so the messages don’t get lost. And that’s it.

Now, again — I dare you, make something better, shorter, fancier! The rules are simple: whatever language you choose, whatever module or library you include, as long as it’s standard, it’s good. But share your webapp in the comments, even if they bend the rules — it will be interesting. The challenge is on. So are you skilled enough for this? Bring it on! And follow me.

Originally published at web.archive.org.

m

Written by

m

Full-stack developer & free-time designer. Oxford ComLab alumni.

f055

f055

f055 blog — 10 years later. Brought back from the dead thanks to the Internet Archive: https://web.archive.org/web/20120228052238/http://f055.net:80/

m

Written by

m

Full-stack developer & free-time designer. Oxford ComLab alumni.

f055

f055

f055 blog — 10 years later. Brought back from the dead thanks to the Internet Archive: https://web.archive.org/web/20120228052238/http://f055.net:80/

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store