PageSourceSearch

https://qerub.github.io/main.js

js qerub.github.io collected 2026-10-03 09:48:04 UTC 3,619 bytes, 123 lines download raw bytes

1/** @jsx defsoftware.HTML.makeElement */
2var GitHubAPI = function (path) {
3    return $.getJSON("https://api.github.com/" + path + "?callback=?").then(function (response) {
4        return response.meta.status == 200 ? $.Deferred().resolve(response.data) : $.Deferred().reject(response.data.message);
5    });
6};
7var truncate = function (s, n) {
8    return s.length > n ? s.slice(0, n - 1) + "…" : s;
9};
10function main() {
11    var repoContainer, gistContainer;
12    var body = defsoftware.HTML.makeElement(
13        "div",
14        null,
15        defsoftware.HTML.makeElement(
16            "h1",
17            null,
18            defsoftware.HTML.makeElement(
19                "a",
20                { href: "http://qerub.se/" },
21                "My Personal Website"
22            )
23        ),
24        defsoftware.HTML.makeElement(
25            "h1",
26            null,
27            defsoftware.HTML.makeElement(
28                "a",
29                { href: "https://www.openhub.net/accounts/qerub/positions" },
30                "My Page on Open Hub"
31            )
32        ),
33        defsoftware.HTML.makeElement(
34            "h1",
35            null,
36            defsoftware.HTML.makeElement(
37                "a",
38                { href: "https://github.com/qerub" },
39                "My GitHub Repositories"
40            )
41        ),
42        repoContainer = defsoftware.HTML.makeElement(
43            "p",
44            null,
45            defsoftware.HTML.makeElement(
46                "em",
47                null,
48                "Loading\u2026"
49            )
50        ),
51        defsoftware.HTML.makeElement(
52            "h1",
53            null,
54            defsoftware.HTML.makeElement(
55                "a",
56                { href: "https://gist.github.com/qerub" },
57                "My Gists"
58            )
59        ),
60        gistContainer = defsoftware.HTML.makeElement(
61            "p",
62            null,
63            defsoftware.HTML.makeElement(
64                "em",
65                null,
66                "Loading\u2026"
67            )
68        )
69    );
70    $(document.body).append(body);
71    var makeRepoListItem = function (repo) {
72        return defsoftware.HTML.makeElement(
73            "li",
74            null,
75            defsoftware.HTML.makeElement(
76                "a",
77                { href: repo.html_url },
78                defsoftware.HTML.makeElement(
79                    "strong",
80                    null,
81                    repo.name,
82                    ":"
83                ),
84                " ",
85                repo.description
86            )
87        );
88    };
89    GitHubAPI("users/qerub/repos").then(function (data) {
90        var repos = data.filter(function (x) {
91            return !x.fork;
92        });
93        $(repoContainer).html(defsoftware.HTML.makeElement(
94            "ul",
95            null,
96            repos.map(makeRepoListItem)
97        ));
98    }).fail(function (message) {
99        return $(repoContainer).text("Error: " + message);
100    });
101    var makeGistListItem = function (gist) {
102        return defsoftware.HTML.makeElement(
103            "li",
104            null,
105            defsoftware.HTML.makeElement(
106                "a",
107                { href: gist.html_url },
108                truncate(gist.description, 100)
109            )
110        );
111    };
112    GitHubAPI("users/qerub/gists").then(function (data) {
113        return $(gistContainer).html(defsoftware.HTML.makeElement(
114            "ul",
115            null,
116            data.map(makeGistListItem)
117        ));
118    }).fail(function (message) {
119        return $(gistContainer).text("Error: " + message);
120    });
121}
122$(main);
123//# sourceMappingURL=main.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.