Added support for public sample testcases.

Contestants can view testcases marked as sample as well as their
program output on these cases.

WARNING: this can and will leak information about the problem like
timelimit and more.

Cherry-picked from: 177a655d
Add option to enable teams to see sample testcase run output.
Also clean up rankcache_* tables when refreshing cache.
Update comments for support of HTTP methods, simplify code
and break up some long lines. No functional change.
Remove essentially duplicate argument 'callback' in
RestAPI.provideFunction().