Skip to content

Instantly share code, notes, and snippets.

View michaelschufi's full-sized avatar

Michael Schaufelberger michaelschufi

View GitHub Profile
@lwensveen
lwensveen / README.md
Created April 8, 2025 15:34
Drizzle-Seed Junction Table Workaround: Avoiding Duplicate Key Violations

Temporary Drizzle-Seed Junction Table Workaround

This is a temporary solution for seeding databases with Drizzle ORM (drizzle-seed) when junction tables cause duplicate key violations. It seeds main tables first using seed, then manually seeds junction tables with fetched IDs to ensure uniqueness.

Usage

  1. Replace schema and db imports with your own schema and database connection.
  2. Update mainTables with your main entity tables (e.g., users, products).
  3. Add your junction tables in the seeding section (e.g., userProducts).
  4. Run with your preferred runtime (e.g., bun run seed.ts).
@bnsngltn
bnsngltn / context.ts
Last active July 14, 2024 06:16
TS-Rest+Next Auth
import type { NextApiRequest, NextApiResponse } from "next";
import type {
AppRoute,
ServerInferRequest,
ServerInferResponses,
} from "@ts-rest/core";
import { getServerSession } from "next-auth";
// This is your
import { authOptions} from './authOptions'
@Merott
Merott / tailwind-colors-as-css-variables.md
Last active June 13, 2025 07:30
Expose Tailwind colors as CSS custom properties (variables)

This is a simple Tailwind plugin to expose all of Tailwind's colors, including any custom ones, as custom css properties on the :root element.

There are a couple of main reasons this is helpful:

  • You can reference all of Tailwind's colors—including any custom ones you define—from handwritten CSS code.
  • You can define all of your colors within the Tailwind configuration, and access the final values programmatically, which isn't possible if you did it the other way around: referencing custom CSS variables (defined in CSS code) from your Tailwind config.

See the Tailwind Plugins for more info on plugins.

@stramel
stramel / HOWTO.md
Last active May 17, 2025 02:29
Installing Powerline fonts on Windows 10

Installing Powerline fonts on Windows 10

Steps

  1. Download and extract zip from here
  2. Press Windows + x
  3. Press a (Selects PowerShell (Admin))
  4. Navigate to directory where fonts were extracted to (cd ${HOME}\Downloads\fonts-master\fonts-master)
  5. Set Execution Policy Set-ExecutionPolicy RemoteSigned [1]
  6. Press y then Enter to accept
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active August 16, 2024 13:39
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 

Writing template strings in Markdown

With template strings coming to ES6, the backtick (`) means something in Markdown and in JavaScript. If you write this:

To display a message, write `alert(`hello world!`)`.

it'll render like this:

To display a message, write alert(hello world!).

@kenta2
kenta2 / dhmo.md
Last active April 11, 2023 06:19
Factsheet: Dihydrogen Monoxide (DHMO)

Factsheet: Dihydrogen Monoxide (DHMO)

  • DHMO is an industrial chemical used in the production of insecticide and paint.
  • Autopsies have found high concentrations of DHMO in the tumors of patients killed by cancer.
  • DHMO is a critical chemical in cancer metastasis, the process which causes cancer to spread malignantly from one tumor to the rest of the body.
  • DHMO is known to intercalate into enzymes vital for normal body function.
  • DHMO destroys the crystal structure of glucose, the most important compound in metabolism.
  • DHMO is a primary component of raw sewage.
  • DHMO was a chemical that allowed bubonic plague to kill half of the population of Europe.
  • HIV spreads only when accompanied with DHMO.