-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcourses.qmd
88 lines (70 loc) · 2.21 KB
/
courses.qmd
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
## Courses I teach and their material
Here are the courses I teach in a table. Of course they are all on [glittr.org](https://glittr.org)!
Are you interested in (more) SIB courses, check out the [course announcement page](https://www.sib.swiss/training/upcoming-training-courses).
```{r}
#| output: false
#| echo: false
library(httr2)
library(DT)
library(fontawesome)
```
```{r}
#| echo: false
parsed <- request("https://glittr.org/api/repositories") |>
req_perform() |>
resp_body_json()
```
```{r}
#| echo: false
slug_to_link <- function(slug){
link <- paste0("https://github.com/", slug)
html <- sprintf('<a href="%s" target="_blank">%s</a>',
link, slug)
return(html)
}
# pretty format stargazers
format_stargazers <- function(stargazers_count){
# sort_string <- formatC(stargazers_count, width = 12,
# format = "d", flag = "0")
star_icon <- fa("star")# icon("star", lib = "glyphicon", style="color:#f1c40f")
stargazers_string <- paste(# "<!--", sort_string, "-->",
as.character(star_icon),
stargazers_count)
return(stargazers_string)
}
```
```{r}
#| echo: false
# extract relevant items as dataframe
repo_info_list <- lapply(parsed$data, function(x) data.frame(
repo = x$name,
stargazers = x$stargazers
))
repo_info <- do.call(rbind, repo_info_list)
```
```{r}
#| echo: false
my_repos <- c(
"sib-swiss/single-cell-training",
"sib-swiss/ena-seqdata-training",
"sib-swiss/containers-introduction-training",
"sib-swiss/single-cell-python-training",
"sib-swiss/NGS-introduction-training",
"sib-swiss/NGS-longreads-training",
"sib-swiss/NGS-variants-training",
"sib-swiss/containers-snakemake-training",
"sib-swiss/reproducible-analysis-training",
"sib-swiss/spatial-transcriptomics-training"
)
```
```{r}
#| echo: false
repo_info <- repo_info[repo_info$repo %in% my_repos, ]
rownames(repo_info) <- repo_info$repo
repo_info$repo <- slug_to_link(repo_info$repo)
repo_info$stargazers <- format_stargazers(repo_info$stargazers)
datatable(repo_info, style = "bootstrap", rownames = FALSE,
options = list(dom = 't'),
escape = FALSE) |>
formatStyle(columns = "stargazers", color="gold")
```