I had been using http://ideone.com/ for quite sometime. Since I do a lot of competitive programming, I tend to compile all my codes on Ideone and debugging before submission. Ideone is an online compiler and debugging tool which allows you to compile source code and execute it online in more than 60 programming languages. One can create an account where it will store all his/her code links and can access them whenever I want.

But one day a friend of mine decided to backup all his codes to access his codes during competitions without internet access. There are backup tools for sites like SPOJ etc. But how to do that on Ideone !? All his submissions were there.

I noticed one can download codes one by one using download button but doing that for 600+ codes would be tiresome! Also Ideone APIs don't allow users to download codes. How to do it? I inspected a little and wrote two lines of code to extract all the IDs using JS and wrote a python script to download that for a particular page on http://ideone.com/myrecent .It worked! It downloaded all my codes one by one. Took just 10 minutes to code. But then it was restricted to single page and required switching between Python and JS. There was great need of improvement.

Thought a little and wrote 6 lines of JS code for single page which removed the dependency on Python. Pretty cool right? Seemed like job done. Code worked smoothly. I was able to download all my codes on single page almost instantly when I realized I would have to do the same for next 25 pages. Copy paste code for next 25 pages was another tiresome work!

Little more inspection and I noticed it was getting all my links my making AJAX calls which means page was not being refreshed. I can automate it further to go to next page and download all my codes on that page. So I extended my code which visited each page and downloaded all the codes eliminating the need of copy pasting it on each page. Job done! 18 lines of JS code doing its magic! Copy, paste , press enter and watch it download all the codes!

During this journey of reducing code I found there is a great need of this feature of downloading codes when I found this: http://qr.ae/EFgFG Nice feeling to have a top answer. More importantly first one to find the solution for the same.

I had open sourced it so anyone could use it whenever he/she wants to create a backup. https://github.com/ManrajGrover/Ideone-Solutions-Downloader

For me, automating it for all pages was a challenging and I am most proud of this feature.

Here is the demo: http://manraj.collegespace.in/ideone/video.mp4

Here is the 18 lines of code:

var list=$('ul[class="dropdown-menu "]')[0].children.length;
var download=function(){
    if(list>0){
        list--;
        var input=$('.link');
        for(var i=0;i<input.length;i++){
            var len=input[i].length;
            var sliced=input[i].getAttribute('href').slice(1,len);
            window.open("http://ideone.com/plain/"+sliced);
            setTimeout(function(){console.log("Testing: "+i);},1000);
        }
        $('.icon-angle-right').click();
    }
    else{
        clearInterval(download);
    }
};
setInterval(download,10000);

Built With

Share this project:

Updates