Skip to content

Instantly share code, notes, and snippets.

Justin Kopepasah kopepasah

Block or report user

Report or block kopepasah

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
@kopepasah
kopepasah / wp-always-on-panels.js
Last active Apr 30, 2019
Ensure some panels are "Always On".
View wp-always-on-panels.js
// 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.
View wpsnapshots.sh
#!/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
}
View _readme.md

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 Nov 16, 2017
Updates WordPress Core on the Pantheon hosting platform using Terminus.
View terminus-update-wp-core.sh
#!/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 Oct 19, 2017
Example code for the case to always use quotes in Sass maps.
View colors-with-quoted-keys.scss
$colors: (
"blue": "#2b55f3",
"green": "#39dd4a",
"yellow": "#f0f30f",
"red": "#ff2e35",
"orange": "#f8ad55",
);
@each $name, $color in $colors {
.#{$name} {
View breakpoint.sass
@mixin breakpoint( $start, $stop: null ) {
$breakpoints: (
'small': 480px,
'medium': 720px,
'large': 960px,
'huge': 1200px,
'container': $container,
);
$start: validate-point( $start, $breakpoints );
@kopepasah
kopepasah / redirect-lost-posts.php
Created Jan 13, 2017
Simple redirect function to correctly redirect lost posts.
View redirect-lost-posts.php
<?php
/**
* Redirect Lost Posts
*
* @author Justin Kopepasah <justin@kopepasah.com>
* @license MIT
*/
add_action( 'template_redirect', function() {
// Only redirect if nothing is found.
if ( is_404() ) {
@kopepasah
kopepasah / wp-menu-separator.php
Created Nov 16, 2016
Simple filter for adding a menu separator at a specific location on the WordPress admin menu.
View wp-menu-separator.php
<?php
/**
* 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(
@kopepasah
kopepasah / _get-parameters.md
Last active Nov 4, 2015
A simple JavaScript helper method for getting the query parameters of a URL and storing those parameters as an object.
View _get-parameters.md

Get Parameters

A simple JavaScript helper method for getting the query parameters of a URL and storing those parameters as an object. If no parameters are present, the method will return false.


Author: Justin Kopepasah justin@kopepasah.com
License: MIT https://opensource.org/licenses/MIT

@kopepasah
kopepasah / textmate-softwrap-example.js
Last active Oct 22, 2015
Demonstration of soft wrap in TextMate based on a wrap column setting of 80, even thought soft wrap is disabled.
View textmate-softwrap-example.js
|
|
// This is a comment that will be wrapped by softwrap (while other code is not |
softwrapped) when softwrap is disabled but wrap column is set to 80. |
$(function(){ |
$( 'example-code-no-wrapped' ).not().ever.().wrapped().no().matter().how().long().the().code().runs();
$( 'example-code-wrapped' |
).unnecesarily.wrapped().because().of().a().comment(); // Comment |
forces softwrap. |
}); |
You can’t perform that action at this time.