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.Collections.Generic; | |
using System.Text.RegularExpressions; | |
using System.Web; | |
using System.Web.UI; | |
namespace StringExtensions | |
{ | |
/// <remarks> | |
/// http://james.newtonking.com/archive/2008/03/27/formatwith-string-format-extension-method.aspx |
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; | |
public static class TimeSpanExtensions | |
{ | |
const double DaysInWeek = 7d; | |
const double DaysInMonth = 365d / 12d; | |
const double DaysInYear = 365d; | |
public static double TotalWeeks(this TimeSpan val) | |
{ |
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; | |
/// <summary> | |
/// This extension class helps to easily convert to/from unix timestamps. | |
/// </summary> | |
public static class DateTimeExtension | |
{ | |
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); | |
/// <summary> |
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
[ | |
{ | |
"event": "send", | |
"msg": { | |
"ts": 1365109999, | |
"subject": "This an example webhook message", | |
"email": "example.webhook@mandrillapp.com", | |
"sender": "example.sender@mandrillapp.com", | |
"tags": [ | |
"webhook-example" |
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.Data; | |
using System.Diagnostics; | |
using NServiceBus; | |
using NServiceBus.Persistence.NHibernate; | |
using NServiceBus.Pipeline; | |
using NServiceBus.Pipeline.Contexts; | |
class MyContextBehaviorRegistration : INeedInitialization | |
{ |
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
busConfiguration.RegisterComponents(r => r.ConfigureComponent<ReceiverDataContext>(DependencyLifecycle.InstancePerUnitOfWork)); | |
busConfiguration.RegisterComponents(r => r.ConfigureComponent<IDbConnection>(b => b.Build<NHibernateStorageContext>().Connection, DependencyLifecycle.InstancePerUnitOfWork)); | |
class DbContextUnitOfWork : IManageUnitsOfWork | |
{ | |
private readonly Func<ReceiverDataContext> createContext; | |
public DbContextUnitOfWork(Func<ReceiverDataContext> createContext) | |
{ |
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
[void] [Reflection.Assembly]::LoadWithPartialName("System.Messaging") | |
[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("LOCALHOST") | % { $_.Purge(); } | |
echo "All MSMQ queues purged" | |
[System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("LOCALHOST") | ForEach-Object { | |
$queueFormatName = "$($_.Path);JOURNAL" | |
#Write-Host $queueFormatName -foregroundcolor cyan |
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 NServiceBus; | |
using NServiceBus.Logging; | |
class ThrottleThroughputWhenCheckFailsUsingScheduler : IWantToRunWhenBusStartsAndStops | |
{ | |
NServiceBus.Unicast.UnicastBus bus; | |
Schedule schedule; | |
ILog Log = LogManager.GetLogger(typeof(CheckBreaker)); |
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 NServiceBus; | |
using NServiceBus.Logging; | |
using ServiceControl.Plugin.CustomChecks; | |
class ThrottleThroughputWhenCheckFails : PeriodicCheck | |
{ | |
NServiceBus.Unicast.UnicastBus bus; | |
ILog Log = LogManager.GetLogger(typeof(IntegrationCustomCheck)); |
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 NServiceBus; | |
using NServiceBus.Hosting.Profiles; | |
using NServiceBus.Log4Net; | |
using NServiceBus.Logging; | |
public class EndpointConfig : IConfigureThisEndpoint | |
{ | |
public EndpointConfig() | |
{ |
OlderNewer