View relay.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tessel = require('tessel'); | |
var relaylib = require('relay-mono'); | |
var router = require('tiny-router'); | |
setTimeout( function() { | |
var relay = relaylib.use(tessel.port['A']); | |
relay.on('ready', function relayReady() { | |
console.log('Relays ready...'); |
View relay.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tessel = require('tessel'); | |
var relaylib = require('relay-mono'); | |
var http = require( 'http' ); | |
var myIP = require('my-ip'); | |
setTimeout( function() { | |
var relay = relaylib.use(tessel.port['A']); | |
relay.on('ready', function relayReady () { |
View gist:52767d440294be0a1188
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SessionActivities : IBundle | |
{ | |
private Projection<List<SessionActivity>> _projection; | |
public IProjection Build() | |
{ | |
_projection = Compose<List<SessionActivity>> | |
.Projection() | |
.Initialize(() => new List<SessionActivity>()) | |
.When("SessionOpened", (@event, state) => |
View gist:edd75a600e86fb59130b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compose a projection. | |
// - Tell what type of state the projection maintains (List<WizardActivity>) | |
var projection = Compose<List<WizardActivity>>.Projection() | |
.Initialize(() => new List<WizardActivity>()) // How do you want to initialize the state when you run the projection? | |
// When a wizard was started we want to know about it. | |
.When<WizardStarted>((@event, state) => | |
{ | |
var activity = new WizardActivity(@event.CorrelationId.Value, @event.TimeStamp); | |
if (!state.Contains(activity)) | |
state.Add(activity); |
View angular-log4angular.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (window, angular, undefined) { | |
'use strict'; | |
var log4AngularModule = angular.module('bp.log4Angular', []). | |
provider('$log4Angular', $log4AngularProvider); | |
log4AngularModule.factory('consoleAppender', ['$log', function ($log) { | |
// Define the constructor function | |
function Appender($log) { |
View gist:9502826
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sellableFactory() { | |
this.deserialize = function (properties) { | |
var factory = new window[properties.type + 'SellableFactory'](); | |
var sellable = Object.create(factory.sellableType.prototype); | |
angular.copy(properties, sellable); | |
return sellable; | |
} | |
}; | |
function glasscurtainSellableFactory() { |
View gist:9335086
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
var http = require('http'); | |
var uuid = require('node-uuid'); | |
var cluster = require('cluster'); | |
var numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { |
View gist:9207063
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Error | |
{ | |
public static readonly Error None = new Error("none"); | |
public static readonly Error InternalError = new Error("E1"); | |
// ... | |
protected Error(string errorCode) | |
{ | |
Code = errorCode; | |
} |
View gist:7944393
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fromStream("account-55") | |
.when({ | |
$init: function (s,e) { | |
return { total: 0 }; | |
}, | |
AccountDebited: function(s, e) { | |
s.total += e.body.debitedAmount; // Mo money, mo problems | |
return s; | |
}, | |
AccountCredited: function(s, e) { |
View gist:7710361
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Web.Http.Controllers; | |
using System.Web.Http.Filters; | |
namespace AppHarbor.Web | |
{ | |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)] |