Skip to content

Instantly share code, notes, and snippets.

public interface Button {
void Click();
}
public interface Label {
void setText(string text);
string getText();
}
// TRADITIONAL
local intercept = {}
function intercept.before(func, callback)
return function(...)
callback(...)
return func(...)
end
end
function intercept.after(func, callback)
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)
@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 {
@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
public class Patient
{
protected string Name;
protected MedicalRecords MedicalRecords;
protected List<Surgery> ScheduledSurgeries;
}
@maritaria
maritaria / Program.cs
Created June 8, 2017 17:28
Hash collision test (using blocks to reach larger coordinates
using System;
using System.Collections.Generic;
namespace ConsoleApplication4
{
public class Program
{
private struct Vector
{
private int x, y, z;
Deployment
- Code for real-time measurements & logging
- Instrumentation for testing / benchmarking
- Runtime tools
Use cases (with examples)
- Benchmarking impact of new or updated features (regression testing)
- Realtime monitoring to create alerts when performance lowers
- Analysing production logs to find bottlenecks / memoryleaks
public static void main(String[] args){
Model schema = FileManager.get().loadModel("test_ontology.xml");
Model data = FileManager.get().loadModel("royal92.owl");
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
reasoner = reasoner.bindSchema(schema);
InfModel infmodel = ModelFactory.createInfModel(reasoner, data);
final String NS = "http://www.daml.org/2001/01/gedcom/royal92#";
@maritaria
maritaria / main.cs
Created December 11, 2016 23:13
Reproduction code
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;
namespace CompilerGeneratedEnhancement
{
// Token: 0x02000002 RID: 2