Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

493
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda