I've got a repository with some code that I'd like to incorporate into my Codepen project, however I have no idea how.
What I'm trying to do is get 10 million digits of pi as a variable to use in my project.
Right now my project takes the variable pieIsGood from another Codepen using Ajax using this code:
$.getJSON('http://codepen.io/creativekinetix/pen/PpOOrE.js',jsonLoaded);
var pieIsGood;
function jsonLoaded(data) {
pieIsGood = data.pi;
pieIsGood = pieIsGood.toString()
}
Although this code works, Codepen only allows pens of a certain length (I think it tops out around a million characters). I'd like to find a way to either use the code from this Github gist or this website and turn it into variable pieIsGood to use in my project. I can't use Ajax because anything I do there has to be in the same domain, and Codepen doesn't allow 10 million digits of pi.
Since codepen doesn't allow me to post three links with my current reputation level, here's the broken link. It just needs a : after the http.
http://codepen.io/Random_Pseudonym/pen/EWvdge
Any help is greatly appreciated (I've spent something like ten hours trying to find a solution, I'd be ridiculously grateful to have it solved!)
You can store a JSON file in a gist, for instance this one and include the raw URL in you Ajax request :
$.getJSON('https://gist.githubusercontent.com/bertrandmartel/f8936fcffe7d3fec8c85782f60fd77e9/raw/86e4fce24116005f2748aeacdb5e94624937eb31/pi_digits.json',jsonLoaded);
var pieIsGood;
function jsonLoaded(data) {
pieIsGood = data.pi;
console.log(pieIsGood);
}
You can find a live example here