!SLIDE
"Follow your nose"
— Roy T. Fielding
!SLIDE
"build scalable, flexible implementations that do not simply run on the Web, but that actually exist in the Web"
-module(compress_ecdsa_publickey). | |
-export([compress_ecdsa_publickey/1, test/0]). | |
compress_ecdsa_publickey(UncompressedPublicKey) -> | |
%% To binary | |
UncompressedPublicKeyBin = binary:decode_hex(list_to_binary(UncompressedPublicKey)), | |
%% Check that the uncompressed public key is valid | |
case size(UncompressedPublicKeyBin) of | |
65 -> | |
%% Remove the prefix (first byte) from the public key |
const ethers = require("ethers") | |
const pk = | |
"0x0471c746523d16e93d4738f882d9b0beebf66c68caa0f895db15686b57b878cfc7b3e09813ba94f1bbfaa91a06566d3d18bbf69d10bcc947325bbcd6fea97ed692" | |
const ad = "0xcD3edF915387E2555A829567cE0dBbC919834B82" | |
getPubKey = async () => { | |
const infuraProvider = new ethers.providers.JsonRpcProvider( | |
"https://ropsten.infura.io/v3/<projectID>" | |
) |
{ | |
"self": {"href":"/orders"}, | |
"rel-templates":[ | |
{ | |
"name":"ea", | |
"href":"http://example.com/docs/rels/{rel}", | |
"templated":true | |
} | |
], | |
"next":{"href": "/orders?page=2"}, |
def assigns_local(key) | |
controller.instance_variable_get('@patched_locals')[key] | |
end | |
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] | |
end |
// http://chaijs.com/guide/plugins/ | |
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).to.be.an('object') |
class Organization | |
def to_param | |
"42" | |
end | |
def saved? | |
rand > 0.5 | |
end | |
end |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
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
# 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 |