Skip to content

Instantly share code, notes, and snippets.

View kopepasah's full-sized avatar
Solving problems with bots.

Justin Kopepasah kopepasah

Solving problems with bots.
View GitHub Profile
kopepasah /
Created April 14, 2021 16:11 — forked from zsup/
Documentation-Driven Development (DDD)

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified documentation-first.
  • When documentation is modified, so should be the tests.
kopepasah / wp-filter-upload-mimes.php
Last active January 28, 2021 19:08
Filters the WordPress mime type uploads to allow for JSON files.
* Allow JSON file uploads to WordPress media library.
* @package WordPress
* @author Justin Kopepasah <>
kopepasah / wp-always-on-panels.js
Last active April 30, 2019 09:26
Ensure some panels are "Always On".
// Subscribe to changes in the redux store. () => {
// An array of "Always On" panel (metabox) ids to disallow disabling.
const alwaysOn = [];
// Current panels preferences
const panels = 'core/edit-post' ).getPreference( 'panels' );
// Loop over the panels object.
kopepasah /
Created August 2, 2018 15:33
Shortcut for using WP Snapshots in wp-local-docker:
#!/usr/bin/env bash
# Shortcut for WP Snapshots usage in wp-local-docker
# @link:
function snap() {
if [ -f "$PWD/bin/" ]; then
sh ./bin/ "$@"

Reset Audio & Video, w/o restarting your Mac

A couple handy commands to help you restart your audio and video during a call, without restarting your computer.

kopepasah /
Created November 16, 2017 07:44
Updates WordPress Core on the Pantheon hosting platform using Terminus.
echo "Preparing update..."
terminus login -q
terminus connection:set sftp -q
echo "Validating update..."
if [[ $(terminus wp -- core check-update) == *"WordPress is at the latest version"* ]] 2>/dev/null; then
terminus wp -- core version --extra 2>/dev/null
echo "No WordPress Core update to apply."
kopepasah / colors-with-quoted-keys.scss
Last active October 19, 2017 17:10
Example code for the case to always use quotes in Sass maps.
$colors: (
"blue": "#2b55f3",
"green": "#39dd4a",
"yellow": "#f0f30f",
"red": "#ff2e35",
"orange": "#f8ad55",
@each $name, $color in $colors {
.#{$name} {
@mixin breakpoint( $start, $stop: null ) {
$breakpoints: (
'small': 480px,
'medium': 720px,
'large': 960px,
'huge': 1200px,
'container': $container,
$start: validate-point( $start, $breakpoints );
kopepasah / redirect-lost-posts.php
Created January 13, 2017 06:11
Simple redirect function to correctly redirect lost posts.
* Redirect Lost Posts
* @author Justin Kopepasah <>
* @license MIT
add_action( 'template_redirect', function() {
// Only redirect if nothing is found.
if ( is_404() ) {
kopepasah / wp-menu-separator.php
Created November 16, 2016 07:06
Simple filter for adding a menu separator at a specific location on the WordPress admin menu.
* Adds a separator to the administration menus in a specific location.
* @param array $menu Associative array of administration menu items.
* @return array $menu Modified associative array of administration menu items.
add_filter( 'add_menu_classes', function( $menu ) {
$menu['44'] = array(