Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Brandon Satrom bsatrom

🏠
Working from home
View GitHub Profile
@bsatrom
bsatrom / raw.html
Created Sep 1, 2011
HTML5 Web Forms, ASP.NET MVC and MvcContrib
View raw.html
<fieldset>
<legend>Place Your Order</legend>
Name: <input type="text" class="field" id="orderName" required autofocus placeholder="ex. Hugo Reyes" />
Email: <input type="email" class="field" id="orderEmail" required placeholder="ex. name@domain.com" />
Website: <input type="url" class="field" id="orderWebsite" placeholder="ex. http://www.domain.com" />
Phone: <input type="tel" id="orderTelephone" class="field" pattern="\(\d\d\d\) \d\d\d\-\d\d\d\d" title="(xxx) xxx-xxxx" />
Requested Delivery Date: <input type="date" id="deliveryDate" class="field" required />
Shipping Address: <textarea rows="4" cols="20" id="orderShipping" class="field" required></textarea>
Quantity: <input type="number" id="orderQty" name="orderQty" min=1 max=10 step=1 value=1 />
<input type="submit" value="Place Order" />
@bsatrom
bsatrom / createBindings.js
Created Aug 8, 2011
Gists for knockout.unobtrusive post
View createBindings.js
ko.unobtrusive.createBindings(bindings);
ko.applyBindings(viewModel);
@bsatrom
bsatrom / MVCandUnobtrusive.html
Created Jul 27, 2011
KnockoutJS and ASP.NET MVC strongly-typed helpers
View MVCandUnobtrusive.html
<fieldset>
<legend>Speaker Info</legend>
Name: @Html.TextBoxFor(m => m.Name) <br />
Bio: @Html.TextAreaFor(m => m.Bio) <br />
Twitter Handle: @Html.TextBoxFor(m => m.TwitterHandle) <br />
State: @Html.TextBoxFor(m => m.State) <br />
</fieldset>
@bsatrom
bsatrom / addSpeaker-brief.html
Created Jul 1, 2011
Moving from markup-based KnockoutJS bindings to unobtrusive bindings (After)
View addSpeaker-brief.html
<form id="addSpeaker">
<fieldset>
<legend>Speaker Info</legend>
Name: <input type="text" id="name" /> <br />
Bio: <textarea id="bio"></textarea> <br />
Twitter Handle: <input type="text" id="twitterHandle" /> <br />
State: <input type="text" id="state" /> <br />
Photo Url: <input type="text" id="photoUrl" />
</fieldset>
<fieldset>
@bsatrom
bsatrom / addSpeaker-brief.html
Created Jun 30, 2011
Moving from markup-based KnockoutJS bindings to unobtrusive bindings (Before)
View addSpeaker-brief.html
<form data-bind="submit: addSpeaker">
<fieldset>
<legend>Speaker Info</legend>
Name: <input type="text" data-bind="value: name" /> <br />
Bio: <textarea data-bind="value: bio"></textarea> <br />
Twitter Handle: <input type="text" data-bind="value: twitterHandle" /> <br />
State: <input type="text" data-bind="value: state" /> <br />
</fieldset>
<fieldset>
<legend>Languages</legend>
View fullconfig.xml
<sources>
<source name="System.Workflow">
<listeners>
<add name="System.Workflow" />
</listeners>
</source>
<source name="System.Workflow.Runtime">
<listeners>
<add name="System.Workflow" />
</listeners>
View layout.cshtml
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
View structuremapcontainer.cs
public class StructureMapContainer : IDependencyResolver
{
static IContainer _container;
public StructureMapContainer(IContainer container)
{
_container = container;
_container.Configure(x => x.Scan(y =>
{
y.AssembliesFromApplicationBaseDirectory();
View setCurrent.cs
MvcServiceLocator.SetCurrent(new StructureMapContainer(container));
View setResolver
DependencyResolver.SetResolver(new StructureMapContainer(container));