Skip to content

Instantly share code, notes, and snippets.

Rachel Baker rachelbaker

Block or report user

Report or block rachelbaker

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
@rachelbaker
rachelbaker / log-affiliate-urls.js
Created Jul 24, 2017
Get all Wirecutter affiliate links from within Chrome
View log-affiliate-urls.js
jQuery( document ).ready(function() {
var affLinks = [];
jQuery('a').each(function() {
if (jQuery(this).is('[href*="wclink"]')) {
affLinks.push( jQuery(this).attr('href') );
}
});
console.log( affLinks );
View custom-comments-controller.php
<?php
function create_custom_comments_rest_routes() {
// Custom Comments.
$controller = new WP_REST_Custom_Comments_Controller();
$controller->register_routes();
}
add_action( 'rest_api_init', 'create_custom_comments_rest_routes' );
class WP_REST_Custom_Comments_Controller extends WP_REST_Comments_Controller {
@rachelbaker
rachelbaker / foodquery.php
Last active Mar 20, 2016 — forked from dianekinney/foodquery.php
Merge query for CPT and posts in a specific category
View foodquery.php
// Loop recipes and cooking posts
$recipe_args = array(
'post_type' => array( 'recipe' ),
'post_status' => 'publish',
'posts_per_page' => 4,
'fields' => 'ids', // Only fetch the post_ids here.
);
// Run the recipe query.
$recipe_query = new WP_Query( $recipe_args);
View send-reads-to-master.php
<?php
/**
* Plugin Name: Send Reads to Master
* Description: Suggested fix for backend replication lag
* Author: WP Engine
* Version: 0.2
*
*/
if ( is_admin() ) {
View 7.json
{
"request": {
"pageUrl": "http://www.walgreens.com/store/c/ology-sunscreen-lotion-spf-50/ID=prod6210342-product",
"api": "product",
"version": 3
},
"objects": [
{
"text": "I Choose to Live Well, Therefore I Choose Ology™.\nBroad Spectrum SPF 50\nOxybenzone Free\nUVA/UVB Protection\nWater Resistant (80 Minutes)\nNo Added Fragrance\nParaben & Dye Free\nHelps prevent sunburn. If used as directed with other sun protection measures (see warnings), decreases the risk of skin cancer and early skin aging caused by the sun.\nEndorsed by: Healthy Child Healthy World® - Creating Healthy Environments for Children.\nQuestions or comments? 1-800-925-4733\n100% Satisfaction guaranteed with all Walgreens products or your money back.\nApply liberally 15 minutes before sun exposure.\nReapply: After 80 minutes of swimming or sweating; immediately after towel drying; at least every 2 hours.\nChildren under 6 months of age: Ask a doctor.\nProtect this product from excessive heat and direct sun.\n©2013
View composer.json
{
"require": {
"wp-coding-standards/wpcs": "dev-develop"
},
"scripts": {
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths ~/.composer/vendor/wp-coding-standards/wpcs",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths ~/.composer/vendor/wp-coding-standards/wpcs"
}
}
@rachelbaker
rachelbaker / .jshintrc
Created May 7, 2015
A basic started JSHint configuration.
View .jshintrc
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"es3": true,
"expr": true,
"immed": true,
"noarg": true,
"onevar": true,
View gist:071f6e1897618f51f03a
<logging>
<log type="coverage-html" target="coverage" title="PHPUnit"
charset="UTF-8" yui="true" highlight="true" />
</logging>
View wp-dynamic-routing.php
/**
* Register and load JavaScript files.
*
* Includes 'settings' array based on query parameters.
*
* @since 1.0.
*
* @see wp_enqueue_script()
* @see wp_localize_script()
*/
View gist:91bfec30a96f5b1b67c0
'self' =>
array(1) {
[0] =>
array(2) {
'href' =>
string(42) "http://example.org/?json_route=/wp/posts/9"
'attributes' =>
array(0) {
}
}
You can’t perform that action at this time.