Here’s a little widget I developed to show the ProjectEuler score on any web page, like the one seen on the right side of this page. To use it on your web page or blog, all you have to do is to insert the following snippet.
How does it work?
The script first generates the HTML markup required for displaying the score (including the “loading..” image). After that, it communicates with my server (geekraj.com) to get the score for the specified id. Normally, browsers enforce Same Origin Policy, and hence would not be able to make a connection to my server. However, there are a few ways around it. I used a technique called dynamic script tag generation.
On the backend, I run a PHP script which logs into projecteuler.net and retrieves the score for the given id. To make it easy on their server, I also do some caching. So please note that the updates are delayed by 10 minutes.
I’m planning to add more features like level display, style customization etc. The release timeline for this would depend on the spare time I have and how many people need it. Your feedback would be greatly appreciated!