Skip to content

Instantly share code, notes, and snippets.

View omavi's full-sized avatar
🌴
On vacation

omavi

🌴
On vacation
  • Webflow
  • Richmond, Virginia
  • 02:10 (UTC -04:00)
View GitHub Profile
@omavi
omavi / kyselyQueryBuilder.ts
Created June 27, 2025 13:04
Kysely query building example
import {
DummyDriver,
Kysely,
PostgresAdapter,
PostgresIntrospector,
PostgresQueryCompiler,
sql,
} from "kysely";
// Intentionally using `any` to allow for dynamic schemas
@omavi
omavi / knexQueryBuilder.ts
Created June 26, 2025 15:12
Knex query building example
import knex from "knex";
// Create a knex instance purely for query building (no database connection)
const queryBuilder = knex({ client: "pg" }); // We specify a client but don't connect
// Example 1: Simple SELECT query
const selectQuery = queryBuilder
.select("id", "name", "email", "created_at")
.from("users")
.where("active", true)
@omavi
omavi / bufferTransformCacheHandlerShim.js
Created April 17, 2025 02:42
NextJS 15 cache handler shim for transforming buffers appropriately
/**
* This cache handler shim ensures compatibility with Redis, by converting
* buffers to strings on save and back to buffers on read, since the data
* is stored as JSON.
*
* This shim is a temporary workaround until Next 15 support is added to
* @neshca/cache-handler:
* https://github.com/caching-tools/next-shared-cache/pull/969
*
* @param {import("@neshca/cache-handler").Handler} handler - The original cache handler to wrap.
@omavi
omavi / GraphiQLExplorer.tsx
Created January 21, 2021 22:08 — forked from baohouse/GraphiQLExplorer.tsx
Fork of graphiql-explorer 0.4.5 to support list types and object-based custom args
/**
* Copied from https://github.com/OneGraph/graphiql-explorer (0.4.5)
* We fork because we need to support customizable fields and could not wait for
* the PR process to finish. Also converted Flow type to TypeScript.
*/
import { Tooltip } from 'antd';
import prettier from 'prettier/standalone';
import parserGraphql from 'prettier/parser-graphql';
import React, { Fragment } from 'react';