Skip to content

Instantly share code, notes, and snippets.

View adamjarling's full-sized avatar

Adam J. Arling adamjarling

View GitHub Profile
@adamjarling
adamjarling / sample-manifest-teach-x.json
Last active May 17, 2023 21:21
Sample IIIF Manifest
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://api.dc.library.northwestern.edu/api/v2/works/71153379-4283-43be-8b0f-4e7e3bfda275?as=iiif",
"type": "Manifest",
"label": { "none": ["Hello \"lunga\""] },
"metadata": [
{ "label": { "none": ["Alternate Title"] }, "value": { "none": ["Fava Boo Ya"] } },
{
"label": { "none": ["Creator"] },
"value": { "none": ["Fava, Antonio, 1949-"] }
@adamjarling
adamjarling / ts
Created May 14, 2023 13:21
Supabase Stripe handle Checkout
import Stripe from "stripe";
import { captureException } from "@sentry/nextjs";
import { getServiceSupabase } from "utils/supabase";
import { sendConfirmationEmail } from "lib/sendgrid/send-confirmation-email";
async function handleCheckoutSessionCompleted(
session: Stripe.Checkout.Session
) {
//console.log("session", session);
@adamjarling
adamjarling / mirador_workspace_demo.json
Created May 11, 2023 16:46
Mirador Workspace TeachX demo
{
"catalog": [
{
"manifestId": "https://iiif.lib.harvard.edu/manifests/ids:50670308"
},
{
"manifestId": "https://api.dc.library.northwestern.edu/api/v2/works/1e534392-a5d9-42b9-9b2c-30617c302140?as=iiif"
},
{
"manifestId": "https://iiif.lib.harvard.edu/manifests/drs:10908606"
@adamjarling
adamjarling / manifest-test.json
Created October 24, 2022 18:19
Test Pres 3 Manifest
{"@context":"http://iiif.io/api/presentation/3/context.json","id":"https://adam.dev.rdc.library.northwestern.edu:3002/works/d3cf53c8-276f-4488-b4e5-3e6be8a0bfcb?as=iiif","type":"Manifest","label":{"none":["Colonne d'Austerlitz. detailed view: 3rd set of 6 bands down from top"]},"metadata":[{"label":{"none":["Creator"]},"value":{"none":["Gondoin, Jacques (French furniture designer and architect, 1737-1818)","Lepere, Jean-Baptiste (French architect, 1761-1844)"]}},{"label":{"none":["Date"]},"value":{"none":["1810"]}},{"label":{"none":["Department"]},"value":{"none":["University (MAIN) Library"]}},{"label":{"none":["Genre"]},"value":{"none":["architecture (object genre)","architecture (discipline)"]}},{"label":{"none":["Last Modified"]},"value":{"none":["2022-10-24T17:48:13.802540Z"]}},{"label":{"none":["Provenance"]},"value":{"none":["Paris, Place Vendome ; France"]}},{"label":{"none":["Subject"]},"value":{"none":["19th century (Topical)","Architecture (Topical)"]}}],"requiredStatement":{"label":{"none":["Attri
@adamjarling
adamjarling / dynamic-iiif-selector-pattern.tsx
Created April 1, 2022 20:13
Quick idea on how to provide a way for user to input their own manifest in the static build (and in dev environment)
import React from "react";
import ReactDOM from "react-dom";
import App from "./index";
// NOTE: "env" is available via the DotEnv ES Build Plugin defined in serve.js
import { NODE_ENV, DEV_URL, STATIC_URL } from "env";
const host = NODE_ENV === "development" ? DEV_URL : STATIC_URL;
let sampleManifest: string = `${host}/fixtures/iiif/manifests/sample.json`;
# dev
dist
node_modules
public/script.js
public/script.js.map
# OS
.DS_Store
{
"name": "medium-es-build-article-demo",
"version": "1.0.0",
"description": "",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "npm run clean && node build.js && tsc --emitDeclarationOnly --outDir dist",
"clean": "rimraf dist",
const { build } = require("esbuild");
const { dependencies } = require("./package.json");
const entryFile = "src/index.tsx";
const shared = {
bundle: true,
entryPoints: [entryFile],
// Treat all dependencies in package.json as externals to keep bundle size to a minimum
external: Object.keys(dependencies),
logLevel: "info",
const { build } = require("esbuild");
const chokidar = require("chokidar");
const liveServer = require("live-server");
(async () => {
const builder = await build({
bundle: true,
// Defines env variables for bundled JavaScript; here `process.env.NODE_ENV`
// is propagated with a fallback.
define: {
import React from "react";
interface Props {
foo: string;
}
const App: React.FC<Props> = ({ foo }) => <div>Foo's value is: {foo}</div>;
export default App;