Skip to content

Instantly share code, notes, and snippets.

@jmakeig
Created November 15, 2014 08:26
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 jmakeig/b9397e7f57244f0b43b5 to your computer and use it in GitHub Desktop.
Save jmakeig/b9397e7f57244f0b43b5 to your computer and use it in GitHub Desktop.
Load Jeopardy data
declareUpdate();
// Hopefully this link doesn't go away.
var loc="https://doc-0s-1s-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/108nt093kbmcafeksihop0r1pcmkkvtr/1416031200000/14044389733472591834/*/0BwT5wj_P7BKXb2hfM3d2RHU1ckE?e=download";
var qs=xdmp.documentGet(loc, {format: "json"});
var shows = {};
qs.next().value.toObject().forEach(
function(q) {
shows["" + q.show_number] = (shows["" + q.show_number]) ? shows["" + q.show_number] + 1 : 1;
var uri = "/" + q.show_number + "_" + shows["" + q.show_number] + ".json";
// Has no one actually watched the show?
var question = q.answer;
q.answer = q.question;
q.question = question;
xdmp.documentInsert(uri, q, xdmp.defaultPermissions(), ["jeopardy"]);
}
);
shows;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment