Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternatives #14

Open
YaroslavPodorvanov opened this issue Feb 10, 2023 · 6 comments
Open

Alternatives #14

YaroslavPodorvanov opened this issue Feb 10, 2023 · 6 comments
Assignees

Comments

@YaroslavPodorvanov YaroslavPodorvanov self-assigned this Feb 10, 2023
@YaroslavPodorvanov
Copy link
Contributor Author

YaroslavPodorvanov commented Dec 28, 2023

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
Copy link
Contributor Author

YaroslavPodorvanov commented Jan 14, 2024

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

This comment was marked as duplicate.

@YaroslavPodorvanov
Copy link
Contributor Author

YaroslavPodorvanov commented May 16, 2024

{
    function prepare() {
        document.querySelectorAll(".search-results-container ul li").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
Copy link
Contributor Author

YaroslavPodorvanov commented Jun 26, 2024

{
    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
Copy link
Contributor Author

YaroslavPodorvanov commented Jul 18, 2024

{
    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();
        }
    });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant