DevHeads.net

Postings by Gerald Bauer

Artichoke Ruby - a ruby made with rust - Try the playground in your browser running on a WebAssembly build

Hello,

I've added Artichoke Ruby [1a] to the Awesome Rubies (collection) page [2].

What's Artichoke Ruby? It's a new upcoming ruby in rust by Ryan
Lopopolo et al.

You can try Artichoke in your browser [1b]. Yes, the Artichoke
playground runs a WebAssembly build of Artichoke.

Congrats to Ryan Lopopolo for the inspiring code.

What's your take? Cheers.

Football Data Wrangling w/ Ruby - Match 1500+ Football Club Names from Around the World using the sportdb Library and Open football.db Datasets

Hello,

To prepare for the 2019/2020 football season kick-off I've put together
a football data wrangling w/ sample that lets you match 1500+
football club names
from 100+ leagues from around the world using the sportdb gem / library
and open football.db (public domain) datasets.
Example:

``` ruby
require 'sportdb/config'

## note: requires a local copy of the football.db clubs datasets
## see <a href="https://github.com/openfootball/clubs" title="https://github.com/openfootball/clubs">https://github.com/openfootball/clubs</a>
SportDb::Import.config.clubs_dir = './clubs'

m = SportDb::Import.config.clubs.match( 'Arsenal' )
m.size # 3 club matches found
#=> 3
m[0].na

Ruby Conferences 'n' Camps in 2019 Update - What's Upcoming in July? Aug? Sept? What's News?

Hello,

I've updated the Ruby Conferences 'n' Camps in 2019 - What's
Upcoming? Calendar [1] page @ Planet Ruby.

Ruby Quiz - Challenge #15 - Generate the Bitcoin (Base58) Address from the (Elliptic Curve) Public Key

Hello,

I've posted a new ruby quiz:

Challenge #15 - Generate the Bitcoin (Base58) Address from the
(Elliptic Curve) Public Key [1].

Start from scratch or, yes, use any library / gem you can find.

To qualify for solving the code challenge / puzzle you must pass
the test [2]:

``` ruby
require 'minitest/autorun'

class RubyQuizTest < MiniTest::Test

def test_addr
pubkey =
'0250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352'

pkh = pk_to_pkh( pubkey )
assert_equal 'f54a5851e9372b87810a8e60cdd2e7cfd80b6e31', pkh

prefix = '00'

sportdb-import gem - New football.db Match Importer for CSV Packages (incl. England, Deutschland, and More)

Hello,

I've added a new (quick) importer for datafiles and packages
in the comma-separated values (csv) format to the sportdb library /
tool family [1].

For example let's import all datafiles for all seasons (from 1888-89 to today)
for England [2]:

require 'sportdb/import'

SportDb.connect( adapter: 'sqlite3',
database: './eng.db' )

## build database schema / tables
SportDb.create_all

## turn on logging to console
ActiveRecord::Base.logger = Logger.new(STDOUT)

pack = CsvMatchImporter.new( './england' )
pack.import_leagues

Happy da

kittyverse library / gem - helper classes for cattributes, trait types, traits, genes, genomes and more for cryptokitties and copycats cryptocollectibles (on the blockchain)

Hello,

I've updated the free (open source) kittyverse library / gem that
includes helper classes
for cattributes, trait types, traits, genes, genomes and more for
cryptokitties and copycats cryptocollectibles (on the blockchain).
Example:

