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() { | |
"use strict"; | |
if (!_) { | |
throw "Cannot find underscore.js"; | |
} | |
var TemplateCache = function(baseUrl) { | |
this.BaseUrl = baseUrl; | |
this.Templates = {}; |
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 SimpleInjector; | |
using SimpleInjector.Diagnostics; | |
public static class ContainerDiagnosticExtensions | |
{ | |
public static Registration GetRegistration<TService>(this Container container) | |
{ | |
return container.GetRegistration(typeof(TService)).Registration; |
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; | |
public static class CacheFunctionExtensions | |
{ | |
public static Func<TResult> Memoize<TResult>(this Func<TResult> function, bool threadSafe = false) | |
{ | |
var lazy = new Lazy<TResult>(function, threadSafe); | |
return () => lazy.Value; | |
} |
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
$('table tr').on('focus', 'textarea[rows][cols]', function(event) { | |
var $blurFrom = $(event.delegateTarget); | |
$blurFrom.css("background-color","yellow"); | |
$blurFrom.find("textarea[rows][cols]").each(function(i, element) { | |
expandHeight($(element)); | |
}); | |
}); | |
$('table tr').on('focusout', 'textarea[rows][cols]', function(event) { | |
var $blurFrom = $(event.delegateTarget); |
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 static class ExceptionExtensions | |
{ | |
public static TException Unwrap<TException>(this Exception exception) where TException : Exception | |
{ | |
for (; exception != null; exception = exception.InnerException) | |
{ | |
var typedException = exception as TException; | |
if (typedException != null) | |
{ | |
return typedException; |
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
namespace Timing | |
{ | |
using System; | |
using System.Diagnostics; | |
using System.Web.Mvc; | |
public class TraceScope : IDisposable | |
{ | |
private readonly string _name; | |
private readonly ViewContext _viewContext; |
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 log4net; | |
using log4net.Config; | |
using log4net.Util; | |
[assembly: XmlConfigurator(Watch = true, ConfigFile = "log4net.config")] | |
namespace LogWrapper | |
{ | |
public static class Logger |
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() { | |
"use strict"; | |
window.Pager = function (itemSelector, pageSize) { | |
this.ItemSelector = itemSelector; | |
this.PageSize = pageSize; | |
this.CurrentPage = 1; | |
this.ItemCount = $(itemSelector).length; | |
this.PageCount = Math.round(this.ItemCount / pageSize + 0.5); | |
this.Selectors = { |
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
SELECT | |
[Job].[name] [JobName], | |
[Category].[name] [CategoryName], | |
[History].[step_name] [StepName], | |
CAST(CAST([History].[run_date] AS varchar(8)) AS date) [RunDate], | |
CAST(CAST([History].[run_time] / 10000 AS varchar(2)) + ':' + CAST(([History].[run_time] % 10000) / 100 AS varchar(2)) + ':' + CAST(([History].[run_time] % 100) AS varchar(2)) AS time(0)) [RunTime], | |
[History].[message] [Message] | |
FROM msdb.dbo.sysjobs [Job] | |
INNER JOIN msdb.dbo.syscategories [Category] ON [Job].[category_id] = [Category].[category_id] | |
CROSS APPLY |
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 static class FormatConfig | |
{ | |
private class JsonContentNegotiator : IContentNegotiator | |
{ | |
private readonly JsonMediaTypeFormatter _jsonFormatter; | |
public JsonContentNegotiator(JsonMediaTypeFormatter formatter) | |
{ | |
_jsonFormatter = formatter; | |
} |
NewerOlder