Skip to content

Instantly share code, notes, and snippets.

View ryanwelcher's full-sized avatar
:octocat:
Working from home

Ryan Welcher ryanwelcher

:octocat:
Working from home
View GitHub Profile
@ryanwelcher
ryanwelcher / functionNameCamelCase.php
Last active February 26, 2016 19:10
Core Unit Test Example
<?php
/**
*
*
*/
Tests_Component_FunctionInCamelCase extends WP_UnitTestCase {
/**
@ryanwelcher
ryanwelcher / forth-unit-test-35272.php
Last active October 27, 2016 00:59 — forked from christophherr/forth-unit-test-35272.php
Forth unit test 35272
function test_class_not_applied_to_page_item() {
$page_id1 = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Home Page' ) );
$page_id2 = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Test Page' ) );
update_option( 'page_on_front', $page_id1 );
wp_update_nav_menu_item( $this->menu_id, 0, array(
'menu-item-type' => 'post_type',
'menu-item-object' => 'page',
@ryanwelcher
ryanwelcher / gist:0738af9d078e354071ce
Last active December 8, 2016 13:46
Docblock for WordPress PHPUnit dataProvider
/**
*
* Data provider
*
* Description
*
* @see {method name receiving data}
*
* @since x.x.x
*
@ryanwelcher
ryanwelcher / gist:64042dc1946f36840b61
Last active November 14, 2017 13:22
is_active_sidebar incorrectly returning true after plugin deactivation
add_filter( 'is_active_sidebar', function( $is_active_sidebar, $index ) {
global $wp_registered_widgets;
$widgets = wp_get_sidebars_widgets();
$widget_area_contents = $widgets[ $index ];
$active_widget_count = count( $widget_area_contents );
foreach ( $widgets[ $index ] as $widget_instance ) {
echo sprintf( esc_html__( '%s | %s', 'ms-research' ), '123434', '<script>alert(\'Sprintf\')</script>' );
echo esc_html__( sprintf( '%s | %s', '1234', '<script>alert(\'adsfasdfasdf\')</script>' ), 'ms-research' );
printf( esc_html__( 'Your city is %1$s, and your zip code is %2$s.', 'my-text-domain' ), 'Thing', '<script>alert(\'codex\')</script>' );
@ryanwelcher
ryanwelcher / .eslint
Created September 24, 2018 15:34
ESlnt for using prettier
module.exports = {
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
generators: true,
experimentalObjectRestSpread: true
},
sourceType: 'module',
allowImportExportEverywhere: false
},
rsync -azv -P gravityforms 10uplabs.com:wordpress/cpac/wp-content/plugins
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
const { Component } = wp.element;
const { ServerSideRender } = wp.components;
const { BlockControls, InnerBlocks } = wp.blockEditor;
import LivePreviewButton from '../../components/live-preview-button';
class EditComponent extends Component {
constructor(props) {
super(props);
server {
listen 80;
listen 443 ssl;
server_name {{DOMAINS_HERE}};
root {vvv_path_to_site}/public_html;
error_log {vvv_path_to_site}/log/error.log;
access_log {vvv_path_to_site}/log/access.log;
set $upstream php56;
include /etc/nginx/nginx-wp-common.conf;
location ~ ^/wp-content/uploads/sites/9/(.*\.(js|css|png|jpg|jpeg|gif|ico|mp3|mov))$ {