Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block johnlane

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
johnlane /
Created Apr 16, 2016
Can a Trailblazer concept inherit from another and be able to extend its operati ons (multiple inheritance) ?

The effect of multiple inheritance can be achieved by using modules.

First define the ActiveRecord objects like this:

class Topic < ActiveRecord::Base; end
class Location < ActiveRecord::Base; end

There is no longer a base Tag abstract class, allowing Tag to be defined as a module like this (app/concepts/tag/crud.rb):

module Tag
johnlane /
Created Oct 19, 2015
The Ins and Outs of a Trailblazer Operation Contract

The Ins and Outs of a Trailblazer Operation Contract

These notes record my attempts to understand how and when to populate a Trailblazer contract. They may be incomplete, inaccurate or just plain wrong. They may also be right; I hope they are! Comments are welcome.

It all began with the requirement to seed a presenting contract from the inbound request. Having looked for answers in the Trailblazer book and on Gitter (there was a similar conversation on the 25th September), taking

johnlane /
Created Oct 7, 2015
Trailblazer Session

The Session

The application can behave differently based on the request URL by presenting a diferent 'site' experience to the end-user, who may also choose from the locales (language presentations) that the site supports.The Session manages this: it's a PORO plus some Trailblazer operations. It keeps state for the current request including current user, the Rails session and site and locale selections. It's established with a Session::Create operation before processing a request.

The Session does not persist across requests, except for data placed in its persistent store, for which the Rails session is used (but another Hash-like object could be used instead).

The Session is established in the ApplicationController:

  before_action do
    Session::Create.reject(params.merge(store: session, host:,           
      preferred_locales: get_preferred_locales_from_http_request)) do |op|
johnlane / cell.rb
Created Oct 1, 2015
Widget wrapper around cell
View cell.rb
# app/concepts/widget/cell.rb
# A very basic "Widget" that is a container of Cell objects
# When rendered, it recursively renders all cells that it
# contains.
class Widget < Cell::Concept
attr_reader :parent
attr_reader :children
# Create a new widget
View Injecting Terminal

Injecting Terminal Input

Some examples demonstrating how to inject keystrokes into a terminal's input stream.

View Example Grub

This is an example Grub module that demonstrates how to add a command to Grub that can process command-line options and other parameters.

johnlane / PKGBUILD
Created Jun 11, 2015
revised PKGBUILD for Ghost 0.6.4 with npm dependency
# Maintainer: Chun Yang <>
pkgdesc="Free, open, simple blogging platform"
arch=('i686' 'x86_64')
depends=('nodejs>=0.12' 'npm')
johnlane / PKGBUILD
Created May 5, 2015
PKGBUILD for AUR package netkit-bsd-finger with systemd support
# Maintainer:
# Contributor: dorphell <>
# Updated for systemd by John Lane <archlinux at jelmail dot com>
pkgdesc="BSD-finger ported to Linux"
arch=('i686' 'x86_64')
johnlane / PKGBUILD (rssh)
Last active Sep 12, 2017
ArchLinux AUR PKGBUILD for rsync-compatible rssh
View PKGBUILD (rssh)
# Maintainer: Christian Hesse <>
# Contributor: Judd Vinet <>
# Contributor: Gaetan Bisson <>
pkgdesc='Restricted secure shell allowing only scp, sftp, cvs, rsync or rdist'
johnlane / gist:7fece74c501fd77cc0c3
Created Apr 17, 2015
Grub loopback iso example
View gist:7fece74c501fd77cc0c3
set imgdevpath='/dev/disk/by-uuid/e7bc3210-ee80-4111-a6da-3db1d2e2cbef'
set isofile="/iso/tails-i386-1.2.2.iso"
loopback loop $isofile
linux (loop)/live/vmlinuz fromiso=$imgdevpath/$isofile boot=live config noswap nopersistent nomodeset noautologin splash
initrd (loop)/live/initrd.img
You can’t perform that action at this time.