This file contains hidden or 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
# Residuals | |
# See also: http://www.cookbook-r.com/Statistical_analysis/Logistic_regression/ | |
model_iris <- lm(Petal.Width ~ Petal.Length, data = iris) | |
fit <- data.frame(Petal.Width = iris$Petal.Width, | |
residuals = resid(model_iris), | |
fitted = fitted(model_iris)) | |
# Residuals vs. Response variable |
This file contains hidden or 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
-- Resource | |
-- https://github.com/neovim/neovim/blob/master/runtime/doc/api.txt | |
-- Windows | |
vim.api.nvim_list_wins() | |
vim.api.nvim_get_current_win() | |
-- example float window | |
vim.api.nvim_open_win(0, false, {relative='win', row=3, col=3, width=12, height=3}) |
This file contains hidden or 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
-- Plug 'https://github.com/vijaymarupudi/nvim-fzf' | |
-- nnoremap <leader>k <cmd>lua require('fzf_smart_finder').sf()<CR> | |
-- | |
-- Important note: run all `nvim_fzf` functions in coroutine | |
local fzf = require 'fzf'.fzf | |
local action = require 'fzf.actions'.action | |
coroutine.wrap(function() | |
-- items is a table of selected or hovered fzf items |
This file contains hidden or 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
" retirement note: it's too buggy | |
" tree-view | |
let g:netrw_liststyle=3 | |
" don't show help banner | |
let g:netrw_banner=0 | |
" use netrw as 'split windows', not as 'project drawer' | |
" (see https://github.com/tpope/vim-vinegar/) | |
let g:netrw_browse_split=0 | |
let g:netrw_altv=1 |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>My first train drawn with SVG</title> | |
</head> | |
<body> | |
<svg> | |
<rect fill="Firebrick" width="20" height="30" x="10" y="20" /> | |
<rect fill="Firebrick" width="100" height="50" x="0" y="50" /> |
This file contains hidden or 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 tempfile | |
def write_to_temp_file(obj): | |
""" | |
Write an object to a temporary file. The location of the temp file is | |
determined by the OS. | |
Args: | |
obj: a writable object. |
This file contains hidden or 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
<!DOCTYPE html> | |
<!-- | |
Pure CSS tabs (with Flex) | |
Adapted from: | |
- https://codepen.io/renatorib/pen/rlpfj | |
- https://webdevtrick.com/pure-css-tabs-responsive/ | |
--> | |
<html> | |
<head> | |
<meta charset="UTF-8"> |
This file contains hidden or 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
# SQLAlchemy -> ORM (Object Relational Mapper) | |
# | |
# Active record pattern | |
# https://en.wikipedia.org/wiki/Active_record_pattern | |
# | |
# This is equal | |
# part = new Part() | |
# part.name = "Sample part" | |
# part.price = 123.45 | |
# part.save() |
This file contains hidden or 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
## Linear regression R-squared test | |
library(ggplot2) | |
library(patchwork) | |
regressionPlot <- function(df) { | |
mod <- lm(y ~ x, df) | |
mod_rsq <- summary(mod)[["r.squared"]] |
This file contains hidden or 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
## Transform R's numeric to C's double (and vice versa) | |
Test <- inline::cfunction(c(x = "numeric"), " | |
/***** R to C *****/ | |
// Don't do this!!! You will have a segfault if you provide a | |
// vector bigger than 1e5. | |
// for (size_t i = 0; i < Rf_length(x); i++) { | |
// x_dbl[i] = REAL(x)[i]; | |
// } |