Skip to content

Instantly share code, notes, and snippets.

View bdsqqq's full-sized avatar
🎨

Igor Bedesqui bdsqqq

🎨
View GitHub Profile
@bdsqqq
bdsqqq / NestedKeyOf.md
Created February 9, 2022 22:48
A way to get deeply nested types like if you were using `keyof`, it supports full blown path threes and just leaves too.

I really wanted to get a type-safe function from an i18n lib I was using so I found this in a forum I never heard of. Enjoy!

// From https://ostack.cn/qa/?qa=416461/
type Cons<H, T> = T extends readonly any[]
  ? ((h: H, ...t: T) => void) extends (...r: infer R) => void
    ? R
    : never
  : never;
@bdsqqq
bdsqqq / git.migrate
Created February 18, 2022 18:04 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@bdsqqq
bdsqqq / Prisma.md
Created September 5, 2022 22:00
Prisma
  • [1] Next-generation Node.js and TypeScript ORM.
  • [1] Get started in minutes with a new or existing database.
  • [1] Use full type safety and automated workflows to ship schema changes and write queries with less work.
    • Prisma Client is a query builder that composes queries the way you think and is auto-generated from the Prisma schema with types tailored to your app.
    • Prisma Migrate automatically generates SQL database migrations, that are fully customizable, enabling you to make changes to the database without generating migration files.
  • [2][3] Prisma makes SQL so easy you'll barely notice you're using it.
  • [4] Prisma is a database toolkit that covers the daily workflows of application developers that interact with databases. A few examples are:
    • querying (with Prisma Client)
    • data modeling (in the Prisma schema)
    • migrations (with Prisma Migrate)
@bdsqqq
bdsqqq / 00
Last active September 9, 2022 01:17
Very good tailwind thing
ttftfffttttttttttfffffffttftt1ttttttt111tttt1111111tttt1tt111tttt111111tttt1ttttttttttttttt111111111
ttfttttttttttttttttfLLLftfffffffffftttt111tt11111ttffffftttt1111111111111111ttttttfttttttttt111111t1
ttttttttttttttttffffLfftffffffffLLffttttttftt111ttfffffftttttttt111111ttttttffffttfffttttttt111111tt
ttttttttttttttttfffLfttffffffLLffffttttttttttt1tfffffffffftttttt111111tffffffffftttfffftttt11111ttt1
ttttttttttttffLfttfffttfffffffffttfftttttt1t1tt11tfffffftttttt111t111111ttffffLLffttfffftt111111tttt
ttttttttttffLLLLfttttffLLLfttttftfLftttttttffffttttffffttttfftt11t111tt111ttfffLffttfftttttt1111tttt
ttttttttffLLLLLLLffttfLLffttfffftfLfttttttffttt11111ttttffffffftt1111tft11111ttffffttt11tfftt11ttttt
tttttttfffLLLLLLLLfftffttttffLffftfftttttft1i;;::::;iitffffffffftt111tft1tttt1ttffLfttttfffffttttttt
tttttttfffLLLLLLLLfttttffftffffftfttttttff1:,,,,,,,,::itfffffffft11111111ttttttttttt1tfffffffffffttt
tttffttffLLLLLLLLLfttfftffffffffLLLftttttt;::,:::;;;;::1tfffftfft11111ttt1ttt1tfttt11ttffffffffLfttt
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGmCwwXHR4lVSRudWxs1Q0ODxAR
EhMUFRZcTlNDb21wb25lbnRzVU5TUkdCXE5TQ29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29s
b3JTcGFjZVYkY2xhc3NPECswLjA2Mjc0NTEwMTc1IDAuMDYyNzQ1MTAxNzUgMC4wNjI3
@bdsqqq
bdsqqq / sticky_positioning_fucker_finder.js
Last active July 10, 2023 11:32
Find who's fucking with fixed positioning (creating a stacking context) Thanks Josh!
// Replace “.the-fixed-child” for a CSS selector
// that matches the fixed-position element:
const selector = '.the-fixed-child';
function findCulprits(elem) {
if (!elem) {
throw new Error(
'Could not find element with that selector'
);
}
@bdsqqq
bdsqqq / tailwind.config.ts
Created December 6, 2023 16:42
tailwind animations plugin
/**
* Generates tailwindcss-animate compatible animation utilities from the keyframes defined in theme.keyframes.
*
* @see [tailwindcss-animate](https://github.com/jamiebuilds/tailwindcss-animate)
*/
const generateAnimationUtilitiesFromKeyframes = plugin(({ addUtilities, theme }) => {
function generateAnimationUtilities(keyframes) {
const animationUtilities = {};
Object.entries(keyframes).forEach(([animationName, animationKeyframes]) => {
@bdsqqq
bdsqqq / settings.json
Created December 9, 2023 15:14
Vesper Overrides
// Plop these into your VSCode settings.json,
// can easily acces from the command palette
// then typing "Preferences: Open User Settings (JSON)"
"workbench.colorTheme": "Vesper",
// Overrides vesper theme start
"workbench.colorCustomizations": {
"editorGutter.addedBackground": "#A0A0A0",
"editorGutter.deletedBackground": "#A0A0A0",
"editorGutter.modifiedBackground": "#A0A0A0"
@bdsqqq
bdsqqq / progressbar.ts
Created January 23, 2024 17:03
quick ascii progressbar script
export function progressBar(
percent: number,
width: number,
charPalette: string[] = ["░", "▓", "█"]
) {
// figure out how much % each character will represent considering 100% = width
const charPercentValue = 100 / width;
// figure out how much of a % each character in the palette represents
// palette[0] will always mean 0% of the charPercentValue,
// Modified version of component from https://craft.mxkaske.dev/post/fancy-multi-select
import { createContextScope, type Scope } from '@radix-ui/react-context';
import * as PopperPrimitive from '@radix-ui/react-popper';
import { createPopperScope } from '@radix-ui/react-popper';
import { Portal as PortalPrimitive } from '@radix-ui/react-portal';
import { Presence } from '@radix-ui/react-presence';
import { useControllableState } from '@radix-ui/react-use-controllable-state';
import { X } from 'lucide-react';
import * as React from 'react';