Skip to content

Instantly share code, notes, and snippets.

View jsrmalvarez's full-sized avatar

José Ramón Álvarez Rojo jsrmalvarez

View GitHub Profile
@jsrmalvarez
jsrmalvarez / visitorPatternDemo.zig
Created November 30, 2024 12:22
Visitor Pattern demo in Zig
const std = @import("std");
const Real = f32;
const Rational = struct { numerator: i32, denominator: i32 };
const Number = union(enum) { real: Real, rational: Rational };
const PrintVisitor = struct {
pub fn visit(n: Number) void {
@jsrmalvarez
jsrmalvarez / resume.json
Last active April 23, 2024 17:40
My resume
{
"$schema": "http://json-schema.org/draft-04/schema#",
"basics": {
"name": "José Ramón Álvarez Rojo",
"label": "Software Engineer",
"email": "jsrmalvarez@ninjatic.engineer",
"url": "https://ninjatic.engineer",
"summary": "Software Engineer with over 15 years of expertise in C++, as well as React, embedded device development, Rust, Java and Python. Proficient in backend, frontend, and embedded systems projects, contributing in the process automation industry.",
"location": {
"region": "Madrid",
@jsrmalvarez
jsrmalvarez / visitorPatternDemo.rs
Created April 21, 2024 23:52
Visitor Pattern demo in Rust
#[derive(Copy, Clone)]
struct Rational {
numerator:i32,
denominator:i32,
}
#[derive(Copy, Clone)]
enum Number{
Real(f32),
Rational(Rational),
@jsrmalvarez
jsrmalvarez / visitorPatternDemo.cpp
Created April 21, 2024 23:50
Visitor Pattern demo in C++ using std::visit and std::variant
#include <iostream>
#include <variant>
#include <cstdlib>
using Real = double;
struct Rational {
int numerator;
int denominator;
STATIC_ASSERT(condition) // Error if condition doesn't hold