Skip to content

Instantly share code, notes, and snippets.

Alain Schlesser schlessera

Block or report user

Report or block schlessera

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am schlessera on github.
  • I am schlessera (https://keybase.io/schlessera) on keybase.
  • I have a public key ASAwZ3hewGFJXOlKo5p5dYD5Q-gmmvQDfsbyTKID3Uo09wo

To claim this, I am signing this object:

@schlessera
schlessera / Plugin.php
Last active Sep 29, 2017
Using Value Objects for Dependency Injection
View Plugin.php
<?php
class Plugin
{
protected $plugin_root;
private $loaded;
public function __construct(PluginRoot $plugin_root)
{
@schlessera
schlessera / Autoloader.php
Last active Apr 11, 2017
Generic Autoloader
View Autoloader.php
<?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
Created Jul 29, 2016
Real-time Log Viewer Example
View README.md

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 / Controller.php
Last active May 29, 2016
Example of bootstrapping a WordPress plugin.
View Controller.php
<?php
// file: src/Controller.php
/**
* Example Plugin Controller.
*/
namespace Example\Plugin;
use BrightNucleus\Config\ConfigInterface;
@schlessera
schlessera / README.md
Created Mar 10, 2016
Accessing WP plugin code from a theme
View README.md
@schlessera
schlessera / example-plugin.php
Created Mar 10, 2016
Accessing WP plugin code from a theme
View example-plugin.php
<?php
/**
* Example plugin.
*
* @see http://wordpress.stackexchange.com/questions/220286/what-is-the-best-way-to-instantiate-a-class-of-a-plugin-in-your-wordpress-theme/
*
* @wordpress-plugin
* Plugin Name: Example plugin.
* Description: Accessing a plugin object from a theme.
* Version: 0.1.0
@schlessera
schlessera / phpfeature-example.php
Created Jan 14, 2016
PHPFeature Example Usage Code.
View phpfeature-example.php
<?php
/*
* PHPFeature example usage code
*/
// Array of strings to define what features you need.
$features = array( 'namespaces', 'traits' );
// Instantiate the PHPFeature library.
// When you don't provide a version number as the first argument,
@schlessera
schlessera / OrderedInvoke.php
Last active Sep 7, 2015
Simple WordPress Settings API class example.
View OrderedInvoke.php
<?php
/**
* OrderedInvokeTrait
*
* @package BrightNucleus_Core
* @author Alain Schlesser <alain.schlesser@gmail.com>
* @license GPL-2.0+
* @link http://www.brightnucleus.com/
* @copyright 2015 Alain Schlesser, Bright Nucleus
*/
@schlessera
schlessera / responsive-iframe.css
Last active Aug 29, 2015
Make an IFrame (like video, flash, ...) responsive.
View responsive-iframe.css
/* Responsive IFrame example
* @author Alain Schlesser <alain.schlesser@gmail.com>
/* The wrapper gets resized using padding-bottom with a percentage value. This
* way, it's height is always directly dependent on its width */
.iframe-wrapper {
/* Necessary so we can position the contained IFrame absolutely */
position: relative;
You can’t perform that action at this time.