Skip to content

Instantly share code, notes, and snippets.

@guibranco
Last active December 15, 2023 15:42

Revisions

  1. guibranco revised this gist Sep 2, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion generateHTMLfromJSON.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ const jsonData = pm.response.json();
    const divPattern = "<div style=\"margin-top: 10px;\">";
    const imageUrl = (item) => `https://github-readme-stats-guibranco.vercel.app/api/pin/?username=${item.organization.login}&amp;repo=${item.name}&amp;theme=dark&amp;bg_color=222222&amp;show_owner=true&amp;show_forks=false&amp;show_issues=true`;
    const link = (item) => `<a href="${item.url}" target="_blank">${image(item)}</a>`;
    const image = (item) => `<img style="min-height: 150px; padding-right: 10px;" src="${imageUrl(item)}" alt="${item.full_name}" />`;
    const image = (item) => `<img style="min-height: 100px; padding-right: 10px;" src="${imageUrl(item)}" alt="${item.full_name}" />`;
    var html = divPattern;

    for(let i = 0; i < jsonData.length; i++){
  2. guibranco created this gist May 26, 2023.
    19 changes: 19 additions & 0 deletions generateHTMLfromJSON.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    const jsonData = pm.response.json();
    const divPattern = "<div style=\"margin-top: 10px;\">";
    const imageUrl = (item) => `https://github-readme-stats-guibranco.vercel.app/api/pin/?username=${item.organization.login}&amp;repo=${item.name}&amp;theme=dark&amp;bg_color=222222&amp;show_owner=true&amp;show_forks=false&amp;show_issues=true`;
    const link = (item) => `<a href="${item.url}" target="_blank">${image(item)}</a>`;
    const image = (item) => `<img style="min-height: 150px; padding-right: 10px;" src="${imageUrl(item)}" alt="${item.full_name}" />`;
    var html = divPattern;

    for(let i = 0; i < jsonData.length; i++){

    html += link(jsonData[i]);

    if(i % 2 !== 0){
    html += "</div>" + divPattern;
    }
    }

    html += "</div>";

    console.log(html);