This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*[class] { | |
outline: 2px dashed #00f; | |
position: relative; | |
} | |
*[class]::before { | |
background: #00f; | |
color: #fff; | |
content: '.' attr(class); | |
font-family: sans-serif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
listenAndServe, | |
ServerRequest, | |
} from "https://deno.land/std/http/server.ts"; | |
const { PORT = "8080" } = Deno.env.toObject(); | |
const spuds: Array<string> = []; | |
const createSpud = async (req: ServerRequest) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const levels = ['debug', 'info', 'warn', 'error']; | |
const currentLevel = levels.indexOf(process.env.LOG_LEVEL || 'error'); | |
const log = (level, ...data) => { | |
if (levels.indexOf(level) >= currentLevel) { | |
const ts = new Date().toISOString(); | |
const log = { level, ts, data }; | |
process.stdout.write(`${JSON.stringify(log)}\n`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pixelate = (image, amount = 0.1) => { | |
const canvas = document.createElement('canvas'); | |
const context = canvas.getContext('2d'); | |
canvas.width = image.width; | |
canvas.height = image.height; | |
canvas.style.imageRendering = 'pixelated'; | |
context.imageSmoothingEnabled = false; | |
const scaledWidth = canvas.width * amount; |