Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

490
Views
How can I add code from Github into my Codepen project?

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!)

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!