Skip to content

Instantly share code, notes, and snippets.

View Philipinho's full-sized avatar
🎯
Focusing on Java

Philip Okugbe Philipinho

🎯
Focusing on Java
  • United Kingdom
View GitHub Profile
/* File generated automatically, do not edit. */
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
export type DBEventType =
'goal' |
'own-goal' |
'penalty-goal' |
'penalty-miss' |
'yellow-card' |
@gragland
gragland / use-optimistic-mutation-example.ts
Last active May 5, 2024 18:07
useOptimisticMutation for React Query. Optimistically update data in multiple locations with rollback on error.
import axios from 'axios'
import { useOptimisticMutation } from "./useOptimisticMutation.ts"
type Response = boolean
type Error = unknown
type MutationVariables = {itemId: string}
type Items = {id: string; name: string}[]
type Likes = {itemId: string}[]
type History = {type: string}[]
@ryanto
ryanto / page.tsx
Created August 9, 2023 17:01
<Await> component
import { Markdown } from "@/app/components/markdown";
import { getComments, getPost } from "@/lib/db";
import { Suspense } from "react";
export default async function PostPage({
params,
}: {
params: { postId: string };
}) {
let post = await getPost(params.postId);
@YPetremann
YPetremann / prisma-auto-excluder.js
Last active September 10, 2023 14:57
Prisma Auto Exclude
const { Prisma } = require("@prisma/client");
/**
* this plugin is used to automatically exclude fields from prisma queries
* this works with almost all prisma queries that use select and include
* if a custom query is used, it will not work by default,
* but it can by adding a $autoExclude:true to the args
* next to select and include, there is now exclude
* if a field ends with an underscore, it will be excluded unless explicitly in select or include
* truthy field in exclude will be excluded, even if present in select or include
@tommmyngo
tommmyngo / radix.css
Last active April 28, 2024 06:48
Radix Colors
:root {
--background: var(--gray1);
--foreground: var(--gray12);
--muted: var(--gray3);
--muted-foreground: var(--gray10);
--popover: var(--gray2);
--popover-foreground: var(--gray11);
@Venryx
Venryx / Fractional Indexing (David Greenspan).md
Last active May 10, 2024 03:37
List of various fractional-indexing schemes, along with language-specific implementations
@ssddanbrown
ssddanbrown / bookstack-backup.sh
Last active May 5, 2024 20:25
bookstack-backup
#!/bin/bash
# Directory to store backups within
# Should not end with a slash and not be stored within
# the BookStack directory
BACKUP_ROOT_DIR="$HOME"
# Directory of the BookStack install
# Should not end with a slash.
BOOKSTACK_DIR="/var/www/bookstack"
@gregveres
gregveres / line-height.ts
Created May 4, 2022 12:20
line-heights for tiptap 2
import { Extension } from "@tiptap/core";
export interface LineHeightOptions {
types: string[];
heights: string[];
defaultHeight: string;
}
declare module "@tiptap/core" {
interface Commands<ReturnType> {
@gregveres
gregveres / back-color.ts
Created May 3, 2022 23:26
background-color for tiptap 2
import { Extension } from "@tiptap/core";
import "@tiptap/extension-text-style";
export type ColorOptions = {
types: string[];
};
declare module "@tiptap/core" {
interface Commands<ReturnType> {
backColor: {