Skip to content

Instantly share code, notes, and snippets.

@sramam
sramam / local_api.ts
Last active February 20, 2025 04:00
Payload Utilities
import { getPayload } from 'payload'
// import config from '@payload-config'
import config from "../payload.config"
import 'dotenv/config'
const payload = await getPayload({ config })
payload.find({
collection: 'pages',
}).then(console.log);
@sramam
sramam / introspection.gql
Created January 3, 2025 10:20
introspection query
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
kind
name
description
fields(includeDeprecated: true) {
@sramam
sramam / collator.ts
Last active July 30, 2022 17:35
faker collator
// @ts-ignore
import { address } from "./docs/api/address";
import { animal } from "./docs/api/animal";
import { color } from "./docs/api/color";
import { commerce } from "./docs/api/commerce";
import { company } from "./docs/api/company";
import { database } from "./docs/api/database";
import { datatype } from "./docs/api/datatype";
import { date } from "./docs/api/date";
import { fake } from "./docs/api/fake";
@sramam
sramam / bye-nexus
Last active June 19, 2022 12:30
nexus to noun-and-verb migration
#!/usr/bin/env sh
set -e
rm -rf bye-bye-nexus
mkdir -p bye-bye-nexus/prisma
cd bye-bye-nexus
npm init -y
npm i typescript ts-node -D
cd prisma
curl -O https://gist.githubusercontent.com/sramam/6e6261b8bc97f592a44c25edee4d3d8f/raw/1de27ab39cf003f940818438340efbd6d655b76f/schema.prisma
@sramam
sramam / schema.prisma
Created June 19, 2022 11:31
journaly-prisma
generator prisma_client {
provider = "prisma-client-js"
// binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
@sramam
sramam / az-dokku-node.sh
Created January 20, 2022 16:13
deployment: Dokku, Azure, node.js from the shell
# create an SSH key-pair
# Constants: make sure this is identical to the block midway in the file.
REGION=eastus
RG=acuity-trial
VM=nv
APPNAME=nvs
@sramam
sramam / noun-and-verb.md
Last active October 5, 2021 04:21
noun-and-verb.md

A workable abstract model of an API server

  • Built with Prisma, Apollo Server, GraphQL and a sprinking of ✨ pixie dust ✨
  • This document is a barebones description of the product in the making.

This is the high level idea of what a GraphQL server looks like.

             ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐              
 Backend 
@sramam
sramam / machine.js
Created December 28, 2020 11:45
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@sramam
sramam / install-pt
Last active September 17, 2020 21:20 — forked from brandondrew/install-pt
Easily install the Platinum Searcher (on Linux) (to your personal bin directory)
#!/usr/bin/env bash
# curl https://gist.githubusercontent.com/sramam/5e2a2dfd7261b222cb8af6b58ca1dda9/raw/025e4a1cda4608a83d984c7dc7e7796d5d17413e/install-pt | bash
OS_CODE="linux_amd64"
# TODO: check the OS and architecture and make this work across platforms
VERSION="v2.2.0"
# TODO: scrape the GitHub README for the latest version
TARGET=/usr/bin/pt
@sramam
sramam / install-pt
Created September 17, 2020 21:15 — forked from brandondrew/install-pt
Easily install the Platinum Searcher (on Linux) (to your personal bin directory)
#!/usr/bin/env bash
OS_CODE="linux_amd64"
# TODO: check the OS and architecture and make this work across platforms
VERSION="v2.1.5"
# TODO: scrape the GitHub README for the latest version
TARGET=~/bin
# TODO: accept command line options, and prompt if nothing is specified