Skip to content

Instantly share code, notes, and snippets.

View Raku-Advent-2022.md

Trove testing tool — yet another TAP harness

Intro

Since the early Pheix versions, I have paid a lot of attention to testing system. Initially it was a set of unit tests — I tried to cover a huge range of units like classes, methods, subroutines and conditions. In some cases I have combined unit and functional testing within one .t file, like it's done to verify Ethereum or API related functionality.

Tests became a bit complicated and environment dependent. For example off chain testing like trivial prove6 -Ilib ./t should skip any Ethereum tests including some API units, but not API template engine or cross module API communications. So I had to create environment dependent configurations and since that point I started yet another Pheix friendly test system.

It was written in pure bash and was included in Pheix repository for a few years.

@pheix
pheix / Raku-Advent-2021.md
Last active Dec 9, 2021
A long journey to Ethereum signatures
View Raku-Advent-2021.md

A long journey to Ethereum signatures

The Ethereum blockchain is essentially a transaction-based state machine. We begin with a blank state, before any transactions have happened on the network, and move into some final state when transactions are executed. The state of Ethereum relies on past transactions. These transactions are grouped into blocks and each block is chained together with its parent.

Transactions are processing by own Turing complete virtual machine - known as the Ethereum Virtual Machine (EVM). The EVM has its own language: EVM bytecode. Typically programmer writes the program in a higher-level language such as Solidity. Then the program should be compiled down to EVM bytecode and commited to the Ethereum network as the new transaction. The EVM executes the transaction recursively, computing the system state and

@pheix
pheix / Raku-Advent-2020.md
Last active Nov 30, 2020
Raku web templating engines: boost up the parsing performance 
View Raku-Advent-2020.md

Raku web templating engines: boost up the parsing performance

Modern Raku web templating engines

A templating engine basically provides tools for effective metadata interpolation inside static files (templates). At web application runtime, the engine parses and replaces variables with actual content values. Finally client gets a HTML page generated from the template, where all metadata (variables, statements, expressions) has been proceed.

Raku ecosystem has a few modern templating engines: Template::Mojo (last commit on 12 Jun 2017), Template::Mustache (last commit on 25 Jul 2020 — it's alive!), Template6 (last commit on 20 Nov 2020 - active maintenance), Template::Classic (last commit on 11 Apr 2020), [Template

@pheix
pheix / pheix-bigbro.sol
Created Jun 7, 2018
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
View pheix-bigbro.sol
pragma solidity ^0.4.21;
contract BigBro {
struct Statistics {
uint id;
string referer;
string ip;
string useragent;
string resolution;
string page;
string country;
@pheix
pheix / pheix-bigbro.sol
Created May 30, 2018
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
View pheix-bigbro.sol
pragma solidity ^0.4.21;
contract BigBro {
struct Statistics {
uint id;
string referer;
string ip;
string useragent;
string resolution;
string page;
string country;