Skip to content

Instantly share code, notes, and snippets.

View mrbobbybryant's full-sized avatar

Bobby Bryant mrbobbybryant

View GitHub Profile
@joshlevinson
joshlevinson / WP CLI commands.sh
Last active December 30, 2016 13:54
Create new VVV sites with WP CLI + wildcard hosts
vagrant ssh
cd /srv/www/
mkdir site-name && cd site-name && mkdir htdocs && cd htdocs
wp core download
wp core config --dbname=site-name --dbuser=root --dbpass=root
wp db create
wp core install --url=site-name.dev --title=Site --admin_user=admin --admin_pass=password --admin_email=admin@example.dev
@ericelliott
ericelliott / defaults-overrides.md
Last active May 7, 2023 13:52
ES6 defaults / overrides pattern

ES6 Defaults / Overrides Pattern

Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.

function foo ({
    bar = 'no',
    baz = 'works!'
  } = {}) {
@mathetos
mathetos / functions.php
Created January 23, 2015 06:18
User-Friendly Styled Content in the WordPress Editor
<?php
/*
* Add "Formats" dropdown to TinyMCE Editor
*/
function matt2015_mce_formats($buttons) {
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter('mce_buttons_2', 'matt2015_mce_formats');
@tommcfarlin
tommcfarlin / meta-data-serialization.php
Last active November 4, 2022 00:28
An example function used to demonstrate how meta data is typically saved in a WordPress theme or plugin. The gist is made public so that developers can contribute to the standard security boilerplate functionality in order to simplify, reduce, and improve our serialization functions.
<?php
/**
* An example function used to demonstrate how to use the `user_can_save` function
* that provides boilerplate security checks when saving custom post meta data.
*
* The ultimate goal is provide a simple helper function to be used in themes and
* plugins without the need to use a set of complex conditionals and constants.
*
* Instead, the aim is to have a simplified function that's easy to read and that uses
* WordPress APIs.
@8ig8
8ig8 / remote-upload-image.php
Created April 17, 2012 03:50
How To Locally Mirror Remote Images With WordPress
<?php
/*
How To Locally Mirror Remote Images With WordPress
Source: http://forrst.com/posts/Locally_Mirror_Remote_Images_With_WordPress-XSE
*/
// URL of the image you want to mirror. Girl in pink underwear for instance.
$image = 'http://i.imgur.com/Hq4QA.jpg';
@jgarber
jgarber / MIT-LICENSE.txt
Created April 4, 2012 14:57
Responsive video
Copyright (c) 2011 ZURB, http://www.zurb.com/