Skip to content

Instantly share code, notes, and snippets.

View Mati365's full-sized avatar
🚧
Work Work Work

Mateusz Bagiński Mati365

🚧
Work Work Work
View GitHub Profile
@nodew
nodew / monad.ts
Last active October 22, 2023 10:35
monad with typescript
interface Functor<A> {
fmap<B>(fn: (a: A) => B): Functor<B>
}
abstract class Applicative<A> implements Functor<A> {
static of: <A>(a: A) => Applicative<A>;
abstract fmap<B>(fn: (a: A) => B): Applicative<B>;
abstract ap<B, C>(this: Applicative<(b: B) => C>, ma: Applicative<B>): Applicative<C>;
lift<B, C>(fn: (a: A, b: B) => C) : (mb: Applicative<B>) => Applicative<C> {
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active July 4, 2025 21:38
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@mtesseract
mtesseract / deploying-reflex-nixos.md
Last active October 5, 2023 21:25
Deploying a Reflex Application to NixOS

Deploying a Reflex Application to NixOS

In the following post I describe how a simple Haskell web application built on top of Reflex FRP can be deployed to a remote NixOS server. If a remote NixOS server is available using it for deployment can be cheaper alternative to commercial cloud providers in case the features of those (e.g. scaling, hosted services, availability guarantees, etc.) are not strictly required.

The sample Reflex application can be found on GitHub.

Our setting is as follows:

  • The application, consisting of a frontend and a backend, is built with Nix
  • The development system is a Mac (i.e., not x86_64-linux)
@reecelucas
reecelucas / useScrollBlock.js
Last active December 17, 2024 13:11
React hook to enable/disable page scroll
import { useRef } from 'react';
const safeDocument = typeof document !== 'undefined' ? document : {};
/**
* Usage:
* const [blockScroll, allowScroll] = useScrollBlock();
*/
export default () => {
const scrollBlocked = useRef();
@zarv1k
zarv1k / abstract-unique-validator.ts
Last active January 30, 2025 14:26
Unique Validator Example for NestJS
import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
import { Connection, EntitySchema, FindConditions, ObjectType } from 'typeorm';
interface UniqueValidationArguments<E> extends ValidationArguments {
constraints: [
ObjectType<E> | EntitySchema<E> | string,
((validationArguments: ValidationArguments) => FindConditions<E>) | keyof E,
];
}
@goll
goll / README.md
Last active April 22, 2025 17:08
Docker nftables configuration for Debian 10
@bhouse
bhouse / setup.md
Created January 22, 2020 21:28
YubiKey GPG + GitHub setup

Yubikey + GPG + Github + Keybase

The following guide are steps that can be used to generate GPG keys on a YubiKey, use the gpg keys to sign github commits, and publish the public gpg key to Keybase.

Why is this a good idea?

  1. Generating and storing GPG keys on a YubiKey allows the private key to be protected and ported between physical machines.
  2. Signing git commits adds an extra layer of verification that code changes originated from an trusted source.
  3. Using a YubiKey + touch-to-sign requires a physical presence to use the GPG signing key.
  4. GitHub supports restricting commits to a repo to only those that are signed.
  5. Putting a physical stamp on your code commits invokes a feeling of pride.
@liemle3893
liemle3893 / .gitlab-ci.yml
Created April 1, 2020 12:27
Gitlab CI with Nomad
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds.
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
DOCKER_TLS_CERTDIR: ""
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
We can't make this file beautiful and searchable because it's too large.
Id,Data,Nick,Pasek,Autor,Tytuł,Gatunek,Ocena
50801421,2020-07-15 21:55:08,ranunculus,niebieski,Peter Heller,Gwiazdozbiór Psa,"Fantastyka, Postapo",7
50799873,2020-07-15 20:30:14,leuler,niebieski,Jason Schreier,"Krew, pot i piksele. Chwalebne i niepokojące opowieści o tym, jak robi się gry.",literatura faktu,6
50797785,2020-07-15 18:33:25,xandra,różowy,Martyna Raduchowska,Czarne Światła: Łzy Mai (tom I) i Spektrum (tom II),cyberpunk/sf/kryminał,8
50792029,2020-07-15 11:11:02,vivianka,różowy,Jeff Lindsay,Dekalog Dextera,kryminał,6
50791721,2020-07-15 10:44:18,vivianka,różowy,Magda Stachula,W pułapce,kryminał,6
50791493,2020-07-15 10:24:42,TeczkiUkladyAgentury,niebieski,Grzegorz Braun,A nie mówiłem? Koronawirus i III Wojna Światowa. Czy Polska przetrwa największy globalny kryzys od 100 lat?,publicystyka,
50786203,2020-07-14 23:05:19,konik_polanowy,niebieski,"Zbigniew Lew-Starowicz, Krystyna Romanowska",O rozkoszy,psychologia,5
50782305,2020-07-14 19:36:48,ranunculus,niebieski,Wiktor Noczkin,Lichwiarz,Fantasy,6
5
@skeeto
skeeto / README.md
Last active September 23, 2024 02:16
AI driving simulation