Skip to content

Instantly share code, notes, and snippets.

Working from home

Paul de Wouters pdewouters

Working from home
View GitHub Profile
View youtube.js
import React, { useRef, useEffect } from 'react';
import PropTypes from 'prop-types';
import { Waypoint } from 'react-waypoint';
function Youtube( { youtubeId } ) {
const playerRef = useRef( null );
const elementRef = useRef( null );
const loadVideo = () => {
const player = new window.YT.Player( elementRef.current, {
View gist:c37b30462a3d49a9bdd6f66d0b4cd626
find . -type d \( -name wordpress -o -name .bin -o -name .circleci -o -name .config -o -name .ebextensions -o -name .github -o -name __mocks__ -o -name node_modules -o -name chassis -o -name .tests -o -name vendor -o -name uploads \) -prune -o -name "*.php" -print0 | xargs -0 -n 1 -P 4 php -l > /dev/null
pdewouters /
Created Aug 23, 2019
List repos for an org which dont have a readme
hub api orgs/humanmade/repos --paginate | npx jq -r '.[] | select(.archived != true) | .full_name' | while read -r i; do
if [[ $(hub api repos/"$i"/readme | npx jq -r '.name') = 'null' ]]; then
echo "$i has no readme"
View gist:b5fcc0ff9e48d76df08663343e1207e4
// /content/plugins/multilingualpress3/src/multilingualpress/Cache/NavMenuItemsSerializer.php
$menuItem = $postArray['menu_item'] ?? [];
foreach (self::MENU_ITEM_ALLOWED_PROPERTIES as list($property, $type, $default)) {
if (!isset($post->{$property})) {
$post->{$property} = $this->extractValue($menuItem, $property, $type, $default);
$this->unserialized[] = $post;
View gist:345664139b408e1d8dc99f3899fe77c8
// Update only a specific package with its dependencies
composer update --ignore-platform-reqs humanmade/coding-standards --with-dependencies
// Update packages (ignore platform requirements)
composer update --ignore-platform-reqs
View chassis error
Installing Chassis into /Users/paul/altistest/chassis
Cloning into '/Users/paul/altistest/chassis'...
remote: Enumerating objects: 947, done.
remote: Counting objects: 100% (947/947), done.
remote: Compressing objects: 100% (736/736), done.
remote: Total 17683 (delta 272), reused 447 (delta 202), pack-reused 16736
Receiving objects: 100% (17683/17683), 46.14 MiB | 6.07 MiB/s, done.
Resolving deltas: 100% (11919/11919), done.
Submodule 'puppet/modules/apt' ( registered for path 'puppet/modules/apt'
Submodule 'puppet/modules/mysql' ( registered for path 'puppet/modules/mysql'
View gist:92af5d06f95fa201edf5b3c19809661b
import React, { useState, useEffect } from "react";
export default function QuoteBox() {
const API_URL = "[orderby]=rand&filter[posts_per_page]=1";
const [quote, setQuote] = useState({});
const [isLoading, setLoading] = useState(false);
async function queryAPI() {
const response = await fetch(API_URL);
pdewouters /
Last active Feb 4, 2019 — forked from jazzsequence/
Template for How I Like to Work posts

How I work

This is my own interpretation of how I like to work, feedback welcome! Especially if my own view of how I think I like to work doesn't match your experience of how it seems I like to work!

When I work

Timezone: GMT I work 9 to 5 6-8 hours per day I don't work at the weekend I can be available after hours on occasion, if it's justified.

View gist:a1e52bafd98b7ce2c7599070b3403b36
# Task
Implement a recursive function that returns all of the unique dependencies, and sub-dependencies of a module, sorted alphabetically. Dependencies should be printed as dependency@version e.g. 'inflection@1.2.6'.
Multiple versions of the same module are allowed, but duplicates modules of the same version should be removed.
## Arguments:
* tree: A dependency tree. See below for an example of the structure.
View api.json
{"features":[{"id":"5943b3abda50f","name":"Documents","type":"feature-about","icon":"35","sorting":"manual","sections":[{"id":"592","type":"about-section","title":"Despatch letters","content":"<p><a href=\"https:\/\/\/content\/uploads\/2017\/05\/2017-NDC-first-despatch-letter.pdf\">First despatch letter<\/a><\/p>\n"},{"id":"589","type":"about-section","title":"Standing orders","content":"<p>Standing orders will appear here<\/p>\n"},{"id":"586","type":"about-section","title":"Key Documents","content":"<p><a href=\"https:\/\/\/content\/uploads\/2017\/06\/24415.pdf\"><br \/>\nAbout conference<\/a><\/p>\n<p><a href=\"https:\/\/\/content\/uploads\/2017\/06\/24394.pdf\">Conference document<\/a><\/p>\n<p><a href=\"https:\/\/\/content\/uploads\/2017\/06\/2017-National-Delegate-Conference_Composite_Booklet_Final4.pdf\">Conference composite booklet<\/a><\/p>\n<p><a href=\"https:\/\/\/content\/uploads\/2017\/05\/UNISONAnnual-Report-2017