Skip to content

Instantly share code, notes, and snippets.

View anthonybudd's full-sized avatar

Anthony C. Budd anthonybudd

View GitHub Profile
<?php
WP_Route::get('flights', 'listFlights');
WP_Route::post('flights/{flight}', array('FlightController', 'singleFlight'));
function listFlights(){
// Your Code Here
}
Class FlightController{
<?php
WP_Route::get('flights/{flight}', 'singleFlight');
// http://example.com/flights/1
function singleFlight($flight){
echo $flight; // 1
// Your Code Here!
<?php
WP_Route::get('flights', 'listFlights');
// http://example.com/flights
function listFlights(){
// Your Code Here!
}
<?php
Class ExampleCronEvent extends WP_Cron{
public $every = [
'seconds' => 30,
'minutes' => 15,
'hours' => 1,
];
<?php
Class ExampleAction extends WP_AJAX{
protected $action = 'example-action';
protected function run(){
if($this->has('name')){
update_option('name', $this->get('name'));
<?php
Class Product extends WP_Model{
public $postType = 'product';
public $attributes = [
'color',
'weight'
];
}
Product::register();
<?php
Class ContactFormAction extends WP_AJAX{
protected $action = 'contat-form';
protected function run(){
WP_Mail::init()
->to('anthonybudd@gmail.com')
<h3>You have a new contact from enquirey!</h3><br>
<p>
<strong>Name:</strong><?= $name ?>
</p>
<p>
<strong>email:</strong>
<a href="mailto:<?= $email ?>"><?= $email ?></a>
</p>
@anthonybudd
anthonybudd / backup.sh
Created January 22, 2018 17:25
Simple shell script to dump a whole MySQL instance to files
#!/bin/bash
USER="root"
PASSWORD="root"
OUTPUT="/Users/anthonybudd/sql/backup"
databases=`mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
for db in $databases; do
if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] ; then
#!/bin/bash
rm -rf /home/bitnami/www/demo.gdprplug.in
cp -a /home/bitnami/demo.gdprplug.in /home/bitnami/www/demo.gdprplug.in
/opt/bitnami/mysql/bin/mysql -u root --password=YOUR_MYSQL_PASSWORD demo_gdprplug_in < /home/bitnami/export.sql