Skip to content

Instantly share code, notes, and snippets.

@danslapman
danslapman / yoneda.sc
Last active January 12, 2022 16:03
Yoneda lemma explanation
// https://ru.wikipedia.org/wiki/%D0%9B%D0%B5%D0%BC%D0%BC%D0%B0_%D0%99%D0%BE%D0%BD%D0%B5%D0%B4%D1%8B
/*
Scala за 5 минут
int Plus(int Lhs, int Rhs) => lhs + rhs; def plus(lhs: Int, rhs: Int) = lhs + rhs;
Func<int, Int, Int> plus = (lhs, rhs) => lhs + rhs; val plus: (Int, Int) => Int = (lhs, rhs) => lhs + rhs;
@danslapman
danslapman / GenericExtensions.cs
Last active June 19, 2023 06:45
Basic F# support for Swashbuckle
public static class GenericExtensions
{
public static void CopyProperties<T>(this T source, T destination)
{
var props = source?.GetType().GetProperties();
if (props == null) return;
foreach (var prop in props)
{
prop.SetValue(destination, prop.GetValue(source));
}
@danslapman
danslapman / .zshenv
Created June 1, 2022 14:49
JDK switcher for MacOS
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
jdk() {
version=$1
escaped=$(echo $JAVA_HOME | sed -e 's/[]\/$*.^[]/\\&/g')
pattern=$(printf 's/%s\/bin://g' "$escaped")
export PATH=$(echo $PATH | sed -e "$pattern")
export JAVA_HOME=$(/usr/libexec/java_home -v "$version")
export PATH=$JAVA_HOME/bin:$PATH
java -version
@danslapman
danslapman / thesis.txt
Last active June 23, 2022 19:58
Typeclasses
Доклад простыми словами знакомит слушателя с понятиями "тайпкласс" и "тип высшего порядка" и объясняет,
почему об этом постоянно говорят функциональщики.
Для тех, кто был на докладе Олега на Joker 2018, но ничего не понял
@danslapman
danslapman / links.txt
Created June 28, 2022 21:29
streaming json
@danslapman
danslapman / Default%20%28OSX%29.sublime-keymap
Last active August 23, 2022 07:28
Sublime text settings
[
{ "keys": ["alt+space"], "command": "auto_complete" },
{ "keys": ["alt+q"], "command": "lsp_signature_help_show" }
]