Skip to content

Instantly share code, notes, and snippets.

@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active October 24, 2024 18:10
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@DavidKuennen
DavidKuennen / ocr-vision-nodejs.js
Created November 9, 2018 21:05
OcrVision in NodeJs
// Define your HTML/CSS
const data = {
html: "<div class='box'>Success ✅</div>",
css: ".box { border: 4px solid #03B875; padding: 20px; font-family: 'Roboto'; }",
font: "Roboto"
}
// Create an image by sending a POST to the API.
const image = await request
.post({ url: 'https://api.ocr.vision', form: data})