Skip to content

Instantly share code, notes, and snippets.

View anthonybudd's full-sized avatar

Anthony C. Budd anthonybudd

View GitHub Profile
axios({
url: 'localhost:7777/api/v1/channel/1/messages',
method: 'post',
data: {
message_id: '2kkun2k98fkxhfu8sf2444',
message: 'echo',
type: 'text',
channel: 'presence-lexi-2',
channel_id: 1
},
<?php
WP_Route::get('/api/callback', function(){
update_option('last_called', current_time('mysql'));
});
<?php
Class Data extends WP_Model{
public $postType = 'data';
public $attributes = [
'foo',
'author',
];
<?php
Class ClearOrphanMetaAction extends WP_AJAX{
protected $action = 'clear-orphan-meta-action';
protected function run(){
global $wpdb;
$wpdb->get_results("
<?php
function onSave(){
$request = new WP_AJAX;
if($request->has('foo')){
// Do stuff
}
}
version: '3.3'
services:
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- ./:/var/www/html
ports:
<?php
WP_Route::get('/', function(){
return "Hello World."
});
WP_Route::get('/flights', 'flights'); // flights()
WP_Route::post('/flights/{flight}', 'singleFlight'); // singleFlight($flight)
WP_Route::put('/flights/{flight}/book/{date}', 'bookFlight');
WP_Route::delete('/flights/{flight}/delete', 'deleteFlight');
public static function fieldsCallback(){
$this_ = Self::newWithoutConstructor();
if(method_exists($this_, 'cmb2Fields')){
$fields = $this_->cmb2Fields();
if(function_exists('new_cmb2_box') && is_array($fields)){
if(!isset($fields['meta_box'])){
$fields['meta_box'] = [
'id' => get_called_class(),
<?php
WP_Route::redirect('open-google', 'https://google.com', 301);
<?php
WP_Route::match(['get', 'post'], 'flights/{flight}/confirm', 'confirmFlight');
function confirmFlight($flight){
// Your Code Here
}