Skip to content

Instantly share code, notes, and snippets.

View swanson's full-sized avatar
😈

matt swanson swanson

😈
View GitHub Profile
@swanson
swanson / ActiveRepository.rb
Created November 26, 2012 16:09 — forked from bokmann/ActiveRepository.rb
ActiveRepository Strawman
# MOTIVATION: As rails apps are growing, people are noticing the drawbacks
# of the ActiveRecord pattern. Several apps I have seen, and several
# developers I have spoken to are looking towards other patterns for object
# persistence. The major drawback with ActiveRecord is that the notion
# of the domain object is conflated with what it means to store/retrieve
# it in any given format (like sql, json, key/value, etc).
#
# This is an attempt to codify the Repository pattern in a way that would
# feel comfortable to beginner and seasoned Ruby developers alike.
#
void queue_swap(event_t *a, event_t *b)
{
event_t *tmp;
// make sure the parent links are updated to point to the new children
if (a->parent && a->parent->left == a)
{
a->parent->left = b;
}
else if (a->parent)