Skip to content

Instantly share code, notes, and snippets.

View tijnjh's full-sized avatar

tijn tijnjh

  • Utrecht, Europe
  • 06:14 (UTC +02:00)
View GitHub Profile
@STBoyden
STBoyden / effect-remote-functions-with-promiseexit.ts
Last active May 5, 2026 10:07
Effect.ts + SvelteKit remote functions
import type { RemoteFormInput } from "@sveltejs/kit";
import { command, form, query } from "$app/server";
import { Effect, Schema } from "effect";
/**
* Creates a remote query defined with `Effect`. Shares the same behaviour as
* SvelteKit's `query`.
*
* @param schema The `Schema` to validate arguments against.
* @param handler The `Effect` to run when this function is ran.
@t3dotgg
t3dotgg / try-catch.ts
Last active May 27, 2026 11:41
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@bunnymatic
bunnymatic / gist:a78deb0e3274af571916
Created July 9, 2014 15:32
who done it - git blame statistics
Hop into a shell and to the root directory of your project and run
git ls-tree --name-only -z -r HEAD -- $1 | xargs -0 -n1 git blame --line-porcelain | grep "^author "|sort|uniq -c|sort -nr
Then wait a bit. You get a nice sorted list of lines of code and author name.
Add it to your bash profile like this
whodunit() {
git ls-tree --name-only -z -r HEAD -- $1 | xargs -0 -n1 git blame --line-porcelain | grep "^author "|sort|uniq -c|sort -nr
}