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 HomeModule : NancyModule | |
{ | |
public HomeModule() | |
{ | |
Get["/"] = _ => "Hi"; | |
Post["/"] = _ => | |
{ | |
this.ModelValidationResult.Errors.Add("FirstName", "Firstname must start with a Z"); | |
this.ModelValidationResult.Errors.Add("LastName", "Lastname must rhyme with Orange"); |
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
[diff] | |
tool = diffmerge | |
[merge] | |
tool = diffmerge | |
[difftool "diffmerge"] | |
cmd = 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' "$LOCAL" "$REMOTE" | |
[mergetool "diffmerge"] | |
cmd = 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' -merge -result="$PWD/$MERGED" "$PWD/$LOCAL" "$PWD/$BASE" "$PWD/$REMOTE" | |
trustExitCode = true | |
keepBackup = false |
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 ProductController : Controller | |
{ | |
private IMediate _mediator; | |
public ProductController(IMediate mediator) | |
{ | |
_mediator = mediator; | |
} | |
public ViewResult ProductDetails(ProductDetailQuery query) |
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 ConsoleApplication1 | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Net; | |
using System.Security.Principal; | |
using Microsoft.Owin.Hosting; | |
using Nancy; | |
using Owin; |
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
FROM mono:4.0.1 | |
RUN apt-get -qq update && apt-get -qqy install ruby1.9.3 wget build-essential gettext | |
RUN apt-get install zlib1g-dev | |
RUN gem install rake | |
RUN gem install albacore --version "1.0.0.rc2" |
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
[36mBuilt-in Atom packages[39m (90) | |
├── about@1.1.0 | |
├── archive-view@0.60.0 | |
├── atom-dark-syntax@0.27.0 | |
├── atom-dark-ui@0.51.0 | |
├── atom-light-syntax@0.28.0 | |
├── atom-light-ui@0.43.0 | |
├── autocomplete-atom-api@0.9.2 | |
├── autocomplete-css@0.10.1 | |
├── autocomplete-html@0.7.2 |
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 Cache : ICache | |
{ | |
private ConcurrentDictionary<string, DateTime> cacheLookup = new ConcurrentDictionary<string,DateTime>(); | |
public Response Get(NancyContext ctx) | |
{ | |
DateTime lastmodified; | |
if(ctx.Request.Method == "GET") //Could be POST as well I guess | |
{ |
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 Cache : ICache | |
{ | |
private ConcurrentDictionary<int, Response> cachedResponses = new ConcurrentDictionary<int,Response>(); //Use Redis in Production | |
public Response GetOrInvalidate(NancyContext ctx) | |
{ | |
Response resp; | |
if(ctx.Request.Method == "GET") | |
{ |
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 AssemblyExtensions | |
{ | |
public static string GetExecutionPath() | |
{ | |
var codeBase = Assembly.GetExecutingAssembly().CodeBase; | |
var uri = new Uri(codeBase); | |
var path = uri.LocalPath; | |
var root = Path.GetDirectoryName(path); | |
return root; | |
} |
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 AppRegistrations | |
{ | |
private INancyBootstrapper bootstrapper; | |
public INancyBootstrapper Bootstrapper | |
{ | |
get{ return bootstrapper ?? new MyBootstrapper(); } | |
set{ bootstrapper = value; } | |
} | |
} |