Skip to content

Instantly share code, notes, and snippets.

@rpgmaker
rpgmaker / gist:3011881
Created June 28, 2012 15:04
SubscriberExtension
public static partial class SubscriberExtension {
private static readonly MethodInfo MessageReceivedMethod = typeof(Subscriber).GetMethod("OnMessageReceived");
private static readonly ConcurrentDictionary<string, object> _cacheListActions =
new ConcurrentDictionary<string, object>();
private static readonly Type _ilistType = typeof(IList<>);
private static readonly MethodInfo _toObjects =
typeof(SubscriberExtension).GetMethod("ToObjects", BindingFlags.Static | BindingFlags.NonPublic);
@rpgmaker
rpgmaker / gist:3001802
Created June 27, 2012 06:02
JS API (Kinda Final)
if (!JSON) {
throw new Error("JSON library is required to load PSERVICEBUS. Please reference json2.js");
}
if (!jQuery) {
throw new Error("jQuery library is required to load PSERVICEBUS");
}
String.format = function (text) {
'use strict';
@rpgmaker
rpgmaker / gist:2870068
Created June 4, 2012 18:30
Message Resequencer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PServiceBus.Core.Interface;
using PServiceBus.Core.Runtime.Messages;
using PServiceBus.Core.Manager;
using PServiceBus.Core.Runtime.Configuration;
using System.Threading;
using PServiceBus.Core.Runtime;
@rpgmaker
rpgmaker / gist:2729811
Created May 19, 2012 07:00
PSB JS API (6th Draft)
if (!JSON) {
throw new Error("JSON library is required to load PSERVICEBUS. Please reference json2.js");
}
if (!jQuery) {
throw new Error("jQuery library is required to load PSERVICEBUS");
}
String.format = function (text) {
'use strict';
@rpgmaker
rpgmaker / gist:2729167
Created May 19, 2012 04:44
PSB JS API (5th Draft)
if (!JSON) {
throw new Error("JSON library is required to load PSERVICEBUS. Please reference json2.js");
}
if (!jQuery) {
throw new Error("jQuery library is required to load PSERVICEBUS");
}
String.format = function (text) {
'use strict';
@rpgmaker
rpgmaker / gist:2716497
Created May 17, 2012 04:54
PSB JS API (4th Draft)
if (!JSON) {
throw new Error("JSON library is required to load PSERVICEBUS. Please reference json2.js");
}
if (!jQuery) {
throw new Error("jQuery library is required to load PSERVICEBUS");
}
String.format = function (text) {
'use strict';
@rpgmaker
rpgmaker / gist:2711513
Created May 16, 2012 15:51
PSB JS API (Third Draft)
if (!JSON) {
throw new Error("JSON library is required to load PSERVICEBUS. Please reference json2.js");
}
if (!jQuery) {
throw new Error("jQuery library is required to load PSERVICEBUS");
}
String.format = function (text) {
'use strict';
@rpgmaker
rpgmaker / gist:2691804
Created May 14, 2012 04:31
PSB JS API (Second Draft)
var JSON;
if (!JSON) {
JSON = {};
}
(function () {
'use strict';
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
@rpgmaker
rpgmaker / gist:2657403
Created May 11, 2012 03:48
First Draft for JS API
String.format = function (text) {
if (arguments.length <= 1) return text;
var length = arguments.length - 2, token;
for (token = 0; token <= length; token++) {
text = text.replace(new RegExp("\\{" + token + "\\}", "gi"), arguments[token + 1]);
}
return text;
};
@rpgmaker
rpgmaker / gist:2635210
Created May 8, 2012 13:51
Initial JS API Rewrite
String.format = function (text) {
if (arguments.length <= 1)
return text;
var tokenCount = arguments.length - 2;
for (var token = 0; token <= tokenCount; token++) {
text = text.replace(new RegExp("\\{" + token + "\\}", "gi"), arguments[token + 1]);
}
return text;
};