Skip to content

Instantly share code, notes, and snippets.

@joranquinten
joranquinten / generate-sitemap.js
Created January 22, 2019 14:03
Generate sitemap XML for NextJs static sites based on exportPathMap
/*
Generates a sitemap based on the entries in exportPathMap in next.config.js file
Author: Joran Quinten
Don't forget to add the domain name as process variable PUBLIC_DOMAIN!
Trigger the file with a separate script in your package.json and add it to your build command in Netlify
(for instance, set Build command to: "npm run production && npm run postexport")
@Kludex
Kludex / main.py
Created July 3, 2023 15:06
ObjectId with Pydantic protocol
from typing import Type, Callable, Any
from bson.objectid import ObjectId, InvalidId
from pydantic import BaseModel, ValidationError
from pydantic_core import CoreSchema, core_schema
class PydanticObjectId(ObjectId):
@classmethod
def __get_pydantic_core_schema__(