Skip to content

Instantly share code, notes, and snippets.

View danieltomasz's full-sized avatar

Daniel Borek danieltomasz

View GitHub Profile
window.addEventListener("DOMContentLoaded", () => {
const highlightResults = (text, color) => {
document.designMode = "on"; // https://stackoverflow.com/a/5887719
var selection = window.getSelection();
selection.collapse(document.body, 0);
while (window.find(text)) {
document.execCommand("HiliteColor", false, color);
selection.collapseToEnd();
}
document.designMode = "off";
@danieltomasz
danieltomasz / wikilinks-filter.lua
Last active August 19, 2023 14:00
Lua filter for removing wikilinks brackets

Quarto callouts

About callouts

Callouts are a great way to add more attention ot certain details of the text (in the form of a box). Quarto provides 5 different types of callouts:

  • note
  • warning
  • important
@danieltomasz
danieltomasz / Example.r
Created January 29, 2023 23:07
Iterating over variables in glm
create_models <- function(datame_name, cog_vars, eeg_components) {
list_models <- list()
for (cogvar in cog_vars) { # ,eeg_components
for (eegvar in eeg_components) { # ,eeg_components
models <- glue("model1.{cogvar}.{eegvar} <- glm({cogvar} ~ GM_Normalised + {eegvar}, {datame_name}, family = gaussian)
list_models[['model.{cogvar}.{eegvar}']] <- model5.{cogvar}.{eegvar}") # nolint
eval(str2expression(models))
}
}
return(list_models)
@danieltomasz
danieltomasz / clearwiki.md
Last active September 14, 2022 22:26
A naive proof of the concept Lua filter removing wikilinks

A naive proof of the concept Lua filter for removing [[ wikilinks from markdown file.

function Str (str)
    return (str.text:gsub('%[%[', '')
                    :gsub('%]%]', ''))
end

When the filter is saved under name cleanwiki.lua it might be used with the flag --lua-filter=cleanwiki.lua

@danieltomasz
danieltomasz / dplyr_function_quote_filter.md
Last active March 27, 2022 22:00
This gist is showing how to properly use filter argument in quote in function written around dplyr pipes

Code for reproducible example around github functions

library(stringi)
library(tidyr)
library(dplyr)
library(stringr)

example <- data.frame(LP=1:10000)  %>%
  rowwise() %>%
@danieltomasz
danieltomasz / vscode_shortcuts.md
Created June 18, 2021 14:27 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

reproducible pipeline with pyenv

pyenv install  3.8.10
pyenv virtualenv 3.8.10 example-env-name
pyenv local cognitive-reserve
@danieltomasz
danieltomasz / ColorAnnotation.py
Last active June 9, 2021 15:36
This Python script will replace html with Zotero annotation with more Obsidian friendly that display the color in the preview
#!/usr/bin/env python
# # -*- coding: utf-8 -*-
# %%
import urllib, json
import json
import re
import urllib.parse
from colormap import hex2rgb
import argparse
@danieltomasz
danieltomasz / Agile Academia OpenMR 2021.md
Last active March 25, 2021 14:16
Presentation Agile Academia OpenMR 2021

What is Agile

Agile Software Development

  • Individuals and interactions over processes and tools
  • Working software over comprehensive documentation
  • Customer collaboration over contract negotiation
  • Responding to change over following a plan

Kanban