Skip to content

Instantly share code, notes, and snippets.

View rachelbaker's full-sized avatar

Rachel Baker rachelbaker

View GitHub Profile
@rachelbaker
rachelbaker / log-affiliate-urls.js
Created July 24, 2017 21:13
Get all Wirecutter affiliate links from within Chrome
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 );
<?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 March 20, 2016 17:24 — forked from dianekinney/foodquery.php
Merge query for CPT and posts in a specific category
// 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);
@rachelbaker
rachelbaker / send-reads-to-master.php
Created November 23, 2015 15:19 — forked from octalmage/send-reads-to-master.php
HyperDB - Send Reads to Master.
<?php
/**
* Plugin Name: Send Reads to Master
* Description: Suggested fix for backend replication lag
* Author: WP Engine
* Version: 0.2
*
*/
if ( is_admin() ) {
{
"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
{
"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 20:29
A basic started JSHint configuration.
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"es3": true,
"expr": true,
"immed": true,
"noarg": true,
"onevar": true,
<logging>
<log type="coverage-html" target="coverage" title="PHPUnit"
charset="UTF-8" yui="true" highlight="true" />
</logging>
/**
* Register and load JavaScript files.
*
* Includes 'settings' array based on query parameters.
*
* @since 1.0.
*
* @see wp_enqueue_script()
* @see wp_localize_script()
*/
'self' =>
array(1) {
[0] =>
array(2) {
'href' =>
string(42) "http://example.org/?json_route=/wp/posts/9"
'attributes' =>
array(0) {
}
}