Skip to content

Instantly share code, notes, and snippets.

View nylen's full-sized avatar
🏗️
Constructing

James Nylen nylen

🏗️
Constructing
View GitHub Profile
@nylen
nylen / gist:359d02d837c64911760a8b95217e53d1
Last active May 10, 2017 19:33
REST API "object" strings
✓ james@compu <WP>/src/wp-includes/rest-api $ ack '(the|this|by) (resource|object)'
fields/class-wp-rest-term-meta-fields.php:41: * Retrieves the object meta type.
fields/class-wp-rest-comment-meta-fields.php:20: * Retrieves the object type for comment meta.
fields/class-wp-rest-post-meta-fields.php:41: * Retrieves the object meta type.
fields/class-wp-rest-meta-fields.php:18: * Retrieves the object meta type.
fields/class-wp-rest-meta-fields.php:29: * Retrieves the object type for register_rest_field().
fields/class-wp-rest-meta-fields.php:379: * Retrieves the object's meta schema, conforming to JSON Schema.
endpoints/class-wp-rest-post-types-controller.php:31: * Registers the routes for the objects of the controller.
endpoints/class-wp-rest-revisions-controller.php:76: 'description' => __( 'The ID for the parent of the object.' ),
endpoints/class-wp-rest-revisions-controller.php:92: 'description' => __( 'The ID for the parent of the object.' ),
diff --git a/wp-api-generated-1class.js b/wp-api-generated-REST.js
index 40b31ba..ce5b87e 100644
--- a/wp-api-generated-1class.js
+++ b/wp-api-generated-REST.js
@@ -3374,36 +3374,49 @@ mockedApiResponse.oembeds = {
mockedApiResponse.PostsCollection = [
{
- "id": 3,
- "date": "2017-02-14T05:30:00",
array arg without item type:
/wp/v2/posts
slug
{"required":false,"description":"Limit result set to posts with one or more specific slugs.","type":"array"}
arg without type:
/wp/v2/posts/(?P<id>[\d]+)
password
{"required":false,"description":"The password for the post if it is password protected."}
#!/usr/bin/env node
'use strict';
const http = require( 'http' );
http.get( 'http://localhost:8080/wp/wp-json?context=help', res => {
if ( res.statusCode !== 200 ) {
throw new Error( 'HTTP ' + res.statusCode );
}
diff --git a/client/me/account/main.jsx b/client/me/account/main.jsx
index 6e19442..8df83cd 100644
--- a/client/me/account/main.jsx
+++ b/client/me/account/main.jsx
@@ -366,7 +366,7 @@ const Account = React.createClass( {
},
renderPrimarySite() {
- if ( ! user.get().visible_site_count ) {
+ if ( true || ! user.get().visible_site_count ) {
<?php
// Test WordPress.com REST API custom taxonomies on a Jetpack site.
error_reporting( E_ALL & ~E_NOTICE );
$site_id = $argv[1];
$oauth2_token = $argv[2];
if ( ! $site_id || ! $oauth2_token ) {
@nylen
nylen / mixxx-listener.js
Created April 29, 2016 21:37
mixxx-listener.js
var net = require('net');
var server = net.createServer(function(sock) {
console.log(
'connection from %s:%d',
sock.remoteAddress, sock.remotePort
);
var req = '',
gotHeaders = false;
@nylen
nylen / whoops.pl
Last active March 16, 2016 06:46
recover my accidentally overwritten ssl certificate :(
#!/usr/bin/env perl
# Run something like this first:
# sudo grep -i -a -B100 -A100 -- '-----BEGIN CERTIFICATE-----' /dev/disk/by-uuid/YOUR_UUID_HERE > whoops.log
# h/t http://unix.stackexchange.com/a/150423/26139
use strict;
use warnings;
open my $log, '<', 'whoops.log';
@nylen
nylen / rewrite-rules.php
Last active February 24, 2016 22:42
WPCOM rewrite-rules API test
<?php
/*
* Plugin Name: WPCOM-specific hacks for WP-API rewrite rules
*/
// Make sure the rewrite rules are in place
function wpcom_rest_api_v2_prepend_rewrite_rules( $rewrite_rules ) {
if ( ! is_array( $rewrite_rules ) || empty( $rewrite_rules ) ) {
return $rewrite_rules;
@nylen
nylen / README.md
Created February 15, 2016 21:23
Test wp-calypso#3309