Skip to content

Instantly share code, notes, and snippets.

View menu2.py
#!/usr/bin/env python
import gi
gi.require_version('Gtk','3.0')
gi.require_version('Keybinder', '3.0')
from gi.repository import Gtk, Gdk, Keybinder
class MenuBar(Gtk.Window):
def __init__(self, *args):
@johnlane
johnlane / PGP KEY 22D05A45
Created Jan 23, 2017
44E44ABB2410742A8476BC9B955B200A22D05A45
View PGP KEY 22D05A45
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
- -----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFTZ1L0BEACU0k8PmTWLXWAbDy1Nr89bv3xjm3QkaNtxdKHvHW/n1ScJwWfm
INfDesKoNKRniatTcHiKxDGQEFtALTSzbFC8nf/Gvtq1sgfn3Io9I12/McanZpKK
Xml9my8Yov+b98F4EkYCf/QykHU/Ec4U0InMtFbbsBlMyLbU2nty9efc9IQre0cV
EuMgG6xCc7aQyAI2SX54wIbnHhjOyqKUoAC3Ela3boSBUIn60Gz7EsvbIJk4O4UR
5ncpuqnF1Almse3wVfe9biBJK6RMUrcs8Aw/8r9B0mDA6REVqLEBoyI/QJDL8rEn
View keybase.md

Keybase proof

I hereby claim:

  • I am johnlane on github.
  • I am johnlane (https://keybase.io/johnlane) on keybase.
  • I have a public key ASDE5-a54ZM6flDHH8atfeVPVgu1sXGE16_2aNJ4OPnG-go

To claim this, I am signing this object:

@johnlane
johnlane / gpgtest.out
Created Jan 18, 2017
GNUPG trust-signatures test output
View gpgtest.out
-----------------------------------------------------------------
VERSION INFORMATION
gpg (GnuPG) 2.1.17
libgcrypt 1.7.5
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /home/john/.gnupg
@johnlane
johnlane / gpgtest.sh
Created Jan 18, 2017
Testing GNUPG trust-signatures
View gpgtest.sh
#!/bin/sh
#
export GNUPGHOME
echo -----------------------------------------------------------------
echo VERSION INFORMATION
gpg --version
uname -vimposr
@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 / test.rb
Created Apr 24, 2016
StackOverflow#36799396
View test.rb
# in-ruby-is-it-possible-to-move-a-module-up-the-ancestor-chain
# http://stackoverflow.com/questions/36799396
module A
def hiya(str)
puts "ho #{str}"
end
def if_what?
end
end
@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 / 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 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.

You can’t perform that action at this time.