Skip to content

Instantly share code, notes, and snippets.

View bgrins's full-sized avatar

Brian Grinstead bgrins

View GitHub Profile
@bgrins
bgrins / make-html.js
Last active November 18, 2022 05:43
deno run -A make-html.jsx
/** @jsxImportSource https://esm.sh/preact */
import { readCSVObjects } from "https://deno.land/x/csv/mod.ts";
import { render } from "npm:preact-render-to-string";
import { existsSync } from "https://deno.land/std/fs/mod.ts";
const URL =
"https://github.com/simonw/fara-history/raw/master/FARA_All_RegistrantDocs.csv";
const FILENAME = "FARA_All_RegistrantDocs.csv";
if (!existsSync(FILENAME)) {
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/cloudflare/cloudflare-go"
"github.com/joho/godotenv"
CREATE TABLE IF NOT EXISTS
`httparchive-sandbox.crux.country_summary_082022` AS (
SELECT
DISTINCT origin,
country_code
FROM
`chrome-ux-report.materialized.country_summary`
WHERE
yyyymm = 202208
AND rank = 1000
@bgrins
bgrins / _ CrUX ranking data from BigQuery _
Last active October 6, 2022 23:16
CrUX ranking in bigquery
https://console.cloud.google.com/bigquery?sq=1095768279152:3d771c7d4d0b4ce7aa31a8846a279904
https://github.com/GoogleChrome/CrUX/tree/main/sql
@bgrins
bgrins / potential-pwas-httparchive.sql
Last active October 6, 2022 17:09
potential-pwas-httparchive
CREATE OR REPLACE TABLE `httparchive-sandbox.test.possible_pwas_mobile` AS
SELECT url, ServiceWorker, manifests FROM
(
SELECT
url,
IF(JSON_EXTRACT(payload, '$._pwa.serviceWorkerHeuristic') = 'true', 1, 0) AS ServiceWorker,
IF(JSON_EXTRACT(payload, '$._pwa.manifests') != '[]' AND JSON_EXTRACT(payload, '$._pwa.manifests') != '{}' AND JSON_EXTRACT(payload, '$._pwa.manifests') != '{}', 1, 0) AS manifests
FROM
`httparchive.pages.2022_06_01_mobile`
<!-- https://giphy.com/gifs/LINEFRIENDS-brown-line-friends-minini-DyQrKMpqkAhNHZ1iWe -->
<div>
<video
style="width: 500px; height: 500px; left: 0px; top: 0px"
alt="Happy Birthday Love GIF by LINE FRIENDS"
src="https://media4.giphy.com/media/DyQrKMpqkAhNHZ1iWe/giphy.mp4?cid=790b7611f0f536eb04d8a026d7d21fa04943af30ef31cfef&amp;rid=giphy.mp4&amp;ct=g"
poster="https://media4.giphy.com/media/DyQrKMpqkAhNHZ1iWe/giphy_s.gif?cid=790b7611f0f536eb04d8a026d7d21fa04943af30ef31cfef&amp;rid=giphy_s.gif&amp;ct=g"
autoplay=""
loop=""
playsinline=""
@bgrins
bgrins / aria-roles-2022.csv
Created June 17, 2022 04:57
from http archive
client total_sites role total_sites_using pct_sites_using
mobile 7940685 button 2581436 0.32508983796737939
desktop 5430532 button 1763537 0.32474479480095136
desktop 5430532 presentation 1350816 0.24874469020714729
mobile 7940685 presentation 1885381 0.23743304261534112
desktop 5430532 dialog 1237176 0.22781856363243969
desktop 5430532 navigation 1200551 0.22107428885420433
mobile 7940685 navigation 1741932 0.21936797644031969
mobile 7940685 dialog 1741422 0.2193037502432095
desktop 5430532 search 1066140 0.196323306814139
[
{ "resource": "https://x-colors.herokuapp.com/api/hex2rgb?value={{dataset.hex}}" }
]
[
{
"resource": "https://api.github.com/graphql",
"method": "POST",
"headers": {
"Authorization": "Bearer {{dataset.bearer}}"
},
"body": "{{dataset.graphql}}"
}
]
export function transform(data, options) {
console.log(data, options);
return data;
}