Skip to content

Instantly share code, notes, and snippets.

@cbskgc
cbskgc / 0_reuse_code.js
Created February 22, 2014 11:26
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
@cbskgc
cbskgc / InsertionModeReplaceWithExample.cshtml
Created February 16, 2014 22:50
Supporting ReplaceWith for AjaxOption.InsertionMode: It is occasionally convenient to be able to update content including the target container. This avoids a separate container to wrap the partial view statement.
@{
var ajaxOptions = new AjaxOptions { UpdateTargetId = "form" };
var htmlAttributes = new { id = "form", data_ajax_mode = "replacewith" };
}
@using (Ajax.BeginForm("Index", null, ajaxOptions, htmlAttributes))
{
}
@cbskgc
cbskgc / Standardizing Setup on a Sealed Class
Created February 16, 2014 14:47
If you have a sealed class and would like to standardize or automate setup, one of the solutions is to create a class with an operator overload.
public class DefaultController : Controller
{
public ActionResult Index()
{
Response.Cookies.Add(new AccountIdCookie(12345));
return View();
}
}
class AccountIdCookie