Skip to content

Instantly share code, notes, and snippets.

View jasonmitchell's full-sized avatar

Jason Mitchell jasonmitchell

View GitHub Profile
public class Customer
{
[Key]
public int ID { get; set; }
[Required]
public string FirstName { get; set; }
[Required]
public string LastName { get; set; }
<local:ThemeAwarePanorama Title="my app"
LightBackground="/MyApp;component/Content/Images/Light/Background.jpg"
DarkBackground="/MyApp;component/Content/Images/Dark/Background.jpg">
<!-- more xaml -->
</local:ThemeAwarePanorama>
<#@ template debug="true" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System.Core" #>
<#@ Assembly Name="System.Windows.Forms" #>
<#@ Assembly Name="System.Web.Mvc" #>
<#@ assembly name="$(SolutionDir)MyProject.WebApplication\bin\MyProject.WebApplication.dll" #>
<#@ import namespace="System" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.Linq" #>
using NHibernate;
using NUnit.Framework;
namespace UnitTests
{
public abstract class AbstractInMemoryDataFixture
{
private ISession session;
[SetUp]
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Quickstart.Web.Extensions
{
public static class ObjectExtensions
{
public static string ToJson(this object obj)
{
JsonSerializerSettings serializerSettings = new JsonSerializerSettings
@using Quickstart.Web.Extensions
@model Quickstart.Web.Models.Person
@section scripts
{
<script type="text/javascript">
var viewModel = ko.mapping.fromJS(@Html.Raw(Model.ToJson()));
ko.applyBindings(viewModel);
</script>
}
@model Quickstart.Web.Models.Person
@section scripts
{
<script type="text/javascript" src="/Scripts/ViewModels/AjaxModelLoading.js"></script>
<script type="text/javascript">
var viewModel = new AjaxModelLoading("@Url.Action("AjaxModelLoading")");
ko.applyBindings(viewModel);
viewModel.getRandomModel();
@using Quickstart.Web.Extensions
@model Quickstart.Web.Models.Person
@section scripts
{
<script type="text/javascript" src="/Scripts/moment.min.js"></script>
<script type="text/javascript" src="/Scripts/knockout.bindings.date.js"></script>
<script type="text/javascript">
var viewModel = ko.mapping.fromJS(@Html.Raw(Model.ToJson()));
ko.applyBindings(viewModel);
define('module-id', ['array', 'of', 'dependencies'], function (array, of, dependencies) {
// Module definition
});
@jasonmitchell
jasonmitchell / BasicMiddleware.cs
Last active August 29, 2015 14:25
Sample code demonstrating the basics of writing OWIN middleware. Associated blog article: http://json.codes/blog/basics-of-writing-owin-middleware/
using System.Threading.Tasks;
using Microsoft.Owin;
public class BasicMiddleware : OwinMiddleware
{
public BasicMiddleware(OwinMiddleware next) : base(next)
{
}