Skip to content

Instantly share code, notes, and snippets.

View ksassnowski's full-sized avatar

Kai Sassnowski ksassnowski

View GitHub Profile
@ksassnowski
ksassnowski / group.ts
Last active February 25, 2023 06:15
`group` function
import { Node } from '@motion-canvas/2d/lib/components';
import { all } from '@motion-canvas/core/lib/flow';
import {
InterpolationFunction,
TimingFunction,
deepLerp,
easeInOutCubic,
} from '@motion-canvas/core/lib/tweening';
import { Vector2 } from '@motion-canvas/core/lib/types';
@ksassnowski
ksassnowski / Polynomial.ts
Created February 14, 2023 13:17
Typescript Polynomial implementation based on Freya Holmér's "Mathfs" package for Unity
export type Derivative = 0 | 1 | 2 | 3;
/**
* A polynomial in the form ax^3+bx^2+cx+d up to a cubic.
*/
export class Polynomial {
public readonly c1: number;
public readonly c2: number;
public readonly c3: number;
@ksassnowski
ksassnowski / useDatepicker.ts
Created January 15, 2022 16:09
Datepicker Framework, I guess
import {computed, ref} from "vue";
import {
addMonths, addYears,
eachDayOfInterval,
endOfISOWeek,
getYear,
getDate,
isSameMonth,
startOfISOWeek,
startOfMonth,
@ksassnowski
ksassnowski / functor.php
Last active October 15, 2021 12:50
Playing around with functors in PHP
<?php
interface Functor
{
// fmap :: Functor f => (a -> b) -> f a -> f b
public function fmap(callable $fn): Functor;
}
class Fn implements Functor
{
@ksassnowski
ksassnowski / filterMfuckery.hs
Last active November 3, 2016 11:39
Trying to understand `filterM (const [True, False]) [1..5]`
-- Given a list of numbers, generate a list of all possible sums.
-- Solution
map sum $ filterM (const [True, False]) [1..5]
-- Manual evaluation of `filterM (const [True, False]) [1..5]` using repeated substitution
filterM (const [True, False]) [1..5]
-- replace `filterM` with its definition
@ksassnowski
ksassnowski / .vimrc
Last active November 19, 2017 22:32
vimrc
set nocompatible
filetype off
call plug#begin('~/.vim/plugged')
" Plugins
" ------------------------------
Plug 'kien/ctrlp.vim'
Plug 'Raimondi/delimitMate'
Plug 'mattn/emmet-vim'