Skip to content

Instantly share code, notes, and snippets.

Avatar

Toby Zerner tobyzerner

View GitHub Profile
@tobyzerner
tobyzerner / bootstrap.php
Created Sep 11, 2015
Flarum Custom Layout Extension
View bootstrap.php
<?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
View gist:7686531d35f10875c2e2
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 Apr 8, 2015
Mithril ES6 Components
View app.js
import Component from './component';
class Widget extends Component {
init(ctrl) {
var props = this.props;
ctrl.counter = props.initialValue;
ctrl.increment = function() {
ctrl.counter++;