Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Add contributions map as an option #30

Open
hacdias opened this issue Jun 1, 2016 · 0 comments
Open

Add contributions map as an option #30

hacdias opened this issue Jun 1, 2016 · 0 comments

Comments

@hacdias
Copy link
Member

hacdias commented Jun 1, 2016

Base code to convert to PHP:

/* Github Calendar */
var username = "hacdias";
var url = "https://github.com/" + username;

var fetchCalendar = () => httpsRequest(url, (body) => {
  let $ = cheerio.load(body);
  let cal = $("#contributions-calendar");
  $("#contributions-calendar .left.text-muted").html(`Summary of pull requests, issues opened, and commits made by <a href="https://github.com/${username}" target="blank">@${username}</a>`);

  if (cal.find("include-fragment").length) {
    setTimeout(fetchCalendar, 500);
  } else {
    let h = $('.js-calendar-graph-svg').attr('height');
    let w = $('.js-calendar-graph-svg').attr('width');
    $('.js-calendar-graph-svg').attr('viewBox', '0 0 ' + w + ' ' + h);
    fs.writeFile("layouts/partials/github.html", $("#contributions-calendar").html());
  }
});

fetchCalendar();
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant