Skip to content

Instantly share code, notes, and snippets.


Mike Kelly mikekelly

View GitHub Profile
chrsengel / getPubKey.js
Last active May 3, 2022
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(
ssfrr / orders.json
Last active Aug 29, 2015
Simplified HAL
View orders.json
"self": {"href":"/orders"},
"next":{"href": "/orders?page=2"},
mattheworiordan / assign_locals_helper.rb
Last active Jun 30, 2017
Allow testing of locals when rendering Controllers
View assign_locals_helper.rb
def assigns_local(key)
def patch_controller_render_to_support_locals(controller)
def controller.render(options = nil, extra_options = {}, &block)
[options, extra_options].select { |o| o.kind_of?(Hash) }.each do |option_hash|
if option_hash.include?(:locals)
@patched_locals = option_hash[:locals]


Hypermedia APIs

"Follow your nose"

— Roy T. Fielding


"build scalable, flexible implementations that do not simply run on the Web, but that actually exist in the Web"

jxson / hal-plugin.js
Created Oct 18, 2012
HAL Chai plugin
View hal-plugin.js
module.exports = function(chai, utils){
var Assertion = chai.Assertion
, assert = chai.assert
Assertion.addProperty('resource', function(){
var doc = this._obj
, message = utils.flag(this, 'message')
new Assertion(doc, message)'object')
mattwynne / sketch.rb
Created Jun 23, 2012 — forked from lukemelia/sketch.rb
sketch for Matt Wynne
View sketch.rb
class Organization
def to_param
def saved?
rand > 0.5
pironim / capybara cheat sheet
Last active Oct 5, 2015 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')

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

wycats / personality.rb
Created Apr 12, 2012
More technical details about the discussion at last nights meetup
View personality.rb
# Just wanted to clarify my points at the meetup last night.
# There were two different issues intertwined:
# (1) Whether to use extend or "include as extend"
# (2) When using "include as extend", what is the simplest way to achieve the goal?
# My personal opinion is that the answer to (1) is "extend", not "include as extend", but that
# is just my personal opinion. My answer to (2) is a more empirical question.
# Using the "extend" approach. Again, I personally prefer the simplicity of this approach, but
domenic / hal-catalog.json
Created Apr 10, 2012
HAL version of catalog
View hal-catalog.json
"title": "Catalog for Domenic, page 1",
"description": "Contains lots of books, which is cool",
"_links": {
"self": { "href": "/docs?page=1" },
"next": { "href": "/docs?page=2" }
"_embedded": {
"": [