Skip to content

Instantly share code, notes, and snippets.

Avatar

Jim Nielsen jimniels

View GitHub Profile
View ephmeralist.html
<!DOCTYPE html>
<title>Ephemeralist</title>
<style>
body {
max-width: 800px;
font-family: sans-serif;
}
img {
max-width: 100%;
height: auto;
@jimniels
jimniels / netlify-analytics-digest.js
Last active May 15, 2022
Example code that pulls data from the Netlify Analytics API (unofficial, v2) and creates HTML that can be sent in an email. Read more: https://blog.jim-nielsen.com/2022/netlify-analytics-email-digest/
View netlify-analytics-digest.js
const fetch = require("node-fetch");
const now = Date.now();
const oneDayAgo = now - 24 * 60 * 60 * 1000;
const { NETLIFY_BLOG_SITE_ID, NETLIFY_TOKEN } = process.env;
exports.handler = async function (event) {
try {
// Fetch the data
const sources = await fetchNetlify(
`ranking/sources?from=${oneDayAgo}&to=${now}&limit=100&timezone=-0700&resolution=hour`
View parse-feed-urls.js
// The idea axplained here:
// https://blog.jim-nielsen.com/2021/feed-urls/
// deno run --allow-net parse-feed-urls.js
import { DOMParser } from "https://deno.land/x/deno_dom@v0.1.13-alpha/deno-dom-wasm.ts";
import * as path from "https://deno.land/std@0.106.0/path/mod.ts";
import { parse } from "https://cdn.skypack.dev/tldts";
const urls = await getFeedUrls();
const urlCollection = createUrlCollection(urls);
@jimniels
jimniels / _pac.md
Last active May 24, 2019
Future of pac
View _pac.md

Future of Pac (Rulesets, Dynamic Actions, etc.)

We want to cede control of Pac-related post bind policy actions to folks outside of the engineering group, namely Product and Product Implementation. This will be controlled in two different places

  1. The product will control visibility of postbind policy actions and their functionality on a product-by-product basis.
  2. Launch darkly flags will control visibility of postbind policy actions and their functionality on a user-by-user basis.

Note: the underlying assumption of the following solution is that every policy action (and accompanying rulesets feature functionality) is considered “turned off” for everyone by default. From there, each action is “turned on” through a combination of product form <Meta> tags and launch darkly flags.

A user will only be able to complete a particular post bind policy action IF: