Skip to content

Instantly share code, notes, and snippets.

View martinstarkov's full-sized avatar
🐢

Martin martinstarkov

🐢
View GitHub Profile
@martinstarkov
martinstarkov / event_handler.cpp
Last active July 16, 2024 18:27
Convenient Event Handler Implementation
#include <iostream>
#include <functional>
#include <unordered_map>
#include <type_traits>
#include <cstdint>
struct Event {
public:
virtual ~Event() = default;
};
@martinstarkov
martinstarkov / opengl_layout_reflection.cpp
Last active July 16, 2024 13:34
Automatic OpenGL Vertex Buffer Layout Determination (Reflection) using Luple
#include <array>
#include <cstdint>
#include <iostream> // for debugging only
#include <type_traits>
#include <utility>
#include <vector>
// Luple from: https://github.com/alexpolt/luple
template <typename... TT>
@martinstarkov
martinstarkov / stepper_swapper.ino
Last active July 16, 2024 13:35
Arduino Stepper Swapper
#include <Arduino.h>
#include <Servo.h>
#include <string.h>
class ServoMotor {
public:
ServoMotor(int pin, int cw, int stop, int ccw, int delay)
: pin_{ pin }, cw_{ cw }, stop_{ stop }, ccw_{ ccw }, delay_{ delay } {}