⬢ wp shell
wp> foreach ( wp_get_abilities() as $a ) echo $a->get_name() . "\n";
core/get-site-info
core/get-environment-info
site/site-info
list-all-urls/urls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { getBlockTypes, getBlockVariations } = wp.data.select('core/blocks'); | |
| getBlockTypes() | |
| .filter(({ name }) => getBlockVariations(name).length) | |
| .map(({ name }) => ({ [name]: getBlockVariations(name) })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wp.data | |
| .select('core/blocks') | |
| .getBlockTypes() | |
| .filter(({ name }) => !name.includes('core/')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Helper: wait for all records of a given post type. | |
| const getTypes = async ( types ) => { | |
| return await Promise.all( | |
| types.map( | |
| ( type ) => | |
| new Promise( ( resolve ) => { | |
| const unsub = wp.data.subscribe( () => { | |
| const items = wp.data | |
| .select( 'core' ) | |
| .getEntityRecords( 'postType', type ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Implementation using express-jwt middle | |
| // | |
| var express = require('express'), | |
| ejwt = require('express-jwt'), | |
| jwt = require('jsonwebtoken'), | |
| passport = require('passport'), | |
| bodyParser = require('body-parser'), | |
| LocalStrategy = require('passport-local').Strategy, | |
| BearerStrategy = require('passport-http-bearer').Strategy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'); | |
| var session = require('express-session'); | |
| var cookieParser = require('cookie-parser'); | |
| var flash = require('connect-flash'); | |
| var app = express(); | |
| app.use(cookieParser('secret')); | |
| app.use(session({cookie: { maxAge: 60000 }})); | |
| app.use(flash()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |