Skip to content

Instantly share code, notes, and snippets.

public class Patient
{
protected string Name;
protected MedicalRecords MedicalRecords;
protected List<Surgery> ScheduledSurgeries;
}
@maritaria
maritaria / classes.lua
Created January 12, 2018 12:46
Lua multiple views solution
local classes = {}
local registry = {}
function classes.createClass(classname)
local class = {}
class.__views = {}
registry[classname] = class
return class
end
@maritaria
maritaria / consumer.h
Created January 15, 2018 02:25
AspectC++ Mixing functional and interaction code
#ifndef __CONSUMER_H__
#define __CONSUMER_H__
#include <algorithm>
#include <iostream>
#include <vector>
typedef int TimeSlot;
class Consumer {
local hooks = require("hooks") -- loads hooks.lua from same dir
hooks.add("test", "a", function(num) print("a", num) end)
hooks.add("test", "b", function(num) print("b", num + 2) end)
hooks.call("test", 4)
hooks.remove("test", "a")
hooks.call("test", 4)
local intercept = {}
function intercept.before(func, callback)
return function(...)
callback(...)
return func(...)
end
end
function intercept.after(func, callback)
public interface Button {
void Click();
}
public interface Label {
void setText(string text);
string getText();
}
// TRADITIONAL