doubledispatch <- function(x,y) {
z <- list()
z_classes <- expand.grid(
cl_x=class(x),
cl_y=class(y)
)
z_classes$cl_z <- paste0(
z_classes$cl_x,
"_",
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reprex::reprex({ | |
library(DelayedArray) | |
x <- DelayedArray(matrix(1L, nrow = 2, ncol = 1)) | |
colnames(x) <- "potato" | |
# wrong: | |
df <- as.data.frame(x, drop = TRUE) | |
colnames(df) | |
# workaround: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Demo inconsistency" | |
author: "" | |
date: "" | |
output: html_document | |
--- | |
```{r Chunk1} | |
Sys.sleep(5) | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# udev rule | |
# Mount USB drive to the media directory using the partition name as mount point | |
# | |
# Description: | |
# Created for Home Assistant OS, this rule mounts any USB drives | |
# into the Hassio media directory (/mnt/data/supervisor/media). | |
# When a USB drive is connected to the board, the rule creates one directory | |
# per partition under the media directory. The newly created partition is named | |
# as the partition name. If the partition does not have a name, then the following |
Referencial transparency is a property of most programming languages, where the name of the variables does not affect the outcome.
Let's start with a simple example:
add1 <- function(variable) {
return(variable + 1)
}
add1(1)
I hereby claim:
- I am zeehio on github.
- I am zeehio (https://keybase.io/zeehio) on keybase.
- I have a public key whose fingerprint is 40B1 F8F3 B43C F786 4ED1 A0B6 20DA 0569 6BEB 2330
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def _clamp(x, min, max): | |
if x < min: | |
return min | |
if x > max: | |
return max | |
return x | |
def _read_cpu_quota_limit_cgroup(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Untitled" | |
author: "test" | |
date: "17/7/2020" | |
output: html_document | |
--- | |
```{r} | |
xy <- tibble::tibble( | |
y = c(1, 2, 3, 4, 5, 6), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Plots in WebGL | |
#' @param plt A plot created with plotly or ggplot2 | |
#' @param html_filename The file name where the plot will be saved | |
#' | |
#' @return The html_filename | |
#' @export | |
#' | |
plot_interactive <- function(plt, html_filename) { | |
htmltools::save_html( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Moodle provides a backup system for courses offering an mbz file. This is a zip file with | |
all the resources and files included and the needed metadata about the files encoded in XML. | |
This script gets an unzipped mbz directory and copies all the files from the course into | |
a directory tree with the same layout than the original moodle course. | |
unzip my_moodle_backup.zip | |
extract_moodle_files.py --source my_moodle_backup_FILES --destination sorted_course |
NewerOlder