Skip to content

Instantly share code, notes, and snippets.

Maciej Aniserowicz maniserowicz

Block or report user

Report or block maniserowicz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View angular-signalr
.factory('signalr', ['$rootScope', '$timeout', function ($rootScope, $timeout) {
function signalrProxyFactory(hubName, startedCallback, startOptions) {
var connection = $.hubConnection();
var proxy = connection.createHubProxy(hubName);
// required by SignalR to work... we need to attach at least one handler
// to the proxy before calling 'start'
proxy.on('stub', function () { });
var startPromise = connection.start(startOptions);
maniserowicz / ToInvariantString
Created Oct 17, 2013
format any object using CultureInfo.InvariantCulture
View ToInvariantString
public static string ToInvariantString(this object @this)
var formattable = @this as IFormattable;
if (formattable != null)
return formattable.ToString(null, CultureInfo.InvariantCulture);
return @this.ToString();
View FeeCalculator.cs
public class FeeCalculator
public const decimal DailyFee = 50.0m;
public decimal FeeFor(DateTime startTime)
DateTime now = ApplicationTime.Current;
if (startTime > now)
View ApplicationTime.cs
public static class ApplicationTime
private static readonly Func<DateTime> _defaultLogic = () => DateTime.UtcNow;
private static Func<DateTime> _current = _defaultLogic;
/// <summary>
/// Returns current date/time, correct in application context
/// </summary>
/// <remarks>Normally this would return <see cref="DateTime.UtcNow"/>, but can be changed to make testing easier.</remarks>
View CurrentTimeProvider.cs
public interface ICurrentTimeProvider
DateTime GetCurrentTime();
public class CurrentTimeProvider : ICurrentTimeProvider
public DateTime GetCurrentTime()
return DateTime.UtcNow;
You can’t perform that action at this time.