u8views / go-u8views

GitHub-profile views tracker: displaying monthly view statistics
https://u8views.com
MIT License
635 stars 6 forks source link

Alternatives #14

Open YaroslavPodorvanov opened 1 year ago

YaroslavPodorvanov commented 1 year ago

Tags

  1. https://github.com/topics/profile-readme
  2. https://github.com/topics/badge

Repositories

  1. https://github.com/anuraghazra/github-readme-stats
  2. https://github.com/cascandaliato/leetcode-badge
  3. https://github.com/badges/shields https://shields.io/
  4. https://github.com/jwenjian/visitor-badge https://visitor-badge.glitch.me/

Projects

  1. https://visitorbadge.io/
YaroslavPodorvanov commented 11 months ago
SELECT pg_size_pretty(pg_total_relation_size('profile_hourly_views_stats')) AS total_size,
       pg_size_pretty(pg_relation_size('profile_hourly_views_stats')) AS data_size,
       pg_size_pretty(pg_total_relation_size('profile_hourly_views_stats') - pg_relation_size('profile_hourly_views_stats')) AS index_size;
 total_size | data_size | index_size 
------------+-----------+------------
 3280 kB    | 1904 kB   | 1376 kB
 total_size | data_size | index_size 
------------+-----------+------------
 3528 kB    | 2040 kB   | 1488 kB
 total_size | data_size | index_size 
------------+-----------+------------
 3608 kB    | 2088 kB   | 1520 kB
 total_size | data_size | index_size 
------------+-----------+------------
 9912 kB    | 5744 kB   | 4168 kB
 total_size | data_size | index_size 
------------+-----------+------------
 12 MB      | 7144 kB   | 5088 kB
YaroslavPodorvanov commented 10 months ago
SELECT
    DATE_TRUNC('month', time),
    COUNT(*),
    COUNT(DISTINCT(user_id)),
    SUM("count")
FROM profile_hourly_views_stats
GROUP BY 1
ORDER BY 1;
 2023-01-01 00:00:00 |    15 |     3 |    78
 2023-02-01 00:00:00 |   438 |    18 |  2700
 2023-03-01 00:00:00 |   951 |    32 | 10241
 2023-04-01 00:00:00 |  1110 |    36 |  3441
 2023-05-01 00:00:00 |  2191 |    43 |  9032
 2023-06-01 00:00:00 |  3433 |    57 | 16866
 2023-07-01 00:00:00 |  3331 |    54 | 14233
 2023-08-01 00:00:00 |  4539 |    69 | 18017
 2023-09-01 00:00:00 |  4519 |    77 | 17053
 2023-10-01 00:00:00 |  4473 |    78 | 15771
 2023-11-01 00:00:00 |  4919 |    96 | 17567
 2023-12-01 00:00:00 |  5525 |   115 | 19882
 2024-01-01 00:00:00 | 11185 |   232 | 40202
 2024-02-01 00:00:00 | 11348 |   245 | 39586
 2024-03-01 00:00:00 | 13581 |   273 | 48629
 2024-04-01 00:00:00 | 13613 |   291 | 47198
 2024-05-01 00:00:00 | 14655 |   306 | 50581
 2024-06-01 00:00:00 | 13924 |   319 | 57695
