forked from ketch/labnotebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.html
169 lines (129 loc) · 6.02 KB
/
code.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
---
layout: none
title: Code
subtitle: Getting science done
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{ title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="My open lab notebook">
<meta name="author" content="David Ketcheson">
<!-- Le styles -->
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Quattrocento+Sans:bold,bolditalic,italic|Quattrocento+Sans">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Rosario:bold,bolditalic,italic|Rosario">
<link href="{{ site.url }}/assets/css/light.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{{ site.url }}/assets/css/grid.css">
<link rel="stylesheet" type="text/css" href="{{ site.url }}/assets/css/style.css">
<!-- Le javascript -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" ></script>
<script type="text/javascript" src="{{ site.url }}/assets/js/strftime.js"></script>
<script type="text/javascript">
(function ($, undefined) {
// Put custom repo URL's in this object, keyed by repo name.
var repoUrls = {
};
// Put custom repo descriptions in this object, keyed by repo name.
var repoDescriptions = {
};
function repoUrl(repo) {
return repoUrls[repo.name] || repo.html_url;
}
function repoDescription(repo) {
return repoDescriptions[repo.name] || repo.description;
}
function addRecentlyUpdatedRepo(repo) {
var $item = $("<li>");
var $name = $("<a>").attr("href", repo.html_url).text(repo.name);
$item.append($("<span>").addClass("name").append($name));
var $time = $("<a>").attr("href", repo.html_url + "/commits").text(strftime("%h %e, %Y", repo.pushed_at));
$item.append($("<span>").addClass("time").append($time));
$item.append('<span class="bullet">⋅</span>');
var $open_issues = $("<a>").attr("href", repo.html_url + "/open_issues").text(repo.open_issues + " open_issues");
$item.append($("<span>").addClass("open_issues").append($open_issues));
var $watchers = $("<a>").attr("href", repo.html_url + "/watchers").text(repo.watchers + " watchers");
$item.append($("<span>").addClass("watchers").append($watchers));
$item.append('<span class="bullet">⋅</span>');
var $forks = $("<a>").attr("href", repo.html_url + "/network").text(repo.forks + " forks");
$item.append($("<span>").addClass("forks").append($forks));
$item.appendTo("#recently-updated-repos");
}
function addRepo(repo) {
var $item = $("<li>").addClass("repo rep " + (repo.language || '').toLowerCase());
var $link = $("<a>").attr("href", repoUrl(repo)).appendTo($item);
$link.append($("<h2>").text(repo.name));
$link.append($("<h3>").text(repo.watchers + " watchers" + " / " + repo.open_issues + " open issues"));
$link.append($("<p style='line-height:1em;'>").text(repoDescription(repo)));
$link.append($("<p style='line-height:1em;'>").text("Updated " +
strftime("%h %e, %Y", repo.pushed_at)));
$link.append($("<h3>").addClass("language").text(repo.language));
$item.appendTo("#repos");
}
$.getJSON("https://api.github.com/users/ketch/repos?per_page=100&callback=?", function (result) {
var repos = result.data;
$(function () {
$("#num-repos").text(repos.length);
// Convert pushed_at to Date.
$.each(repos, function (i, repo) {
repo.pushed_at = new Date(repo.pushed_at);
var weekHalfLife = 1.146 * Math.pow(10, -9);
var pushDelta = (new Date) - Date.parse(repo.pushed_at);
var createdDelta = (new Date) - Date.parse(repo.created_at);
var weightForPush = 1;
var weightForWatchers = 1.314 * Math.pow(10, 7);
repo.hotness = weightForPush * Math.pow(Math.E, -1 * weekHalfLife * pushDelta);
repo.hotness += weightForWatchers * repo.watchers / createdDelta;
});
// Sort by highest # of watchers.
repos.sort(function (a, b) {
if (a.hotness < b.hotness) return 1;
if (b.hotness < a.hotness) return -1;
return 0;
});
$.each(repos, function (i, repo) {
addRepo(repo);
});
// Sort by most-recently pushed to.
repos.sort(function (a, b) {
if (a.pushed_at < b.pushed_at) return 1;
if (b.pushed_at < a.pushed_at) return -1;
return 0;
});
$.each(repos.slice(0, 3), function (i, repo) {
addRecentlyUpdatedRepo(repo);
});
});
});
})(jQuery);
</script>
</head>
<body>
{% include navbar.html %}
<div class="container"> <!-- Twitter bootstrap has all body content in a container -->
<header class="jumbotron subhead">
<h1 class="entry-title">{{ page.title }}</h1>
<p>{{ page.subtitle }}</p>
</header>
<div id="wrapper" class="grid clearfix">
<div id="main" class="grid-1">
<div><h1>David Ketcheson's Projects</h1></div>
<p> This is an automated index to Github repositories for my open source software projects.</p>
</div>
<div class="grid grid-3">
<div id="statistics" class="grid-1 alpha header">
<h1>Statistics</h1>
<p> <a href="https://github.com/ketch/repositories"><span id="num-repos"> </span> public repos</a> </p>
<p><a href="https://github.com/ketch">https://github.com/ketch</a></p>
</div>
<div id="recently-updated" class="grid-2 omega header">
<h1>Recently updated <a href="https://github.com/ketch/repositories">View All on GitHub</a></h1>
<ol id="recently-updated-repos"></ol>
</div>
</div>
<ol id="repos"></ol>
</div>
<!-- </body>
</html> -->
{% include footer.html %}