Skip to content

Instantly share code, notes, and snippets.

View tobyzerner's full-sized avatar

Toby Zerner tobyzerner

View GitHub Profile
@tobyzerner
tobyzerner / bootstrap.php
Created September 11, 2015 01:54
Flarum Custom Layout Extension
<?php
namespace Flarum\CustomLayout;
use Flarum\Support\Extension as BaseExtension;
use Illuminate\Events\Dispatcher;
use Flarum\Events\BuildClientView;
use Flarum\Forum\Actions\ClientAction as ForumClientAction;
class Extension extends BaseExtension
var app = {
controller: function() {
var ctrl = this;
// Everything that we render, that could possibly change in the future, is
// an m.prop getter-setter function
ctrl.name = m.prop('Toby');
ctrl.showing = m.prop(false);
ctrl.items = m.prop([
m.prop(1),
@tobyzerner
tobyzerner / app.js
Created April 8, 2015 02:38
Mithril ES6 Components
import Component from './component';
class Widget extends Component {
init(ctrl) {
var props = this.props;
ctrl.counter = props.initialValue;
ctrl.increment = function() {
ctrl.counter++;