Use the Traits helper class to lookup trait types (e.g.

Ruby Conferences 'n' Camps in 2019 Update - What's Upcoming in May? What's News?

Hello,

I've updated the Ruby Conferences 'n' Camps in 2019 - What's
Upcoming? [1] Calendar page @ Planet Ruby.

- Tue+Wed May/14+15(2d) - Ruby Conference Cracow @ Cracow, Poland
- Fri+Sat May/17+18(2d) - Balkan Ruby @ Sofia, Bulgaria
- Fri May/24 (1d) - Pivorak Conf @ Lviv, Ukraine
- Sat+Sun May/25+26(2d) - Ruby Unconf Hamburg @ Hamburg, Germany

Happy meeting up with rubyists in 2019. Cheers. Prost.

PS: Do you have a favorite conference?

Contract Scripting for Everyone: (Hyperledger) FabCar Registration Sample - From Go Lang Chaincode to (Secure) Ruby Contract Scripts

Hello,

for the Vienna Hyperledger Meetup I've put together a talk titled:

Contract Scripting for Everyone: (Hyperledger) FabCar Registration Sample
From Go Lang Chaincode to (Secure) Ruby Contract Scripts

that shows that - surprise, surprise - (secure) ruby works great for
(contract) scripting. Code is code and Hyperledger Fabric is really
just a key-value store, that is, a simple hash table.

Awesome Types & Type Signatures / Annotations for Ruby

Hello,

I've started to put together a new awesome page collection about
all things types, type signatures / annotations and more for ruby -
incl. bool, bytes, buffer, enum, flag, record, data and more [1].

Is static the new dynamic? Any type gems / libraries missing?
Please, add or tell.

Happy coding with ruby with types. Cheers. Prost.

[1] <a href="https://github.com/typesigs/awesome-types" title="https://github.com/typesigs/awesome-types">https://github.com/typesigs/awesome-types</a>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Types & Type Signatures (for Ruby) Incl. Bool, Enums, Flags, Records, and More

Hello,

I've started a new org that collects types and type signatures
(typesigs) for ruby [1].

Ruby3 Will Have Types

Hello,

Today's biggest (most upvoted) story on Hacker News:

Ruby3 Will Have Types [1]

Any comments or thoughts here on ruby-talk about the breaking news?

Here are my two cents:

As a head start you can add the missing Bool type today :-), use the
safebool library / gem [2]

Sorbet is a great inspiring project.

Programming Bits, Bytes 'n' Blocks (in Ruby) Step-by-Step Book - Let's start with the types of strings, that is, bytes, (string) buffers, and (frozen) strings, ...

Hello,

I've started a new (free online) book(let) titled:

Programming Bits, Bytes 'n' Blocks (in Ruby) Step-by-Step Book / Guide [1]

Let's start with the three types of strings, that is, bytes,
(string) buffers, and (frozen) strings, ...

Trivia Question: What's the difference between?

1) String.new
2) String.new("")
3) ""

Happy bits & bytes slicing & dicing with ruby. Cheers.

Programming Bitcoin Script Transaction (Crypto) Contracts Step-by-Step (in Ruby)

Hello,

I've started a new (free online) book(let) titled
Programming Bitcoin Script Transaction (Crypto) Contracts
Step-by-Step (in Ruby) [1].

Let's start with building your own bitcoin stack machine from zero /
scratch and let's run your own bitcoin ops (operations)...
Example:

## A simple stack machine
def op_add( stack )
left = stack.pop
right = stack.pop
stack.push( left + right )
end

def op_2( stack )
stack.push( 2 )
end

## Let's run!

stack = []
op_2( stack ) #=> stack = [2]
op_2( stack ) #=> stack = [2,2]
op_add( stack ) #=> st

pragmas gem / library - language syntax pragmas - turn on the future today or add your own ideas for easy (re)use for everyone - let's evolve the ruby language together by experimenting in the wild in a pragma(tic) way

Hello,

I've put together a new pragmas gem / library [1] for language syntax pragmas
that lets you turn on the future today or add your own ideas for easy
(re)use for everyone.

Let's evolve the ruby language together by experimenting in the wild
in a pragma(tic) way.

First language syntax pragmas include match patterns, enum and type
types, auto numbered arguments, and more.

