Skip to content

Instantly share code, notes, and snippets.

Lacking a social network that leaves us:
1. owners of our own content,
2. managers of own privacy, and
3. just as capable of discovering the serendipities within our social graph.
We set forth to build an online network that:
1. decentralizes the control of content by placing it firmly with its
individual users,
module MappedProperty
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def mapped_property(name, geocoder = "Location")
class_eval <<-END, __FILE__, __LINE__
property :#{name}, String
property :#{name}_lng, Float
> ruby -rmath_functions.rb -e "puts MathFunctions.factorial(2)"
2
> ruby --test -rmath_functions.rb
.
Finished in 1.000706 seconds.
1 tests, 2 assertions, 0 failures, 0 errors
# anybody already using an Object monkey-patch like the one below:
class Object
def send_chain(v)
this = self
v.each { |k| this = this.send(*k) }
this
end
end
import std.stdio;
class KdTree {
private int _dimensions;
int dimensions() {
return _dimensions;
}
KdNode *rootNode;
/* Example DataDapper Model */
class User {
struct Properties {
DD_Property!(int,"id") id;
DD_Property!(string,"username") username;
DD_Property!(double,"score") score;
}
Properties properties;
class Module
alias_method :include_without_hooks, :include
def include(*modules)
include_before_hook(*modules)
include_without_hooks(*modules)
include_after_hook(*modules)
end
def include_before_hook(*modules)