WordPress development environment on Mac with Brew, Nginx, PHP 7, PHP-FPM, MariaDB, phpMyAdmin and more
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
const OPENAI_API_KEY = ""; // <- PASTE YOUR SECRET KEY HERE | |
const OPENAI_API_URL = "https://api.openai.com/v1/completions"; | |
/** | |
* Submits a prompt to GPT-3 and returns the completion | |
* | |
* @param {string} prompt Prompt to submit to GPT-3 | |
* @param {float} temperature Model temperature (0-1) | |
* @param {string} model Model name (e.g. text-davinci-002) |
<?php | |
add_action( 'rest_api_init', function () { | |
register_rest_route( 'dbi', 'slash-woo/', array( | |
'methods' => 'POST', | |
'callback' => 'slack_woo_command', | |
) ); | |
} ); | |
function slack_woo_command( $request ) { | |
$command = filter_input( INPUT_POST, 'command', FILTER_SANITIZE_STRING ); |
<?php | |
/** | |
* Adds a cURL version test to Site Health | |
* | |
* Info here: https://make.wordpress.org/core/2019/04/25/site-health-check-in-5-2/ | |
* NOTE: Requires version 5.2+ of WordPress | |
* | |
**/ |
/** | |
* Add a weekly email report that summarizes which domains that | |
* your products are being used on. | |
*/ | |
add_filter( 'cron_schedules', function( $schedules ) { | |
$schedules['weekly'] = array( | |
'interval' => 604800, | |
'display' => __('Once Weekly') | |
); |
<?php | |
// enqueue these scripts and styles before admin_head | |
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though... | |
wp_enqueue_style( 'wp-jquery-ui-dialog' ); | |
?> | |
<!-- The modal / dialog box, hidden somewhere near the footer --> | |
<div id="my-dialog" class="hidden" style="max-width:800px"> | |
<h3>Dialog content</h3> | |
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p> |
const http = require('http'); | |
const url = require('url'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const port = process.argv[2] || 9000; | |
http.createServer(function (req, res) { | |
console.log(`${req.method} ${req.url}`); | |
// parse URL |
/** | |
* How to link into the WordPress Customizer | |
*/ | |
Simple Link: | |
<a href="<?php echo esc_url( admin_url( 'customize.php' ) ); ?>">Link to Customizer</a> | |
Link to Panel: | |
$query['autofocus[panel]'] = 'nav_menus'; |
var app = require('app'); | |
var Menu = require('menu'); | |
var Tray = require('tray'); | |
var appIcon = null; | |
app.on('ready', function(){ | |
// image is null, so image will not be shown in menu bar | |
// so click around on the system menu bar to locate the space where the tray icon is | |
appIcon = new Tray(null); |