Skip to content

Instantly share code, notes, and snippets.

@rikkimax
rikkimax / test.d
Created February 9, 2014 06:18
Route test for restful api and javascript models.
class Test : OORoute {
@RouteGroup(null, "/.svc") {
mixin RestfulRoute!(RestfulProtection.All, Book3, Page3);
}
}
@rikkimax
rikkimax / books.js
Created February 9, 2014 06:20
Example javascript generation from data model
var Books3 = Class({
constructor: function(_id, edition) {
this._id = _id === undefined ? "" : _id;
this.edition = Number(edition === undefined ? "0" : edition);
},
save: function() {
var this_ = this;
new Ajax.Request("/.svc/Books3/" + this._id, {
method: "POST",
parameters: {
@rikkimax
rikkimax / book.d
Created February 9, 2014 06:21
Example dvorm data model with javascript generation
module cmsed.test.models.book;
import cmsed.base.routing;
import dvorm;
@dbName("Books3")
class Book3 {
@dbId
@dbName("")
Book3Id key = new Book3Id;
mixin template MixinUDACheck(T) {
mixin("bool is" ~ T.stringof ~ " (C, string f)(C c = C.init)" ~ q{{
foreach(UDA; __traits(getAttributes, mixin("c." ~ f))) {
static if (is(UDA == T)) {
return true;
}
}
return false;
}});
T mul(T)(T x, T y) {
return x * y;
}
void test(size_t function(size_t x, size_t y) mul) {
assert(mul(2, 2) == 4);
}
void main() {
test(&mul!size_t);
{
Include: test.h
Include: test2.h
Unknown: {
something
}
Condition: 1 + 1 == 2 {
module cmsed.test.models.book;
import cmsed.base;
import dvorm;
@dbName("Books3")
class Book3 {
@dbId
@dbName("")
Book3Id key = new Book3Id;
module cmsed.test.models.book;
import cmsed.base;
import dvorm;
@dbName("Books3")
class Book3 {
@dbId
@dbName("")
Book3Id key = new Book3Id;

Dakka is an actor based framework in the idea of Akka.

Descriptions

  • An actor can be located any where.
    An actor in of itself is unique per the location.
    Please note that any two are not the same but are very similar.
  • The closest actor to the present actor should be used when referencing.
    If this is local in the same location or in another it doesn't matter.
  • An actor knows who's near it (supervisor and children).
var Books3 = Class({
constructor: function(_id, edition) {
this._id = _id === undefined ? "" : _id;
this.edition = Number(edition === undefined ? "0" : edition);
},
save: function() {
var this_ = this;
new Ajax.Request("/.svc/Books3/" + this._id, {
method: "POST",
parameters: {