Skip to content

Instantly share code, notes, and snippets.

View rachelbaker's full-sized avatar

Rachel Baker rachelbaker

View GitHub Profile
<?php
/**
* Iterates over results of a query, split into many queries via LIMIT and OFFSET
*/
class QueryIterator implements Iterator {
var $limit = 500;
var $query = '';
var $global_index = 0;
/* ---------------------------------------------------------------------
Modal Base JavaScript
Target Browsers: All
Author: Rachel Baker
------------------------------------------------------------------------ */
// Namespace Object
var APP = APP || {};
<?php
/**
* Unit tests covering WP_JSON_Posts functionality.
*
* @package WordPress
* @subpackage JSON API
*/
class WP_Test_JSON_Post extends WP_UnitTestCase {
public function setUp() {
parent::setUp();
<?php
/**
* Retrieve a meta for a post.
*
* @uses get_post_custom()
*
* @param int $id Post ID
* @param string $key
* @return array Post meta fields and values
*/

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
function test_get_revisions_without_permission() {
$this->markTestSkipped( 'https://github.com/WP-API/WP-API/issues/251' );
$user = wp_get_current_user();
$user->add_cap( 'publish_posts', false );
// Flush capabilities, https://core.trac.wordpress.org/ticket/28374
$user->get_role_caps();
$user->update_user_level_from_caps();
$response = $this->endpoint->get_revisions( $this->post_id );
@rachelbaker
rachelbaker / tax-example-response.json
Created June 2, 2014 15:20
Example response for a taxonomy for a request to GET /taxonomies/
{
"name":"Tags",
"slug":"post_tag",
"labels":{
"name":"Tags",
"singular_name":"Tag",
"search_items":"Search Tags",
"popular_items":"Popular Tags",
"all_items":"All Tags",
"parent_item":null,
<h2>Rachel Baker</h2>
<p>Rachel Baker (<a href="http://twitter.com/rachelbaker">@rachelbaker</a>)
is a Senior Strategic Engineer with <a href="http://10up.com">10up</a> and
an active member of the WordPress community. Rachel has lead development on
WordPress projects of all sizes including high-traffic communities and for
Fortune 500 Companies. She created the popular
<a href="http://bootstrapwp.rachelbaker.me/">BootstrapWP Theme</a> and has
been instrumental in developing the new WordPress JSON REST API coming in WordPress 4.1.</p>
[diff]
tool = opendiff
[difftool]
prompt = false
[difftool "opendiff"]
cmd = /usr/bin/opendiff \"$LOCAL\" \"$REMOTE\" -merge \"$MERGED\" | cat
[merge]
tool = opendiff
[mergetool "opendiff"]
cmd = /usr/bin/opendiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
/* ============================================================
* async-share.js v1.8.0
* @author: Rachel Baker
*
* Credits:
* Inspired by Stoyan Stefanov and Aaron Peters
* ============================================================
* Copyright 2013 Rachel Baker
*
* This program is free software: you can redistribute it and/or modify