Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

494
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda