Skip to content

Instantly share code, notes, and snippets.

View tboby's full-sized avatar

Thomas Boby tboby

  • Oxford, UK
  • 00:45 (UTC +01:00)
View GitHub Profile
@tboby
tboby / PartialFor.cs
Last active August 29, 2015 14:28 — forked from joeriks/ArticlePageViewModel.cs
PartialFor - resolve name of partial from type name or from UIHint (like DisplayFor)
using System;
using System.Linq.Expressions;
using System.Web.Mvc;
using System.Web.Mvc.Html;
public static class PartialForExtensions
{
public static MvcHtmlString PartialFor<T>(this HtmlHelper<T> htmlHelper, Expression<Func<T, object>> expression,
string partialViewName, ViewDataDictionary viewData)
{
var model = expression.Compile()(htmlHelper.ViewData.Model);
@tboby
tboby / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console