Skip to content

Instantly share code, notes, and snippets.

Andrew Duthie aduth

Block or report user

Report or block aduth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View get-merge-authors.js
const { get } = require( 'https' );
const { parse } = require( 'url' );
const pulls = [
'https://github.com/WordPress/gutenberg/pull/14003',
'https://github.com/WordPress/gutenberg/pull/14469',
'https://github.com/WordPress/gutenberg/pull/14475',
'https://github.com/WordPress/gutenberg/pull/14681',
'https://github.com/WordPress/gutenberg/pull/14693',
'https://github.com/WordPress/gutenberg/pull/14711',
@aduth
aduth / get-merge-commits.js
Created Apr 15, 2019
Generate cherry-pick commands from a set of pull requests
View get-merge-commits.js
const { get } = require( 'https' );
const { parse } = require( 'url' );
const pulls = [
'https://github.com/WordPress/gutenberg/pull/14003',
'https://github.com/WordPress/gutenberg/pull/14469',
'https://github.com/WordPress/gutenberg/pull/14475',
'https://github.com/WordPress/gutenberg/pull/14681',
'https://github.com/WordPress/gutenberg/pull/14693',
'https://github.com/WordPress/gutenberg/pull/14711',
View abstract-block-type.js
registerBlockType( 'core/colorable', {
abstract: true,
attributes: {
color: {
type: 'string',
},
},
edit: () => (
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Pop vs. Splice negative</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Number Cast</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@aduth
aduth / index.html
Created Dec 13, 2018
Gutenberg - Optimize runSelector (http://jsbench.github.io/#479cdbd5b639b3eff88dede976893a25) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Gutenberg - Optimize runSelector</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@aduth
aduth / with-caching.txt
Created Nov 6, 2018
@tannin/sprintf vs. sprintf-js
View with-caching.txt
sprintf-js: hello %s! x 3,492,089 ops/sec ±0.35% (93 runs sampled)
@tannin/sprintf: hello %s! x 1,737,159 ops/sec ±0.38% (87 runs sampled)
@aduth
aduth / paste.html
Created Nov 5, 2018
Pasted Google Doc HTML
View paste.html
<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-6a3f5726-7fff-f826-dcd7-8eef2659d75a"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><a href="https://drive.google.com/drive/u/0/folders/1k4bWkN088Hte1mehmPkKZHbois4Zjsar" style="text-decoration:none;"><span style="font-size:11pt;font-family:Arial;color:#1155cc;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:underline;-webkit-text-decoration-skip:none;text-decoration-skip-ink:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">(View All Agendas)</span></a></p><br /><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Slack Transcript:</span><span style="font-size:11pt;font-family:A
@aduth
aduth / blocks.js
Created Oct 2, 2018
Data Module - withSelect & withDispatch
View blocks.js
( function( blocks, element, data, components, compose ) {
var el = element.createElement;
blocks.registerBlockType( 'my-demo/demo-block-select', {
title: 'Demo Block (Select)',
icon: 'format-aside',
category: 'common',
@aduth
aduth / gitco.sh
Created Jun 11, 2018
Git Checkout GitHub Remote Branch
View gitco.sh
#!/bin/bash
# https://stackoverflow.com/a/26843249/995445
IFS=':' read -ra parts <<< "$1"
if [ ${#parts[@]} == 1 ]; then
branch=${parts[0]}
else
remote=${parts[0]}
branch=${parts[1]}
fi
You can’t perform that action at this time.