Skip to content

Instantly share code, notes, and snippets.

View marshmallowrobot's full-sized avatar

Laura marshmallowrobot

View GitHub Profile
@marshmallowrobot
marshmallowrobot / AnyCodable.swift
Last active January 12, 2026 18:19
In Swift, use AnyCodable to represent dynamic JSON-schemas. This type is Codable, Equatable, and Hashable. It is also Firestore-friendly (works with NSNumber).
import FirebaseFirestore
/// A Codable representation of any JSON-compatible value
enum AnyCodable: Codable, Equatable, Hashable {
case null
case bool(Bool)
case int(Int)
case double(Double)
case string(String)
@marshmallowrobot
marshmallowrobot / panda-face.png
Last active January 20, 2023 19:32
Cute CSS only panda face
panda-face.png
@marshmallowrobot
marshmallowrobot / generateImage.js
Created January 16, 2023 18:44
Programmatically generate an image with custom text using a headless browser to screenshot an HTML page
const { join } = require('node:path');
const { writeFileSync } = require('node:fs');
const puppeteer = require('puppeteer');
const imageHtmlHead = () => {
return `
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&family=PT+Sans&display=swap" rel="stylesheet">