Skip to content

Instantly share code, notes, and snippets.

@glefait
Last active April 12, 2019 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glefait/81bb20a32fbca33586b65adf993b0288 to your computer and use it in GitHub Desktop.
Save glefait/81bb20a32fbca33586b65adf993b0288 to your computer and use it in GitHub Desktop.
decode Google Code Competition data
var googleCodeDecode = function (e) {
return JSON.parse(atob(e.replace(/[-_]/g, function(e) { return "-" == e ? "+" : "/" }).replace(/[^A-Za-z0-9\+\/]/g, "")));
}
var googleCodeEncode = function (e) {
return btoa(JSON.stringify(e)).replace(/[+/]/g, function(e) { return "+" == e ? "-" : "_" }).replace(/[^A-Za-z0-9\+\/]/g, "")));
}
params = {"min_rank": 1, "num_consecutive_users": 100};
// url example to get the first 100 results:
// https://codejam.googleapis.com/scoreboard/0000000000051705/poll?p=eyJtaW5fcmFuayI6MSwibnVtX2NvbnNlY3V0aXZlX3VzZXJzIjoxMDB9
// where param p value comes from googleCodeEncode(params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment