Skip to content

Instantly share code, notes, and snippets.

View hunterwilhelm's full-sized avatar

Hunter Wilhelm hunterwilhelm

View GitHub Profile
@axmad386
axmad386 / drizzle-paginate.md
Created May 17, 2024 14:41
Fully Typed Drizzle ORM Dynamic Pagination Query

Pagination Helper

This is simple helper for dynamic pagination using drizzle-orm using basic limit offset. The result is fully typed.

import { db } from "../yourdbinstance";
import { sql } from "drizzle-orm";
import type { PgSelect } from "drizzle-orm/pg-core";

interface PaginateParam {
  limit: number;
 page: number;
@rajeshg
rajeshg / mkcd.bash
Created November 23, 2010 19:01
mkcd command - how to create a directory using mkdir and cd in one step
#
# mkcd command
# This is an improvised version of the mkcd command at http://superuser.com/questions/152794/is-there-a-shortcut-to-mkdir-foo-and-immediately-cd-into-it
# This function has to be added to the ~/.bashrc file
# After that you can run command like: mkdir abc, mkdir -p one/two/three
#
function mkcd {
last=$(eval "echo \$$#")
if [ ! -n "$last" ]; then
echo "Enter a directory name"