Skip to content

Instantly share code, notes, and snippets.

View schlessera's full-sized avatar

Alain Schlesser schlessera

View GitHub Profile
@schlessera
schlessera / script.md
Last active April 13, 2023 10:54
Siteground webinar - Learn How WP-CLI Can Make Your Life Easier

Siteground webinar - Learn How WP-CLI Can Make Your Life Easier

Webinar description

WP-CLI, the command-line interface for WordPress, is one of the most popular tools among WordPress developers. However, it can be extremely helpful for anyone managing a WordPress site. In this webinar, the main person behind WP-CLI project: Alain Schlesser will show us the ins and outs of the tool. He will give us great examples on how it can be used to improve your workflow, for beginners to experienced developers and for projects big and small. We will give you invaluable examples on how to perform different tasks with WP-CLI automatically, saving you time and preventing you from making manual errors, like:

  • Keep forgetting to backup? Automate the process with WP-CLI.
  • Site not working? Get tips for easy troubleshoot with WP-CLI.
  • Too many spam comments? Learn how to clean them in no time.
  • Can’t log into your site? Reset your password with WP-CLI.
@schlessera
schlessera / README.md
Last active September 5, 2022 01:57
Site setup script example

Site setup script example

This script is an example of how a custom site setup automation could look like to improve personal developer productivity.

This script was originally assembled by @johnbillion for a workshop at WordCamp Torino 2018.

See https://github.com/johnbillion/wctrn-site-setup-script.

@schlessera
schlessera / diagrams.js
Created February 22, 2022 22:10
Gulp task to process PlantUML diagrams, including those found in source code (OLD)
var gulp = require('gulp');
var rename = require('gulp-rename');
var changed = require('gulp-changed');
var request = require('sync-request');
var through = require('through2');
var gutil = require('gulp-util');
var prettyHrtime = require('pretty-hrtime');
var fs = require('fs');
var config = require('../config');
@schlessera
schlessera / README.md
Created July 29, 2016 14:20
Real-time Log Viewer Example

Partial real-time log viewer example

This is a (partial) example to demonstrate the interaction between different reusable components to build an admin page in the WordPress back-end that shows a near-real-time display of the last 30 lines of my log files.

This code will not work as is, as some of it depends on a larger architecture system. Some of the files have been shortened, and the usual file headers and copyright notices have been removed for brevity's sake.

The related components that are discussed are brightnucleus/dependencies and brightnucleus/settings. The configuration is loaded through brightnucleus/config.

Notable "features" of the below code:

@schlessera
schlessera / amp-disable-esm.php
Last active May 8, 2021 17:27
AMP Disable ES Modules
<?php
/**
* AMP Disable ES Modules.
*
* @package AMP_Disable_ESM
* @author Alain Schlesser <alain.schlesser@gmail.com>
* @link https://gist.github.com/schlessera/4127ab30f4235f1acbc11e3eee77701a
* @license GPL-2.0-or-later
*
* @wordpress-plugin
@schlessera
schlessera / amp-disable-optimizer.php
Last active March 29, 2021 19:56
AMP Disable Optimizer
<?php
/**
* AMP Disable Optimizer
*
* @package AMP_Disable_Optimizer
* @author Alain Schlesser <alain.schlesser@gmail.com>
* @link https://gist.github.com/schlessera/3c279bac46b3437966e5812901e5f923
* @license MIT
*
* @wordpress-plugin
@schlessera
schlessera / Controller.php
Last active November 5, 2020 13:31
Example of bootstrapping a WordPress plugin.
<?php
// file: src/Controller.php
/**
* Example Plugin Controller.
*/
namespace Example\Plugin;
use BrightNucleus\Config\ConfigInterface;
@schlessera
schlessera / Autoloader.php
Last active August 23, 2020 13:39
Generic Autoloader
<?php namespace Generic;
use RuntimeException;
/**
* Class Autoloader.
*
* This is a custom autoloader to replace the functionality that we would
* normally get through the autoloader generated by Composer.
*
@schlessera
schlessera / README.md
Last active February 3, 2020 23:21
Simple script to quickly create a fresh WordPress installation in a subfolder.
@schlessera
schlessera / RoboFile.php
Created December 14, 2019 14:46
Simple script to quickly create a fresh WordPress installation in a subfolder.
<?php declare( strict_types=1 );
final class RoboFile extends \Robo\Tasks {
public function createEmpty( string $name, string $tld = 'localhost', string $email = 'alain.schlesser@gmail.com' ) {
$io = $this->io();
$root = __DIR__;
$io->title( 'Creating an empty local WordPress site' );