Skip to content

Instantly share code, notes, and snippets.


Mike Kelly mikekelly

View GitHub Profile
mikekelly / getPubKey.js
Created Feb 1, 2022 — forked from chrsengel/getPubKey.js
Attempting to get the public key
View getPubKey.js
const ethers = require("ethers")
const pk =
const ad = "0xcD3edF915387E2555A829567cE0dBbC919834B82"
getPubKey = async () => {
const infuraProvider = new ethers.providers.JsonRpcProvider(
mikekelly / pksc7_verify.rb
Created Mar 19, 2021 — forked from zmajstor/pksc7_verify.rb
OpenSSL::PKCS7#verify test
View pksc7_verify.rb
require 'openssl'
require 'base64'
require "test/unit"
BODY = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"\">\n<plist version=\"1.0\">\n<dict>\n\t<key>Status</key>\n\t<string>Idle</string>\n\t<key>UDID</key>\n\t<string>b7ebaaa53fda9be2f7787eff7c1f4aca4e36f79d</string>\n</dict>\n</plist>\n"
mikekelly / ruby_cert.rb
Created Feb 28, 2021 — forked from VimleshS/ruby_cert.rb
Usage examples of ruby’s openssl lib
View ruby_cert.rb
require 'openssl'
require 'date'
require 'time'
View orders.json
View gist:a7ce2ed97a291917daef
def create
card = current_user.credit_cards.create(card_params)
if card.persisted?
render :success
render :failure
View users_controller_service.rb
class UsersController < ApplicationController
def create
on_success: public_method(:create_successful),
on_failure: public_method(:create_failure)
def create_successful(user)
View thing.json
"_links": {
"self": {
"href": "/product/987"
"manufacturer": {
"href": "/manufacturer/328764",
"title": "Manufacturer Inc."
mikekelly / rspec_stub_chain_if_spec.rb
Created Sep 27, 2012 — forked from deepak/rspec_stub_chain_if_spec.rb
mocking stub chains with an assertion if the final call is made
View rspec_stub_chain_if_spec.rb
require 'rspec'
class DevOps
attr_reader :monitor
def initialize(arguments)
@monitor = arguments.fetch(:monitor) { }
def check
mikekelly / sketch.rb
Created Jul 4, 2012 — forked from mattwynne/sketch.rb
sketch for Matt Wynne
View sketch.rb
class Organization
def to_param
def saved?
rand > 0.5

Inheritance is a key concept in most object-oriented languages, but applying it skillfully can be challenging in practice. Back in 1989, M. Sakkinen wrote a paper called Disciplined inheritance that addresses these problems and offers some useful criteria for working around them. Despite being more than two decades old, this paper is extremely relevant to the modern Ruby programmer.

Sakkinen's central point seems to be that most traditional uses of inheritance lead to poor encapsulation, bloated object contracts, and accidental namespace collisions. He provides two patterns for disciplined inheritance and suggests that by normalizing the way that we model things, we can apply these two patterns to a very wide range of scenarios. He goes on to show that code that conforms to these design rules can easily be modeled as ordinary object composition, exposing a solid alternative to tradi