Skip to content

Instantly share code, notes, and snippets.

Jon Desrosiers desrosj

Block or report user

Report or block desrosj

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
View admin-notice-variations.php
<?php
function demo_notice_add() {
?>
<div class="notice"><p>This is a notice without a type.</p></div>
<div class="notice is-dismissible"><p>This is a dismissible notice without a type.</p></div>
<div class="updated"><p>Your action succeeded!</p><p><a href="" class="button">Test Button</a></p></div>
<div class="error"><p>My error notice text1</p></div>
<div class="notice notice-success is-dismissible"><p>My dismissible success notice text</p></div>
View image-source-sets.php
<?php
/**
* Get a list of default source sets.
*
* @since 1.0.0
*
* @return array Default source sets.
*/
function bu_banners_get_default_source_sets() {
$source_sets = array(
View vvv-custom.yml
---
sites:
wordpress-default:
repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-default.git
hosts:
- local.wordpress.test
wordpress-develop:
repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template-develop.git
hosts:
View gist:0dd0c3017a56af4a6f32a31a5caf1c51
This file has been truncated, but you can view the full file.
$ vagrant up
__ __ __ __
\ V\ V\ V / Varying Vagrant Vagrants
\_/\_/\_/ v2.2.2-develop-git::develop
Platform: darwin13.4.0 shell:/bin/bash
Vagrant: 2.1.1
VirtualBox: 5.2.12r122591
@desrosj
desrosj / constant-tests.php
Created Jan 9, 2018
Class structure for WordPress unit tests where constants need to be tested
View constant-tests.php
class Tests_For_Stupid_Constants extends WP_UnitTestCase {
/**
* Do not preserve global state between test methods.
*
* @var bool
*/
protected $preserveGlobalState = false;
/**
@desrosj
desrosj / vvv-custom.yml
Last active May 18, 2018
My current Varying Vagrant Vagrants custom configuration file.
View vvv-custom.yml
---
sites:
wordpress-default:
repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-default.git
hosts:
- local.wordpress.test
nginx_upstream: php72
wordpress-develop:
repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-develop.git
View dbDelta Failing Tests.txt
vagrant@vvv:/srv/www/wordpress-develop/public_html$ phpunit --group dbdelta
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 5.7.16 by Sebastian Bergmann and contributors.
WordPress database error Specified key was too long; max key length is 1000 bytes for query
CREATE TABLE wptests_dbdelta_test (
View Getting all posts without a no LIMIT query
<?php
$posts = array();
$args = array(
'posts_per_page' => 100,
'offset' => 0,
'post_type' => 'post',
'post_status' => 'publish',
);
@desrosj
desrosj / heartbeat_allowed.php
Last active Feb 10, 2016 — forked from JPry/heartbeat_allowed.php
Note that you must change "plugins.php" to match whatever page you want to allow.
View heartbeat_allowed.php
<?php
/**
* Plugin Name: Allow Heartbeat for Gravity Forms on WP Enting
* Plugin URI: https://gist.github.com/desrosj/409a17b718f07d1190b7
* Description: Allow the Heartbeat API on Gravity Form related edit pages on WP Engine. Fork of https://gist.github.com/JPry/b1f6c55a5d5337557f97
* Version: 1.0
* Author: Jonathan Desrosiers
* Author URI: http://jonathandesrosiers.com/
* License: GPL2
*/
You can’t perform that action at this time.