YaroslavPodorvanov commented 6 months ago
document.body.addEventListener("keyup", function(e) {
    // if key is "Ctrl + E" then execute the code
    if (e.ctrlKey && e.key === "e") {
        document.querySelectorAll(".reusable-search__result-container").forEach(function ($element) {
            if ($element.querySelector(".artdeco-button__text").innerHTML.indexOf("Connect") === -1) {
                $element.remove();
            }
        });
    }
});
YaroslavPodorvanov commented 6 months ago
{
    function prepare() {
        document.querySelectorAll(".reusable-search__result-container").forEach(function ($element) {
            if ($element.querySelector(".artdeco-button__text").innerHTML.indexOf("Connect") === -1) {
                $element.remove();

                return;
            }

            const $title = $element.querySelectorAll("a[data-test-app-aware-link='']")[1];

            if ($title.parentNode.querySelector("a.u8views-github-link") !== null) {
                return;
            }

            const $name = $title.querySelector("span[dir='ltr'] span[aria-hidden='true']");
            if ($name === null) {
                return;
            }

            const $link = document.createElement("a");

            {
                const baseUrl = 'https://github.com/search';
                const query = `"${$name.innerText}" OR "${$name.innerText.replace(/\s+/g, '')}" OR "${$name.innerText.replace(/\s+/g, '-')}"`;

                $link.href = `${baseUrl}?q=${encodeURIComponent(query)}&type=users`;
                $link.className = "u8views-github-link";

                const $linkName = document.createElement("span");
                $linkName.innerText = "Search on GitHub";
                $link.append($linkName);
            }

            $title.parentNode.append($link);
        });
    }

    document.body.addEventListener("keyup", function (e) {
        // if key is "Ctrl + E" then execute the code
        if (e.ctrlKey && e.key === "e") {
            prepare();
        }
    });
}
YaroslavPodorvanov commented 4 months ago
{
    function prepare() {
        document.querySelectorAll(".mn-connection-card.artdeco-list").forEach(function ($element) {
            const $name = $element.querySelectorAll(".mn-connection-card__name")[0];

            if ($name.parentNode.querySelector("a.u8views-github-link") !== null) {
                return;
            }

            const $link = document.createElement("a");

            {
                const baseUrl = 'https://github.com/search';
                const query = `"${$name.innerText}" OR "${$name.innerText.replace(/\s+/g, '')}" OR "${$name.innerText.replace(/\s+/g, '-')}"`;

                $link.href = `${baseUrl}?q=${encodeURIComponent(query)}&type=users`;
                $link.className = "u8views-github-link";

                const $linkName = document.createElement("span");
                $linkName.innerText = "Search on GitHub";
                $link.append($linkName);
            }

            $name.parentNode.append($link);
        });
    }

    document.body.addEventListener("keyup", function (e) {
        // if key is "Ctrl + E" then execute the code
        if (e.ctrlKey && e.key === "e") {
            prepare();
        }
    });
}
YaroslavPodorvanov commented 4 months ago
{
    function getElementByInnerText(selector, text) {
        const $elements = document.querySelectorAll(selector);
        for (const $element of $elements) {
            if ($element.textContent.trim() === text) {
                return $element;
            }
        }
        return null;
    }

    document.body.addEventListener("keyup", function(e) {
        // if key is "Ctrl + E" then execute the code
        if (e.ctrlKey && e.key === "e") {
            let $element = getElementByInnerText('.artdeco-button__text', 'Unfollow');
            if ($element === null) {
                $element = getElementByInnerText('.artdeco-button__text', 'Following');
            }
            if ($element === null) {
                return;
            }

            $element.click();
        }
    });
}
{
    function getElementByInnerText(selector, text) {
        const $elements = [...document.querySelectorAll(selector)].filter(function ($element) {
            return $element.textContent.trim() === text;
        });

        if ($elements.length > 0) {
            return $elements[Math.floor(Math.random() * $elements.length)];
        }

        return null;
    }

    document.body.addEventListener("keyup", function(e) {
        // if key is "Ctrl + E" then execute the code
        if (e.ctrlKey && e.key === "e") {
            let $element = getElementByInnerText('.artdeco-button__text', 'Unfollow');
            if ($element === null) {
                $element = getElementByInnerText('.artdeco-button__text', 'Following');
            }
            if ($element === null) {
                return;
            }

            $element.click();
        }
    });
}
{
    const followingSequence = {
        index: 0,
        $elements: []
    };

    function getElementByInnerText(selector, text, sequence) {
        if (sequence !== null) {
            if (sequence.$elements.length === 0 || sequence.index >= sequence.$elements.length) {
                sequence.index = 0;
                sequence.$elements = [...document.querySelectorAll(selector)].filter(function ($element) {
                    return $element.textContent.trim() === text;
                });
            }

            if (sequence.index < sequence.$elements.length) {
                const $element = sequence.$elements[sequence.index];

                sequence.index++;

                return $element;
            }

            return null;
        }

        const $elements = document.querySelectorAll(selector);
        for (const $element of $elements) {
            if ($element.textContent.trim() === text) {
                return $element;
            }
        }
        return null;
    }

    document.body.addEventListener("keyup", function (e) {
        // if key is "Ctrl + E" then execute the code
        if (e.ctrlKey && e.key === "e") {
            let $element = getElementByInnerText('.artdeco-button__text', 'Unfollow', null);
            if ($element === null) {
                $element = getElementByInnerText('.artdeco-button__text', 'Following', followingSequence);
            }
            if ($element === null) {
                return;
            }

            $element.click();
        }
    });
}
{
    const followingSequence = {
        index: 0,
        $elements: []
    };

    function getElementByInnerText(selector, text, sequence) {
        if (sequence !== null) {
            if (sequence.$elements.length === 0 || sequence.index >= sequence.$elements.length) {
                sequence.index = 0;
                sequence.$elements = [...document.querySelectorAll(selector)].filter(function ($element) {
                    return $element.textContent.trim() === text;
                });
            }

            if (sequence.index < sequence.$elements.length) {
                const $element = sequence.$elements[sequence.index];

                sequence.index++;

                return $element;
            }

            return null;
        }

        const $elements = document.querySelectorAll(selector);
        for (const $element of $elements) {
            if ($element.textContent.trim() === text) {
                return $element;
            }
        }
        return null;
    }

    document.body.addEventListener("keyup", function (e) {
        // if key is "Ctrl + E" then execute the code
        if (e.ctrlKey && e.key === "e") {
            let $element = getElementByInnerText('.artdeco-button__text', 'Unfollow', null);
            if ($element === null) {
                $element = getElementByInnerText('.artdeco-button__text', 'Following', followingSequence);
            }
            if ($element === null) {
                return;
            }

            $element.click();
        }
    });
}