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
kopepasah / ddd.md
Created April 14, 2021 16:11 — forked from zsup/ddd.md
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
kopepasah / wp-filter-upload-mimes.php
Last active January 28, 2021 19:08
Filters the WordPress mime type uploads to allow for JSON files.
<?php
/**
* Allow JSON file uploads to WordPress media library.
*
* @package WordPress
*
* @author Justin Kopepasah <justin@kopepasah.com>
*/
/**
@kopepasah
kopepasah / _README.md
Created February 10, 2015 07:22
Update your WordPress git submodule quickly with this script.

Update WordPress Script

Use this script to quickly update to the latest version of WordPress.

Requirements:

  1. WordPress should be located in subdirectory of root (i.e. site-root/wp).
  2. Requires WordPress to be a git submodule.
@kopepasah
kopepasah / wpsnapshots.sh
Created August 2, 2018 15:33
Shortcut for using WP Snapshots in wp-local-docker: https://github.com/10up/wp-local-docker#wp-snapshots
#!/usr/bin/env bash
# Shortcut for WP Snapshots usage in wp-local-docker
#
# @link: https://github.com/10up/wp-local-docker#wp-snapshots
function snap() {
if [ -f "$PWD/bin/wpsnapshots.sh" ]; then
sh ./bin/wpsnapshots.sh "$@"
fi
}
@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 wp.data redux store.
wp.data.subscribe( () => {
// An array of "Always On" panel (metabox) ids to disallow disabling.
const alwaysOn = [];
// Current panels preferences
const panels = wp.data.select( 'core/edit-post' ).getPreference( 'panels' );
// Loop over the panels object.
@kopepasah
kopepasah / 6016.md
Last active October 10, 2018 01:18
Change Jetpack's Related Posts Thumbnail Size

Change Jetpack's Related Posts Thumbnail Size

Full tutorial can be found on kopepasah.com.

License

GNU General Public License v2 or later.

This code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

@mixin breakpoint( $start, $stop: null ) {
$breakpoints: (
'small': 480px,
'medium': 720px,
'large': 960px,
'huge': 1200px,
'container': $container,
);
$start: validate-point( $start, $breakpoints );

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
kopepasah / terminus-update-wp-core.sh
Created November 16, 2017 07:44
Updates WordPress Core on the Pantheon hosting platform using Terminus.
#!/bin/bash
echo "Preparing update..."
terminus login --email=your@email.com -q
terminus connection:set site.dev sftp -q
echo "Validating update..."
if [[ $(terminus wp site.dev -- core check-update) == *"WordPress is at the latest version"* ]] 2>/dev/null; then
terminus wp site.dev -- core version --extra 2>/dev/null
echo "No WordPress Core update to apply."
@kopepasah
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} {