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
String.prototype.format = function () { | |
var literal = this; | |
for (var i = 0; i < arguments.length; i++) { | |
var regex = new RegExp('\\{' + i + '\\}', 'g'); | |
literal = literal.replace(regex, arguments[i]); | |
} | |
return literal; | |
}; |
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 WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
// Register an Action selector that can include template parameters in the name | |
config.Services.Replace(typeof(IHttpActionSelector), new ODataActionSelector()); | |
var model = GetEdmModel(); | |
var odataFormatter = new ODataMediaTypeFormatter(model); | |
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.IO; | |
using System.Reflection; | |
using System.Web; | |
using System.Web.Mvc; | |
using Castle.MicroKernel.Registration; | |
using Castle.Windsor; | |
using Castle.Windsor.Installer; | |
using WednesdayFootball.Factory; |
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
Global.asax contains the following events: | |
Application_Init: Fired when an application initializes or is first called. It’s invoked for all HttpApplication object instances. | |
Application_Disposed: Fired just before an application is destroyed. This is the ideal location for cleaning up previously used resources. | |
Application_Error: Fired when an unhandled exception is encountered within the application. | |
Application_Start: Fired when the first instance of the HttpApplication class is created. It allows you to create objects that are accessible by all HttpApplication instances. | |
Application_End: Fired when the last instance of an HttpApplication class is destroyed. It’s fired only once during an application’s lifetime. | |
Application_BeginRequest: Fired when an application request is received. It’s the first event fired for a request, which is often a page request (URL) that a user enters. | |
Application_EndRequest: The last event fired for an application request. | |
Application_PreRequestHandlerExecute: Fired before the |
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
<system.diagnostics> | |
<sources> | |
<source name="System.ServiceModel" | |
switchValue="Information, ActivityTracing" | |
propagateActivity="true"> | |
<listeners> | |
<add name="traceListener" | |
type="System.Diagnostics.XmlWriterTraceListener" | |
initializeData= "c:\temp\Traces.svclog" /> | |
</listeners> |
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
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
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 struct Id<T> | |
{ | |
public readonly int Value; | |
public Id(int value) | |
{ | |
this.value = value; | |
} | |
public static implicit operator Id<T>(int 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
public abstract class CircuitBreakerState | |
{ | |
protected readonly CircuitBreaker circuitBreaker; | |
protected CircuitBreakerState(CircuitBreaker circuitBreaker) | |
{ | |
this.circuitBreaker = circuitBreaker; | |
} | |
public virtual void ProtectedCodeIsAboutToBeCalled() { } |
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 AutoLocalizingRoute : Route | |
{ | |
public AutoLocalizingRoute(string url, object defaults, object constraints) | |
: base(url, new RouteValueDictionary(defaults), new RouteValueDictionary(constraints), new MvcRouteHandler()) { } | |
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) | |
{ | |
// only set the culture if it's not present in the values dictionary yet | |
// this check ensures that we can link to a specific language when we need to (fe: when picking your language) | |
if (!values.ContainsKey("language")) |
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
# Delete all files order than 7 days under C:\Windows\Temp directory recursively: | |
forfiles /P c:\Windows\Temp /S /D -7 /C "cmd /c del @path" | |
# FORCE delete all files order than 7 days under C:\Windows\Temp directory recursively: | |
forfiles /P c:\Windows\Temp /S /D -7 /C "cmd /c del /f @path" |