michelson library / gem - test simulator / runtime for type-safe 'n' functional (crypto) contracts (in yes, it's just ruby)

Hello,

I've put together michelson [1] - a test simulator and runtime library / gem
that lets you write and run type-safe 'n' functional (crypto)
contracts in yes, it's just ruby.

See the Let's Count [2] or the Let's Vote [3] examples to get started
with functional type-safe Liquidity (OCaml/ReasonML)-style programming in ruby.

```
######################################
# Let's Count - 0, 1, 2, 3
type :Storage, Integer

init [],
def storage()
0
end

entry [Integer],
def inc( by, storage )
[[], storage + by]
end

################################
## Test, Test, Test

storage = stor

Design Question / Challenge - From SmartPy Contract to Yes, It's Just Ruby - Let's Play Nim (The Ancient Math Subtraction Game)

Hello,

Here's another design question / challenge:

Turn the SmartPy contract that lets you play Nim (the ancient math
subtraction game) into a "Yes, It's Just Ruby" version.

Talk Notes - The State of Bool in Ruby - Everything Your Never Wanted to Know

Hello,

For the Vienna.rb April meetup I've put together talk notes on:
The State of Bool in Ruby - Everything Your Never Wanted to Know [1].

The contents reads:

- Trivia Quiz - The States of Bool
- Bool Basics
- Classes, Classes, Classes
- Truthy and Falsy - (Almost) Everything is True
- The state of built-in bool conversions - `to_s`, `to_i`,
`to_b`, `to_bool`
- safebool Library / Gem
- Prior Art
- Some Older Bool / Boolean Libraries
- `ActiveRecord::Type::Boolean < Value`
- Bool Conversion
- Empty String
- Number Two
- Choose

Ruby Conferences 'n' Camps in 2019 Update - What's Upcoming in April? What's News?

Hello,

I've updated the Ruby Conferences 'n' Camps in 2019 - What's Upcoming? [1]
Calendar page @ Planet Ruby.

What's News? Added Deccan RubyConf (in August in Pune, Maharashtra, India),
RubyConf Colombia (in September in Medellín, Colombia), and more.

Happy meeting up with rubyists in 2019. Cheers. Prost.

PS: Do you have a favorite conference?

safebool gem / library - safe bool(ean) type adds Bool(), to_b, to_bool, bool?, false?, true?, true.is_a?(Bool)==true, false.is_a?(Bool)==true, and more

Hello,

I've bundled up all the bool(ean) "hacks" in the safebool gem / library [1]
The new safe bool(ean) type adds Bool(), to_b, to_bool, bool?, false?, true?,
true.is_a?(Bool)==true, false.is_a?(Bool)==true, and more.

From the readme:

Why Bool in Ruby?

```
false.class #=> FalseClass
true.class #=> TrueClass
false.is_a?(Bool) #=> NameError: uninitialized constant Bool
true.is_a?(Bool) #=> NameError: uninitialized constant Bool
true.class.ancestors #=> [TrueClass, Object, Kernel, BasicObject]
false.class.ancestors #=> [TrueClass, Object, Kernel, BasicObj

enums v1.2 library / gem adds (enum) flags w/ bitwise-operators for set (|) / unset (&~) / toggle (^)

Hello,

I've added (bit) enum flags with bitwise-operators
for set (|) / unset (&~) / toggle (^) to the enums library / gem [1].

Use the new flags option for the enum helper or the new Flag class.

Gem of the Week - hexapdf - Read and Write PDF Documents; Merge, Extract, Optimize and Much More

Hello,

I'm restarting (and updating) the Gem of the Week Series [1]
that highlights a new ruby library every week on Thursdays.

Let's welcome the hexapdf gem / library and command line tools [2a][2b] -
read and write PDF documents; start from zero or merge, extract,
optimize and much more.

Thanks to Thomas Leitner for the write-up (and the great gem).

Happy coding with ruby. Cheers.

Vienna.rb Talks Notes - Contracts, Contracts, Contracts - Code Your Own (Crypto Blockchain) Contracts w/ Ruby (sruby), Universum & Co

Hello,

World premiere! The world's first official (secure) ruby talk happened at
the Vienna Ruby (Crypto) meetup tonight. The talk agenda / notes read:

- What's a (Smart) Contract?
- Code is Law?
- Contract-Oriented Programming Languages
- Genesis - Bitcoin Script
- Ivy - Higher-Level Bitcoin Script
- History Corner - Bitcoin - The World's Worst Database for
Everything? - Bitcoin Maximalism in Action
- Turing Complete and the Halting Problem
- Fees, Fees, Fees - $$$ - There's No Free Lunch
- What's the World's Most Popular Programming Language?

units-time library / gem v1.0 - units of time (in epoch time) for secure ruby (sruby)

Hello,

I've put together a "standalone" library / gem for
units of time (in epoch time) incl.

Awesome Rubies Updated (Now Incl. mruby/c, sruby (s6), and More)

Hello,

I've updated the Awesome Rubies [1] page that collects compilers,
interpreters, virtual machines, parsers, doc generators, version
managers, and more.

What’s news? Let’s welcome mruby/c, sruby (s6) and more.

Anything missing? Contributions welcome. Let us know.

Happy coding with rubies. Cheers. Prost.

[1] <a href="https://github.com/planetruby/awesome-rubies" title="https://github.com/planetruby/awesome-rubies">https://github.com/planetruby/awesome-rubies</a>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

enums 1.0 library / gem - safe enumeration types for ruby e.g. enum :Color, [:red, :green, :blue]

Hello,

I've put together a new enums library / gem [1] for safe
enumeration types in ruby.

Yes, enums are just a set of symbolic keys bound to unique integer numbers.
Why not just use symbols :-) or constants? Do we really need a new enum type
and (yet another) library?

