Skip to content

Instantly share code, notes, and snippets.

johnlane

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

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
johnlane / in_out_trailblazer.md
Created Oct 19, 2015
The Ins and Outs of a Trailblazer Operation Contract
View in_out_trailblazer.md

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
johnlane / session.md
Created Oct 7, 2015
Trailblazer Session
View session.md

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: request.host,           
      preferred_locales: get_preferred_locales_from_http_request)) do |op|
@johnlane
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 Input.md

Injecting Terminal Input

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

View Example Grub Module.md

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
johnlane / PKGBUILD
Created Jun 11, 2015
revised PKGBUILD for Ghost 0.6.4 with npm dependency
View PKGBUILD
# Maintainer: Chun Yang <x@cyang.info>
pkgname=ghost
pkgver=0.6.4
pkgrel=1
pkgdesc="Free, open, simple blogging platform"
arch=('i686' 'x86_64')
url="http://ghost.org"
license=('MIT')
makedepends=('unzip')
depends=('nodejs>=0.12' 'npm')
@johnlane
johnlane / PKGBUILD
Created May 5, 2015
PKGBUILD for AUR package netkit-bsd-finger with systemd support
View PKGBUILD
# Maintainer:
# Contributor: dorphell <dorphell@archlinux.org>
# Updated for systemd by John Lane <archlinux at jelmail dot com>
pkgname=netkit-bsd-finger
pkgver=0.17
pkgrel=9
pkgdesc="BSD-finger ported to Linux"
arch=('i686' 'x86_64')
url='http://ftp.linux.org.uk/pub/linux/Networking/netkit'
@johnlane
johnlane / PKGBUILD (rssh)
Last active Sep 12, 2017
ArchLinux AUR PKGBUILD for rsync-compatible rssh
View PKGBUILD (rssh)
# Maintainer: Christian Hesse <mail@eworm.de>
# Contributor: Judd Vinet <jvinet@zeroflux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
pkgname=rssh
pkgver=2.3.4
pkgrel=4
pkgdesc='Restricted secure shell allowing only scp, sftp, cvs, rsync or rdist'
url='http://www.pizzashack.org/rssh/'
license=('custom:rssh')
@johnlane
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.