Skip to content

Instantly share code, notes, and snippets.

@movitto
movitto / bench.rb
Created October 21, 2019 19:24
Simple Ruby Benchmark Class
require 'xrbp'
class Benchmark
def initialize(max=1000)
@max = max
@snapshots = []
end
def capture!(n=1)
@snapshots << [n, Time.now]
@movitto
movitto / txs_by_result.rb.diff
Created May 8, 2020 21:51
xrp1ntel - TXs By Result: Critical Results Patch
diff --git a/lib/wipple/metrics/txs_by_result.rb b/lib/wipple/metrics/txs_by_result.rb
index 10c5f7c..5badc0d 100644
--- a/lib/wipple/metrics/txs_by_result.rb
+++ b/lib/wipple/metrics/txs_by_result.rb
@@ -3,6 +3,8 @@ module Wipple
class TxsByResult
include BaseMetric
+ CRITICAL_RESULTS = ['tecINVARIANT_FAILED']
+
@movitto
movitto / keybase.md
Created November 24, 2020 17:50
keybase.md

mmorsi Mo Morsi Entrepreneur, software engineer, righteous guy New York

Keybase proof

I hereby claim:

@movitto
movitto / mock.js
Last active April 28, 2021 22:56
Jest mockable modules w/ original invocation
// Mock specific module pre-inclusion, overwriting methods
// w/ stub that behave the same way.
//
// Module should be absolute path as it will be 'required'
// relative to this 'mock' module
function mock_module(module){
jest.doMock(module, () => {
const actual = jest.requireActual(module)
// Stub original behaviour w/ a jest mock