Skip to content

Instantly share code, notes, and snippets.

View joundy's full-sized avatar

joundy

View GitHub Profile
@t3dotgg
t3dotgg / try-catch.ts
Last active October 25, 2025 03:29
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;
};
@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active October 9, 2025 04:55
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

@MarZab
MarZab / api-filter-query.ts
Last active July 11, 2025 19:19
NestJS Filters with Swagger deepObject (example: `?filters[name]=thing1&filters[description]=thing2`)
import { applyDecorators } from '@nestjs/common';
import { ApiExtraModels, ApiQuery, getSchemaPath } from '@nestjs/swagger';
/**
* Combines Swagger Decorators to create a description for `filters[name]=something`
* - has support for swagger
* - automatic transformation with nestjs
*/
// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/explicit-module-boundary-types
export function ApiFilterQuery(fieldName: string, filterDto: Function) {
@fzn0x
fzn0x / super-grid.css
Last active January 18, 2021 10:32
Bootstrap common responsive grid system class in CSS Flexbox
// Here I created the default system grid from bootstrap using CSS with the help of calc().
// I made it while listening to Joji's song - Tick Tock then Dimitri Vegas & Like Mike - Stay A While.
// While drinking coffee for a moment.
// You can just copy this right away and use it or modify it.
// No Copyright. 2020
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
@swyxio
swyxio / Tailwindcssunreset.scss
Last active February 14, 2024 01:19
Tailwind CSS Un-Reset - un-reset Tailwind's Preflight CSS Reset so that autogenerated HTML looks consistent with the rest of your Tailwind site. - https://www.swyx.io/writing/tailwind-unreset
.unreset {
a {
@apply text-blue-700 underline;
}
p {
@apply my-4;
}
blockquote,
figure {
@ruanbekker
ruanbekker / dnsmasq.conf
Last active April 3, 2025 17:58
Tinkering with Loki, Promtail, Grafana, Prometheus, Nginx and Dnsmasq
log-queries
log-facility=/var/log/dnsmasq.log
no-resolv
server=8.8.4.4
server=8.8.8.8
address=/router/10.1.1.1
address=/server/10.1.1.2
@bl4ck5un
bl4ck5un / bitcoin.conf
Last active February 17, 2025 17:07
Simple bitcoind config for regtest
##
## bitcoin.conf configuration file. Lines beginning with # are comments.
##
daemon=1
regtest=1
listen=0
# JSON-RPC options (for controlling a running Bitcoin/bitcoind process)
rpcuser=exch
@cjaoude
cjaoude / gist:fd9910626629b53c4d25
Last active October 2, 2025 16:03
Test list of Valid and Invalid Email addresses
Use: for testing against email regex
ref: http://codefool.tumblr.com/post/15288874550/list-of-valid-and-invalid-email-addresses
List of Valid Email Addresses
email@example.com
firstname.lastname@example.com
email@subdomain.example.com
firstname+lastname@example.com
@kmatt
kmatt / pv_dump.sh
Created May 24, 2012 20:07
Monitoring dump and restore with pv
# dump
pg_dump testdb | pv -c -s $(psql -tc "SELECT pg_database_size('testdb')") -N dump | gzip > testdb.sql.gz
# restore
pv testdb_20120501.sql.gz | zcat | psql testdb