Skip to content

Instantly share code, notes, and snippets.

@chasers
chasers / simple-logflare-cloudflare-worker.js
Created November 23, 2021 16:01
Simple Logflare Cloudflare worker no batching.
const makeid = length => {
let text = ""
const possible = "ABCDEFGHIJKLMNPQRSTUVWXYZ0123456789"
for (let i = 0; i < length; i += 1) {
text += possible.charAt(Math.floor(Math.random() * possible.length))
}
return text
}
const buildMetadataFromHeaders = headers => {
@chasers
chasers / logflare_cloudflare_worker_with_batching.js
Created May 17, 2021 17:07
logflare_cloudflare_worker_with_batching
const sleep = ms => {
return new Promise(resolve => {
setTimeout(resolve, ms)
})
}
const makeid = length => {
let text = ""
const possible = "ABCDEFGHIJKLMNPQRSTUVWXYZ0123456789"
for (let i = 0; i < length; i += 1) {
!function() {
var doc = document,
htm = doc.documentElement,
lct = null, // last click target
nearest = function(elm, tag) {
while (elm && elm.nodeName != tag) {
elm = elm.parentNode;
}
return elm;
};