Skip to content

Instantly share code, notes, and snippets.

@antonydenyer
antonydenyer / web3js-tuple.js
Created July 14, 2023 15:31
Multicall web3js tuple encoding
const { Web3 } = require("web3");
async function multiCall() {
const abi =
{
"stateMutability": "payable",
"type": "function",
"name": "aggregate3",
"inputs": [

DecimalToRoman

Problem description

The Kata says you should write a function to convert from Decimals to Roman numerals. In order to keep the kata light, we will not check for valid Roman Numeral.

Roman numerals, the numeral system of ancient Rome, uses combinations of letters from the Latin alphabet to signify values. They are based on seven symbols:

@antonydenyer
antonydenyer / toRoman.js
Created April 8, 2021 08:49
romanNumerals in js
const toRoman = (numeral) =>
new Array(numeral + 1)
.join('I')
.replaceAll('IIIII', 'V')
.replaceAll('VV', 'X')
.replaceAll('XXXXX', 'L')
.replaceAll('LL', 'C')
.replaceAll('CCCCC', 'D')
.replaceAll('DD', 'M')
.replaceAll('IIII', 'IV')
@antonydenyer
antonydenyer / keybase.md
Created October 26, 2019 13:10
keybase.md

Keybase proof

I hereby claim:

  • I am antonydenyer on github.
  • I am antonydenyer (https://keybase.io/antonydenyer) on keybase.
  • I have a public key whose fingerprint is 2CD7 D01A 1C9E FFAD E60F A1B9 0977 3615 F91A 8498

To claim this, I am signing this object:

spotless {
java {
// This path needs to be relative to each project
target fileTree('.') {
include '**/src/*/java/**/*.java'
exclude '**/.gradle/**'
exclude '**/generated/**'
}
removeUnusedImports()
googleJavaFormat("1.7").aosp()
@antonydenyer
antonydenyer / 0x61bb711d3d431F404B06505848a9e9C999a83c31
Created June 13, 2019 21:30
0x61bb711d3d431F404B06505848a9e9C999a83c31
0x61bb711d3d431F404B06505848a9e9C999a83c31
FROM ubuntu:bionic
RUN apt-get update && \
apt-get -y -qq upgrade && \
apt-get -y -qq install software-properties-common && \
add-apt-repository ppa:ethereum/ethereum && \
apt-get update && \
apt-get -y -qq install geth-unstable solc && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
#!/bin/sh
set -e
echo "Updating known host for $1 ..."
KEY=$(ssh-keyscan -t ecdsa-sha2-nistp256 $1 2> /dev/null)
if grep -q $1 ~/.ssh/known_hosts;
then
ESCAPED_KEY=${KEY//\//\\\/}
sed -i "" "s/$1.*$/$ESCAPED_KEY/g" ~/.ssh/known_hosts
@antonydenyer
antonydenyer / qDecorator.js
Last active November 23, 2017 12:50
fix IE8 support for catch and finally in angularjs $q service (http://www.antonydenyer.co.uk/blog/2014/08/22/angularjs-decorator-to-support-ie8-catch/)
(function () {
"use strict";
app.config(function ($provide) {
$provide.decorator('$q', function ($delegate) {
// http://dorp.io/blog/extending-q-promises.html
function decoratePromise(promise) {
promise._then = promise.then;
promise.then = function (thenFn, errFn, notifyFn) {
var p = promise._then(thenFn, errFn, notifyFn);