Skip to content

Instantly share code, notes, and snippets.

View mxdvl's full-sized avatar
🧭
I love me an SVG

Max Duval mxdvl

🧭
I love me an SVG
View GitHub Profile
@mxdvl
mxdvl / keybase.md
Last active June 10, 2018 11:15
Keybase Proof of identity for MXDVL.

Keybase proof

I hereby claim:

  • I am mxdvl on github.
  • I am mxdvl (https://keybase.io/mxdvl) on keybase.
  • I have a public key ASC_nJnqoIaJM9yROJQv2TuqBn0dRiaP-Eqw4wM1zjL4tgo

To claim this, I am signing this object:

@mxdvl
mxdvl / CacheBustingKirbyValetDriver.php
Last active August 2, 2018 14:16 — forked from stidges/CacheBustingLaravelValetDriver.php
Rewrite filename-based cache busting URIs (e.g. jquery.1476809927.js) to the correct filename in Laravel Valet
<?php
class CacheBustingKirbyValetDriver extends KirbyValetDriver
{
public function isStaticFile($sitePath, $siteName, $uri)
{
$result = parent::isStaticFile($sitePath, $siteName, $uri);
if ($result !== false) {
return $result;
}
if (preg_match('/(.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif|svg|mp3|mp4|ogg)$/i', $uri, $matches)) {
@mxdvl
mxdvl / mxdvl-cmps.svg
Last active December 31, 2021 17:53
SVG logo for using as avatar.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Screenshot comparison table

Before After
before after
@mxdvl
mxdvl / guardian-node-versions.ts
Last active January 15, 2021 21:52
Guardian Repos
import { writeCSV } from "https://deno.land/x/csv/mod.ts";
const repos = await fetch("https://api.github.com/orgs/guardian/repos?per_page=100&sort=updated&direction=desc").then(r => r.json())
const columns = ["name", "updated_at", "language"]
const f = await Deno.open("./guardian-repos.csv", { write: true, create: true, truncate: true });
const rows = [
columns,
@mxdvl
mxdvl / default_branch.ts
Created February 4, 2021 15:11
Default @guardian repo branches
const user = "orgs/guardian";
const repos = await fetch(
`https://api.github.com/${user}/repos?per_page=100&sort=updated&direction=desc`,
).then((r) => r.json());
type Repo = Record<string, string>;
repos
.filter((repo: Repo) => repo.default_branch !== "main")
@mxdvl
mxdvl / git.zsh
Last active July 21, 2023 19:20
Useful CLI commands
function git_remove_gone_branches() {
# from https://stackoverflow.com/a/61935602/1577447, except works with squash & merge strategy.
git fetch -p
git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D
}
@mxdvl
mxdvl / non-blocking-document.createElement.html
Last active January 22, 2024 23:16 — forked from sndrs/non-blocking-document.write.html
Override document.createElement('script') to prevent 3rd parties injecting blocking scripts
<!DOCTYPE html>
<html>
<head>
<title>Prevent non-async script</title>
<script>
(function(Document) {
const trueCreate = document.createElement.bind(document);
Document.prototype.createElement = function(tag, options) {
const script = trueCreate(tag, options);
@mxdvl
mxdvl / bookmarklet
Last active May 4, 2022 14:18
Ophan Component Viewer
javascript:(function()%7Bfetch(%22https%3A%2F%2Fgist.githubusercontent.com%2Fmxdvl%2Fb17f344678ed34d45683896e208ecdc1%2Fraw%2Fophan-components.css%22).then(r%20%3D%3E%20r.text()).then(css%20%3D%3E%20%7B%20const%20style%20%3D%20document.createElement(%22style%22)%3B%20style.innerHTML%20%3D%20css%3B%20document.body.appendChild(style)%3B%20%7D)%3B%7D)()%3B
@mxdvl
mxdvl / _public.md
Last active April 27, 2022 10:51
git.io in public repos
  • File PULL_REQUEST_TEMPLATE.md from guardian/content-atom

  • git.io/v7cQshttps://github.com/guardian/content-api/blob/master/docs/adding-a-new-field-to-capi.md/

  • File index.ts from guardian/consent-management-platform

  • git.io/JUmoihttps://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md

  • git.io/JUmw8https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md