(Secure) Ruby Quiz - Code Challenge #3 - Powerball Mega Millions Grand Prize - Create a Power Play Contract for America's Most Popular Lottery

Hello,

It's Friday. (Secure) Ruby Quiz Time!

Let's use America's most popular lottery - Powerball Mega Millions -
and make it provable fair by - surprise, surprise -
putting the machinery on the blockchain with a contract script in
(secure) ruby, of course [1].

First let's warm-up with the simplest possible lottery
from the book "Building Games with Ethereum Smart Contracts"
by Kedar Iyer and Chris Dannen.

Join us. Question or comments welcome.
Note, the ruby-talk mailing list right here is the "official" sruby channel.

Cheers. Prost.

(Secure) Ruby to Solidity (Source-to-Source) Cross-Compiler Cheat Sheet / White Paper

Hello,

I've started a new white paper / cheat sheet on
a (secure) ruby to solidity (source-to-source) cross-compiler [1].

If anyone is interested in how to turn ruby into solidity (and
ethereum virtual machine (evm) bytecode) let us know!
Question or comments welcome. Yes, the ruby-talk mailing list
right here is the "official" sruby channel.

Cheers.

Designing sruby (Secure Ruby) - Use ivars (@balance) or Storage class (storage.balance) for (Blockchain) State?

Hello,

If anyone follows along about the new ruby variant / flavor called sruby
- Small, Smart, Secure, Safe, Solid & Sound (S6) Ruby.

Here's a language design choice: How to track the contract's
(blockchain) state?

a) Let's (re)use ruby's ivars (object instance variables) e.g.:

def initialize
@owner = msg.sender
@counter = 0
@bets = Mapping.of( Integer => Bet )
end

or b) let's use a more "explicit" Storage class e.g.:

def initialize
storage[:owner] = msg.sender
storage[:counter] = 0
storage[:bets] = Mapping.of( Integer => Bet )
end

Ruby Quiz - (Crypto) Blockchain Contract Edition - Challenge #2 - Code Challenge #2 - Create a PonzICO Investment Contract - Blockchain Performance Art

Hello,

to kickstart the new ruby quiz (crypto) blockchain contract edition
let's add another (easier) coding challenge:

Challenge #2 - Create a PonzICO Investment Contract - Blockchain
Performance Art [1]

Let's use the live and "real world" blockchain performance art
PonzICO investment contract [2] running on the Ethereum world computer.

Read the PonzICO White Paper [3] for how the investment scheme and
dividend payouts work and what your money will get used for (hint:
thanks for the free Tesla - don't forget to vote on the color :-) and
maybe a two bedroom condo in San Franc