Some time ago, I was talking to a colleague of mine at a company event. While we were there talking, one of us popped the following question:
What’s the latest totally crazy thing that you hacked together in your spare time, which was a totally whacked thing to do as a professional developer, where normally all your alarm bells and whistles would be going of the chart, but totally carried you away at that exact moment and had boatloads of fun doing?
We exchanged several (war) stories. In the end, the conclusion of this conversation was how much fun we had doing these crazy things and how much we learned.
I want to share one of my stories. It’s not as crazy as creating your own database on top of Git, or creating your own operating system using just regular expressions. But still, it’s one of my numerous conquests.
A couple of years ago I created a website for my son’s soccer team. One of my weekly routines is publishing all the games that need to be played by all the teams of the soccer club. These games are all published at the beginning of the season on the website of the Belgian soccer league. During the season, the soccer league regularly posts new updates on their website without mentioning exactly what they changed. In order to save some work, I wanted to create a small tool just for me that I could run on weekly basis to retrieve all the data that I wanted, format it into HTML and automatically post on the website. I noticed that the website of the soccer league was using a Java applet that captured all the input and showed the games accordingly for a single team. So on one evening, I hacked together a small node.js script that would drive this Java applet (using request) and scrape the data that I needed (using cheerio), then output the data in HTML and automatically upload the HTML file to the new website using the Git command-line.
I had so much fun doing this. I was taking every shortcut I could make in order to get what I wanted. No unit tests, no code analysis, no design, no nothing. Just code. I started using this tool week after week, expecting it to stop working any time soon because some developer would make changes to the Java applet or something. The funny thing is that I’ve been using this tool for almost three years now without ever breaking down on me. I still didn’t polish it, or made it more “professional”. Heck, I still need to change it every week just to fill in the dates.
While I would highly protest doing something like this on the job, I recommend doing this kind of stuff all the time during your spare time. We should consider learning a new programming language, some new technology or a new tool as a free pass for doing crazy things with it. We should allow ourselves some time besides work to hack on as many things as possible, without commitment, deadlines or other hassles. Just releasing our brains into the wild and who knows with what we might end up with.
What’s the latest and greatest that you hacked together?
We have a fix timetable for our courses at my university. But the timetable is only HTML. So I wrote a “parser” (say scapper) to extract the data from the timetable page and generated a .cal file to import the courses into my google calendar.
Because of the strange structure of the timetable page I had to inject some JavaScript to the code and get the box frame of some elements to calculate the time of the course. Awesome! Will break eventually but still a perfect solution 😉
That was really fun to write. After that I also hacked a tool to download all course materials from our elearning platform.
Nice one!
I once wrote a screen scraper using perl regular expressions that drove the “live” draft announcements data during the NFL draft event. This worked for ESPN at one point in its history when I worked on the site.
Fun, though? I wrote a little space invaders style game in Scratch.
Nice!
I’m in a couple bands, and when we have a show to promote, I write up a script (FB updates their code frequently) that invites every single one of my 2000 friends without me doing anything. Last time I tried it, FB changed up the layout so inviting 2000 at once does lock the browser, so I have to do it in 500 friend burts. The code is only a couple lines, but I love telling my friends about it (and I also enjoy the sarcastic remarks from friends across the country who get mad that I invited them.)
You could incorporate the Google Maps API to only invite folks that live nearby the place that you’re playing at :-).
Would there be a reasonable way to do that via console? I’m just whipping it up in console right now
The latest was definitely not the greatest, but it works very fine: a tool to scrape the contents of an intranet-page that lists our time-clock times (when we started working, stopped, lunch-time,…) As consultants, there are certain rules we must adhere to, but the existing intranet-page didn’t really help in seeing if you were doing enough hours. Or you had to manually calculate it all. So we wrote a webscraper to give an overview.
Something you forget to mention, I believe, is that working this way does point out how easily you can end up with a hard-to-maintain codebase, as is in our case. It works now, but the last few features/changes that were added were very hard to do 🙂 It reminds us on the importance of clean code, tests,…
In a Unix shell, you could create a separate command-line tool from/to which you could pipe data … Not sure how that would go in Windows.
Good point! I did mention it casually in the blog post, but we do need decent quality code with tests, CI, etc. … most of the time for those applications with a serious lifespan and/or applications for which the requirements change a lot. Doing this “hacking stuff” is great for home projects in order to move fast and live up on the time constraints associated with it. This let’s you have a taste of both worlds. In case your day job only involves hacking stuff together and making big mess all the time, you might want to do the opposite at home (writing tests, CI, quality code, etc. …). This way you quickly realise to get out of your day job fast! 🙂
Since Youtube is blocked at work I use a external server (codeanywhere) and make the youtube request to it. Then the external server sent the response received from youtube to me as html code. As codeanywhere servers aren’t blocked i was able to get the youtube response and watch Youtube in work. Just don’t tell the boss.