Skip to content

Instantly share code, notes, and snippets.

View ddbeck's full-sized avatar

Daniel D. Beck ddbeck

View GitHub Profile
@ddbeck
ddbeck / brwoser-releases-to-csv.mjs
Created September 7, 2023 08:12
Statcounter + BCD cleanup tools
import { query } from '../src/index.js'; // You'll have to sort this bit out yourself. It's the pre-TS version of https://github.com/mdn/browser-compat-data/blob/main/utils/query.ts
import TSV from 'tsv';
const browsers = [
'chrome',
'edge',
'firefox',
'opera',
'safari',
'samsunginternet_android',
@ddbeck
ddbeck / _CSS.txt
Created March 23, 2022 10:56
Multi-spec BCD entries as of 2022-03-23
css.at-rules.media
https://drafts.csswg.org/mediaqueries/#media-descriptor-table
https://drafts.csswg.org/css-conditional-3/#at-media
css.at-rules.supports
https://drafts.csswg.org/css-conditional-4/#at-supports-ext
https://drafts.csswg.org/css-conditional-3/#at-supports
css.properties.align-content.flex_context
https://drafts.csswg.org/css-align/#align-justify-content
https://drafts.csswg.org/css-flexbox/#align-content-property
css.properties.align-content.grid_context
@ddbeck
ddbeck / testcases.js
Last active October 28, 2020 12:52
test cases for isVersionAddedGreater(a, b)
const assert = require('assert');
const compareVersions = require('compare-versions');
function isVersionAddedGreater(a, b) {
var a_version_added = a;
var b_version_added = b;
if (
typeof a_version_added === 'string' &&
typeof b_version_added === 'string'
@ddbeck
ddbeck / git-sync
Last active December 8, 2020 16:44
#!/usr/bin/env bash
# If you save this as `git-sync` in your PATH, then you can run `git sync`
# shellcheck disable=SC2034
USAGE="Synchronize the local and origin \`master\` branch with \`upstream\` remote's"
# shellcheck source=/dev/null
source "$(git --exec-path)/git-sh-setup"
@ddbeck
ddbeck / all_safaris.txt
Created July 9, 2019 13:03
Features potentially affected by WebKit misnumbering
api.DOMMatrix
api.DOMMatrix.DOMMatrix
api.DOMMatrix.worker_support
api.DocumentOrShadowRoot.elementsFromPoint
api.PaymentRequest
api.PaymentRequest.PaymentRequest
api.PaymentRequest.abort
api.PaymentRequest.canMakePayment
api.PaymentRequest.id
api.PaymentRequest.onshippingaddresschange
const visit = require('unist-util-visit')
function transformer(tree, file) {
visit(tree, 'element', (node, index, parent) => {
if (node.tagName === 'div' && node.properties.className && node.properties.className.includes('bc-data')) {
parent.children.splice(index, 1);
}
});
}
@ddbeck
ddbeck / 001-example.md.raw
Last active June 11, 2019 11:14
Multiple examples in Markdown
---
type: static
---
<!--
This is the raw Markdown as you would write it for an example. Note the flags in the info string of each code block.
-->
Suppose you want to list the winners of a competition:
  • Do the hardest thing first
  • Do the easiest thing first
  • Choose three things to do and a reward for doing them
  • Pomodoro Technique (short): 25 minutes working / 5 minute break
  • Pomodoro Technique (medium): 25 minutes working / 5 minute break / repeat x 2
  • Pomodoro Technique (long): 25 minutes working / 5 minute break / repeat x 4 / 25 minute break
  • Do the next physically possible thing on your list
  • Set timers for the Fibonacci sequence: 1, 1, 2, 3, 5, 8, 13, …
  • Set timers for an exponential sequence: 1, 2, 4, 8, 16, 32, …
  • Set timers for tens of minutes: 10, 20, 30, 40, 50, 60, …
@ddbeck
ddbeck / mockup.html
Created August 26, 2018 16:03
Low fidelty mockups for mdn/data CSS summaries
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<style>
body {
font-family: "Open Sans", Arial;
}
div {
padding: 1em;
const fs = require('fs');
const request = require('request');
const properties = 'css/properties.json';
const urlTemplate = 'https://developer.mozilla.org/docs/Web/CSS/{{replaceme}}';
const urlRegex = new RegExp('{{replaceme}}');
function main() {
const obj = parseJSONFile(properties);
let lookups = {};