This is a collection of scripts, bash functions, and config files that help me do WordPress core development.
/wp
: parent folder/wp/svn
: SVN checkout/wp/git
: Git checkout/wp/{ git | svn }/wp-test-config.php
: see attached file
float fillColor; | |
void setup() { | |
size(300, 200); | |
background(255, 255, 255); | |
fill(0, 0, 0); | |
// Draw one bar graph on the left, starting from the bottom and working clockwise | |
//=============================================================================== | |
import React from 'react'; | |
import { render, cleanup, fireEvent } from '@testing-library/react'; | |
import { useSelect, useDispatch } from '@wordpress/data'; | |
import '@testing-library/jest-dom/extend-expect'; | |
import { storeProvider } from '../store-provider'; | |
describe('storeProvider', () => { | |
afterEach(cleanup); |
import processing.pdf.*; | |
//boolean saveOneFrame = false; | |
int randomInt( int min, int max ) { | |
return floor( random( min, max ) ); | |
} | |
void dashedHorizontalLine( int x1, int y1, int x2, int y2 ) { | |
if ( y1 != y2 ) { |
var { convert, svgify } = (() => { | |
function sum( collection, prop ) { | |
return collection.reduce( ( sum, item ) => sum + item[prop], 0 ); | |
} | |
function testEq( a, b ) { | |
if ( a !== b ) { | |
throw new Error( `Expected ${ a } to equal ${ b }` ); | |
} | |
} |
#!/usr/bin/env node | |
/* | |
This script will clip a segment of a video file into a gif, using techniques | |
described in these resources: | |
https://engineering.giphy.com/how-to-make-gifs-with-ffmpeg/ | |
https://video.stackexchange.com/questions/4563/how-can-i-crop-a-video-with-ffmpeg | |
https://askubuntu.com/questions/648603/how-to-create-an-animated-gif-from-mp4-video-via-command-line | |
https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo |
const { blocks, plugins } = wp; | |
const { dispatch, select } = wp.data; | |
/** | |
* When a selected block is being disposed during a hot module reload, persist | |
* its clientId so it may be reselected after the new module version loads. | |
* | |
* If the block being unloaded is currently selected, clear that selection to | |
* avoid a Gutenberg error that occurs when unregistering a selected block. | |
* |
/* eslint-disable no-console */ | |
/** | |
* A little module that adds a wpapi() method to the window object. | |
* | |
* wpapi() takes an API path (e.g. /wp/v2/posts), optionally containing string query parameters, | |
* or a query-less API path and a hash object of query param objects. | |
*/ | |
( context => { | |
const { root, nonce } = context.WP_API_Settings; |
/* | |
------------- | |
mkdirp usage: | |
------------- | |
var mkdirp = require('mkdirp'); | |
mkdirp('/tmp/foo/bar/baz', function (err) { | |
if (err) console.error(err) | |
else console.log('pow!') |