Skip to content

Instantly share code, notes, and snippets.

View mongodben's full-sized avatar
👨‍🎤
git up, git out, git something

Ben Perlmutter mongodben

👨‍🎤
git up, git out, git something
View GitHub Profile
// refactor of example from https://www.mongodb.com/docs/realm/web/graphql-apollo-react/#run-a-query
// Connect to your MongoDB Realm app
const app = new Realm.App(APP_ID);
// use setInterval to refresh token before it expires
// rather than running before every GQL request
const TWENTY_FIVE_MIN_IN_MS = 1500000;
setInterval(() => {
await app.currentUser?.refreshCustomData();
@mongodben
mongodben / bluehawk-config-example.ts
Last active August 29, 2022 17:10
bluehawk from config proposal
// usage: bluehawk exec path/to/config.[js|ts|json]
interface ConfigAction {
action: "snip" | "copy" | "check";
input: string;
output: string;
ignore?: string[];
state?: string;
format?: "rst" | "md" | "docusaurus"; // or arbitrary string perhaps?
}
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://victoriousseo.com/</loc>
<lastmod>2022-08-11T16:27:30+00:00</lastmod>
</url>
<url>
<loc>https://victoriousseo.com/services/keyword-research/</loc>
<lastmod>2021-12-09T19:21:21+00:00</lastmod>
</url>
</urlset>
@mongodben
mongodben / atlas_functions.json
Created September 29, 2022 13:57
Atlas Functions config JSON schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"definitions": {
"json_expression": {
"type": ["integer", "object"]
},
"function": {
"type": "object",
"description": "Configuration for an Atlas Function",
@mongodben
mongodben / change_path_capitalization.md
Created February 21, 2023 15:09
When you need to change just capitalization of files/directories in git history

When need to change path capitalization in git history, things get confusing b/c Mac/Linux file system treats upper and lowercase of a letter the same.

For example things get annoying when you try to change Models/cat.js to models/Cat.js. It gets even weirder if you have a local Models/cats.js file and the remote has models/cats.js.

To get the git history synced between local and remote:

  1. Use git ls-files to see the different directories that the OS has consolidated into one.
  2. Rename the directory that the OS has consolidated. In this case, "Models" -> "temp". This makes the OS move all those files to the directory together.
@mongodben
mongodben / example.md
Created June 6, 2023 21:02
example.md

db.collection.find()

Definition

db.collection.find(query, projection, options) db.collection.find() find command This page documents a mongosh method. This is not the documentation for database commands or language-specific drivers, such as Node.js.

For the database command, see the find command .

@mongodben
mongodben / langchain-as-llm-docs.md
Last active October 13, 2023 13:54
LangChain as Docs for the LLM Ecosystem
date_published last_updated
2023-26-05
2023-10-12

LangChain as Docs for the LLM Ecosystem

And why I don't care for have mixed opinions on their libraries

I was recently looking at the LangChain python documentation website when I was doing some research on architecting a vector search/LLM chatbot. (something like this).

@mongodben
mongodben / rage-with-the-machines.md
Last active October 29, 2023 20:07
RAGE with the Machine